Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-2741

Attachment using org.apache.axis2.rpc.receivers.RPCMessageReceiver is broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.2
    • None
    • transports
    • None
    • Axis2-1.2 release/ Windows&Linux /Jboss 4.05GA

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              deepal Deepal Jayasinghe
              alihoaliho Aliho
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: