base64binary serialization -------------------------- Key: AXIS2-3006 URL: https://issues.apache.org/jira/browse/AXIS2-3006 Project: Axis 2.0 (Axis2) Issue Type: Bug Components: databinding Affects Versions: 1.3 Environment: tested on Axis2 1.2 & 1.3 RC2 os: *nix , windows, tomcat : 5.5.23 java 1.6
Reporter: Georgi Yonchev using POJO's .. this happens when the response is some object with byte[] parameter inside it. here is the server class: public class Test { public Res test(){ Res res = new Res(); StringBuffer sb = new StringBuffer(); for(int i = 0 ; i < 5000; i++){ sb.append(i); } res.setData(sb.toString().getBytes()); return res; } public byte[] test2(){ StringBuffer sb = new StringBuffer(); for(int i = 0 ; i < 5000; i++){ sb.append(i); } return sb.toString().getBytes(); } } Res class: public class Res { private byte[] data; public byte[] getData() { return data; } public void setData(byte[] data) { this.data = data; } } and the wsdl: <wsdl:definitions xmlns:ns="http://" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http:///xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://"><wsdl:types><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax26="http://ws.apache.org/axis2/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws.apache.org/axis2/xsd"> <xs:element name="Res" type="ax26:Res" /> <xs:complexType name="Res"> <xs:sequence> <xs:element name="data" nillable="true" type="xs:base64Binary" /> </xs:sequence> </xs:complexType> </xs:schema><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://ws.apache.org/axis2/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http:///xsd"> <xs:element name="testResponse"> <xs:complexType> <xs:sequence> <xs:element name="return" nillable="true" type="ns0:Res" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="test2Response"> <xs:complexType> <xs:sequence> <xs:element name="return" nillable="true" type="xs:base64Binary" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema></wsdl:types><wsdl:message name="testMessage" /><wsdl:message name="testResponseMessage"><wsdl:part name="part1" element="xsd:testResponse" /></wsdl:message><wsdl:message name="test2Message" /><wsdl:message name="test2ResponseMessage"><wsdl:part name="part1" element="xsd:test2Response" /></wsdl:message><wsdl:portType name="TestPortType"><wsdl:operation name="test"><wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsaw:Action="urn:test" message="ns:testMessage" /><wsdl:output xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" message="ns:testResponseMessage" wsaw:Action="urn:test" /></wsdl:operation><wsdl:operation name="test2"><wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsaw:Action="urn:test2" message="ns:test2Message" /><wsdl:output xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" message="ns:test2ResponseMessage" wsaw:Action="urn:test2" /></wsdl:operation></wsdl:portType><wsdl:binding name="TestSOAP11Binding" type="ns:TestPortType"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /><wsdl:operation name="test"><soap:operation soapAction="urn:test" style="document" /><wsdl:input><soap:body use="literal" /></wsdl:input><wsdl:output><soap:body use="literal" /></wsdl:output></wsdl:operation><wsdl:operation name="test2"><soap:operation soapAction="urn:test2" style="document" /><wsdl:input><soap:body use="literal" /></wsdl:input><wsdl:output><soap:body use="literal" /></wsdl:output></wsdl:operation></wsdl:binding><wsdl:binding name="TestSOAP12Binding" type="ns:TestPortType"><soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /><wsdl:operation name="test"><soap12:operation soapAction="urn:test" style="document" /><wsdl:input><soap12:body use="literal" /></wsdl:input><wsdl:output><soap12:body use="literal" /></wsdl:output></wsdl:operation><wsdl:operation name="test2"><soap12:operation soapAction="urn:test2" style="document" /><wsdl:input><soap12:body use="literal" /></wsdl:input><wsdl:output><soap12:body use="literal" /></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="Test"><wsdl:port name="TestSOAP11port" binding="ns:TestSOAP11Binding"><soap:address location="http://localhost:8080/axis2/services/Test" /></wsdl:port><wsdl:port name="TestSOAP12port" binding="ns:TestSOAP12Binding"><soap12:address location="http://localhost:8080/axis2/services/Test" /></wsdl:port></wsdl:service></wsdl:definitions> this wsdl & service.xml is generated automatically by the eclipse plug-in here is the client: public class Test_client { public static void main(String args[]){ try{ Res res = new Res(); RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); EndpointReference targetEPR = new EndpointReference( "http://10.7.10.50:8080/testService2/services/Test"); options.setTo(targetEPR); QName test = new QName("http:///xsd", "test"); Object[] argss = new Object[] { }; Class[] returnTypes = new Class[] { Res.class }; Object[] response = serviceClient.invokeBlocking(test, argss, returnTypes); res = (Res)response[0]; if (res == null) { System.out.println("serivce didn't initialize!"); } System.out.println(res.getData()); }catch(Exception e){ e.printStackTrace(); } } } so, test2() always works, small/larger byte[] size in test() if you test with "some string".getBytes() will work but larger ... no here is the soap payload : ns:byteData>104</ns:byteData><ns:byteData>111</ns:byteData><ns:byteData>109</ns:byteData><ns:byteData>97</ns:byteData><ns:byteData>44</ns:byteData><ns:byteData>32</ns:byteData><ns:byteData>86</ns:byteData><ns:byteData>101</ns:byteData><ns:byteData>114</ns:byteData><ns:byteData>100</ns:byteData><ns:byteData>97</ns:byteData><ns:byteData>110</ns:byteData><ns:byteData>97</ns:byteData><ns:byteData>44</ns:byteData><ns:byteData>32</ns:byteData><ns:byteData>65</ns:byteData><ns:byteData>114</ns:byteData><ns:byteData>105</ns:byteData><ns:byteData>97</ns:byteData><ns:byteData>108</ns:byteData><ns:byteData>44</ns:byteData><ns:byteData>32</ns:byteData><ns:byteData>72</ns:byteData><ns:byteData>101</ns:byteData><ns:byteData>108</ns:byteData><ns:byteData>118</ns:byteData><ns:byteData>101</ns:byteData><ns:byteData>116</ns:byteData><ns:byteData>105</ns:byteData><ns:byteData>99</ns:byteData><ns:byteData>97</ns:byteData><ns:byteData>59</ns:byteData><ns:byteData>13</ns:byteData><ns:b yteData>10</ns:byteData><ns:byteData>9</ns:byteData><ns:byteData>102</ns:byteData><ns:byteData>111</ns:byteData><ns:byteData>110</ns:byteData><ns:byteData>116</ns:byteData><ns:byteData>45</ns:byteData><ns:byteData>115</ns:byteData><ns:byteData>105</ns:byteData><ns:byteData>122</ns:byteData><ns:byteData>101</ns:byteData><ns:byteData>58</ns:byteData><ns:byteData>32</ns:byteData><ns:byteData>49</ns:byteData><ns:byteData>48</ns:byteData ><ns:byteData>112</ns:byteData><ns:byteData>116</ns:byteData><ns:byteData>59</ns:byteData><ns:byteData>13</ns:byteData><ns:byteData>10</ns:byteData><ns:byteData>9</ns:byteData><ns:byteData>102</ns:byteData><ns:byteData>111</ns:byteData><ns:byteData>110</ns:byteData><ns:byteData>116</ns:byteData><ns:byteData>45</ns:byteData><ns:byteData>119</ns:byteData><ns:byteData>101</ns:byteData><ns:byteData>105</ns:byteData><ns:byteData>103</ns:byteData><ns:byteData>104</ns:byteData><ns:byteData>116</ns:byteData><ns:byteData>58</ns:byteData><ns:byteData>32</ns:byteData><ns:byteData>110</ns:byteData><ns:byteData>111</ns:byteData><ns:byteData>114</ns:byteData><ns:byteData>109</ns:byteData><ns:byteData>97</ns:byteData><ns:byteData>108</ns:byteData><ns:byteData>59</ns:byteData><ns:byteData>13</ns:byteData><ns:byteData>10</ns:byteData><ns:byteData>125</ns:byteData><ns:byteData>13</ns:byteData><ns:byteData>10</ns:byteData><ns:byteData>46</ns:byteData><ns:byteData>99</ns:byteData><ns:byteData>111</ns:byteData><ns:byteData>110</n s:byteData><ns:byteData 2000 >116</ns:byteData><ns:byteData>101</ns:byteData><ns:byteData>110</ns:byteData><ns:byteData>116</ns:byteData><ns:byteData>49</ns:byteData><ns:byteData>123</ns:byteData><ns:byteData>13</ns:byteData><ns:byteData>10</ns:byteData><ns:byteData>9</ns:byteData><ns:byteData>109</ns:byteData><ns:byteData>97</ns:byteData><ns:byteData>114</ns:byteData><ns:byteData>103</ns:byteData><ns:byteData>105</ns:byteData><ns :byteData>110</ns:byteData><ns:byteData>58</ns:byteData> is not encoded in base64 !? Best Regards George -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]