[
https://issues.apache.org/jira/browse/AXIS2-2741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aliho reopened AXIS2-2741:
--------------------------
hmmm... it looks like it's a problem with sub elements. try the following POJO
service:
======================================================================================
package test;
import java.io.Serializable;
public class AttachmentType implements Serializable{
private static final long serialVersionUID = 20070521L;
private String _contentType;
private String _fileName;
private byte[] _content;
public AttachmentType() {}
public AttachmentType(String contentType, String fileName, byte[] content) {
super();
_contentType = contentType;
_fileName = fileName;
_content = content;
}
public byte[] getContent() {
return _content;
}
public void setContent(byte[] content) {
_content = content;
}
public String getContentType() {
return _contentType;
}
public void setContentType(String contentType) {
_contentType = contentType;
}
public String getFileName() {
return _fileName;
}
public void setFileName(String fileName) {
_fileName = fileName;
}
}
======================================================================================
package test;
public class TestService{
public String Test(AttachmentType attachment){
return "boom!";
}
}
=============================Generated wsdl
File===========================================
<wsdl:definitions xmlns:axis2="http://test"
xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ns0="http://test/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://test">
<wsdl:documentation>TestService</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ns="http://test/xsd"
attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://test/xsd">
<xs:element name="Test">
<xs:complexType>
<xs:sequence>
<xs:element name="attachment"
nillable="true"
type="ns0:AttachmentType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AttachmentType"
type="ns0:AttachmentType" />
<xs:complexType name="AttachmentType">
<xs:sequence>
<xs:element name="content"
nillable="true"
type="xs:base64Binary" />
<xs:element name="contentType"
nillable="true"
type="xs:string" />
<xs:element name="fileName"
nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="TestResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return"
nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="TestMessage">
<wsdl:part name="part1" element="ns0:Test" />
</wsdl:message>
<wsdl:message name="TestResponse">
<wsdl:part name="part1" element="ns0:TestResponse" />
</wsdl:message>
<wsdl:portType name="TestServicePortType">
<wsdl:operation name="Test">
<wsdl:input
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
message="axis2:TestMessage"
wsaw:Action="urn:Test" />
<wsdl:output message="axis2:TestResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestServiceSOAP11Binding"
type="axis2:TestServicePortType">
<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:binding>
<wsdl:binding name="TestServiceSOAP12Binding"
type="axis2:TestServicePortType">
<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:binding>
<wsdl:binding name="TestServiceHttpBinding"
type="axis2:TestServicePortType">
<http:binding verb="POST" />
<wsdl:operation name="Test">
<http:operation location="Test" />
<wsdl:input>
<mime:content type="text/xml" />
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestService">
<wsdl:port name="TestServiceSOAP11port_http"
binding="axis2:TestServiceSOAP11Binding">
<soap:address
location="http://10.67.90.102:8888/cms-war/services/TestService" />
</wsdl:port>
<wsdl:port name="TestServiceSOAP11port_tcp1"
binding="axis2:TestServiceSOAP11Binding">
<soap:address
location="tcp://10.67.90.102:6061/axis2/services/TestService" />
</wsdl:port>
<wsdl:port name="TestServiceSOAP12port_http"
binding="axis2:TestServiceSOAP12Binding">
<soap12:address
location="http://10.67.90.102:8888/cms-war/services/TestService" />
</wsdl:port>
<wsdl:port name="TestServiceSOAP12port_tcp1"
binding="axis2:TestServiceSOAP12Binding">
<soap12:address
location="tcp://10.67.90.102:6061/axis2/services/TestService" />
</wsdl:port>
<wsdl:port name="TestServiceHttpport"
binding="axis2:TestServiceHttpBinding">
<http:address
location="http://10.67.90.102:8888/cms-war/services/TestService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
==================================The exceptions================================
18:01:28,550 ERROR sys : [RPCMessageReceiver] Exception occurred while trying
to invoke service method Test
java.lang.NumberFormatException: For input string:
"PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxwcm9qZWN0PgoJPHBhcmVudD4KCQk8YXJ0aWZhY3RJZD5jbXM8L2FydGlmYWN0SWQ+CgkJPGdyb3VwSWQ+ZWR1LmRyZXhlbDwvZ3JvdXBJZD4KCQk8dmVyc2lvbj4wLjAuMTwvdmVyc2lvbj4KCTwvcGFyZW50PgoJPG1vZGVsVmVyc2lvbj40LjAuMDwvbW9kZWxWZXJzaW9uPgoJPGFydGlmYWN0SWQ+Y21zLXdzLWNsaWVudDwvYXJ0aWZhY3RJZD4KCTxuYW1lPkNNUyBXZWJzZXJ2aWNlIENsaWVudCBBUEk8L25hbWU+CiAgICA8ZGVzY3JpcHRpb24+Q2xpZW50IEFQSSBmb3IgQ01TIHdlYiBzZXJ2aWNlPC9kZXNjcmlwdGlvbj4JCgk8dmVyc2lvbj4wLjAuMTwvdmVyc2lvbj4KCTxidWlsZD4KCQk8ZGVmYXVsdEdvYWw+cGFja2FnZTwvZGVmYXVsdEdvYWw+CgkJPHBsdWdpbnM+CgkJ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D5heGlzMjwvYXJ0aWZhY3RJZD4KICAgIAk8dmVyc2lvbj4xLjI8L3ZlcnNpb24+CiAgICAJPHNjb3BlPnByb3ZpZGVkPC9zY29wZT4KICAgIDwvZGVwZW5kZW5jeT4KICAgICAgICAJCQoJPC9kZXBlbmRlbmNpZXM+CjwvcHJvamVjdD4K"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Byte.parseByte(Byte.java:151)
at java.lang.Byte.<init>(Byte.java:325)
at
org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject(SimpleTypeMapper.java:85)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:361)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:349)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:403)
at
org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:676)
at
org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:624)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:560)
at
org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:118)
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:113)
at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:619)
> Attachment using org.apache.axis2.rpc.receivers.RPCMessageReceiver is broken
> ----------------------------------------------------------------------------
>
> Key: AXIS2-2741
> URL: https://issues.apache.org/jira/browse/AXIS2-2741
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: transports
> Affects Versions: 1.2
> Environment: Axis2-1.2 release/ Windows&Linux /Jboss 4.05GA
> Reporter: Aliho
> Assignee: Deepal Jayasinghe
> Priority: Blocker
>
> org.apache.axis2.rpc.receivers.RPCMessageReceiver will throw a
> NumberFormatException from trying to create a Byte object from a long binary
> string.
> ==========TestService.java=========
> package test;
> public class TestService{
>
> public String Test(String fileName, String contentType, byte[] binary){
> return "boom!";
> }
> }
> =========service.xml=============
> <service name="TestService"
> scope="application">
> <description>This is used for testing</description>
> <messageReceivers>
> <messageReceiver
> mep="http://www.w3.org/2004/08/wsdl/in-only"
>
> class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
> <messageReceiver
> mep="http://www.w3.org/2004/08/wsdl/in-out"
>
> class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
> </messageReceivers>
> <parameter
> name="useOriginalwsdl">false</parameter>
> <parameter name="ServiceClass">test.TestService</parameter>
> </service>
> The above pojo will generate the following WSDL file.
> ========Generated wsdl===========
> <wsdl:definitions xmlns:axis2="http://test"
> xmlns:ns1="http://org.apache.axis2/xsd"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> xmlns:ns0="http://test/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> targetNamespace="http://test"><wsdl:documentation>TestService</wsdl:documentation><wsdl:types><xs:schema
> xmlns:ns="http://test/xsd" attributeFormDefault="qualified"
> elementFormDefault="qualified" targetNamespace="http://test/xsd">
> <xs:element name="Test">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="fileName" nillable="true" type="xs:string" />
> <xs:element name="contentType" nillable="true" type="xs:string" />
> <xs:element name="binary" nillable="true" type="xs:base64Binary" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="TestResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="return" nillable="true" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema></wsdl:types><wsdl:message name="TestMessage"><wsdl:part
> name="part1" element="ns0:Test" /></wsdl:message><wsdl:message
> name="TestResponse"><wsdl:part name="part1" element="ns0:TestResponse"
> /></wsdl:message><wsdl:portType name="TestServicePortType"><wsdl:operation
> name="Test"><wsdl:input
> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
> message="axis2:TestMessage" wsaw:Action="urn:Test" /><wsdl:output
> message="axis2:TestResponse" /></wsdl:operation></wsdl:portType><wsdl:binding
> name="TestServiceSOAP11Binding"
> type="axis2:TestServicePortType"><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:binding><wsdl:binding
> name="TestServiceSOAP12Binding"
> type="axis2:TestServicePortType"><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:binding><wsdl:binding
> name="TestServiceHttpBinding" type="axis2:TestServicePortType"><http:binding
> verb="POST" /><wsdl:operation name="Test"><http:operation location="Test"
> /><wsdl:input><mime:content type="text/xml"
> /></wsdl:input><wsdl:output><mime:content type="text/xml"
> /></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service
> name="TestService"><wsdl:port name="TestServiceSOAP11port_http"
> binding="axis2:TestServiceSOAP11Binding"><soap:address
> location="http://10.67.90.102:8888/cms-war-0.0.1/services/TestService"
> /></wsdl:port><wsdl:port name="TestServiceSOAP11port_tcp1"
> binding="axis2:TestServiceSOAP11Binding"><soap:address
> location="tcp://10.67.90.102:6061/axis2/services/TestService"
> /></wsdl:port><wsdl:port name="TestServiceSOAP12port_http"
> binding="axis2:TestServiceSOAP12Binding"><soap12:address
> location="http://10.67.90.102:8888/cms-war-0.0.1/services/TestService"
> /></wsdl:port><wsdl:port name="TestServiceSOAP12port_tcp1"
> binding="axis2:TestServiceSOAP12Binding"><soap12:address
> location="tcp://10.67.90.102:6061/axis2/services/TestService"
> /></wsdl:port><wsdl:port name="TestServiceHttpport"
> binding="axis2:TestServiceHttpBinding"><http:address
> location="http://10.67.90.102:8888/cms-war-0.0.1/services/TestService"
> /></wsdl:port></wsdl:service></wsdl:definitions>
> ********************************************************************************************
> Use the above generated wsdl to create a client jar using wsdl2java, and try
> to send a message to TestService. The service will throw a
> NumberFormatException if the content element is anything other than a small
> number (a number that is less than a byte).
> This is obviously wrong because content should be a long binary string.
--
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]