HTTP GET REST requests fail for valid ADB generated data bindings.
------------------------------------------------------------------

                 Key: AXIS2-1644
                 URL: http://issues.apache.org/jira/browse/AXIS2-1644
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.0
         Environment: GNU/Linux  2.6.18-1.2200.fc5smp, SUN Java 1.5.0_09, 
Apache Tomcat 5.5.20, Axis2 1.0
            Reporter: Damon Lanphear



I've been working on getting REST support working using HTTP GET for a service 
specified using the contract-first idiom, and code generated using WSDL2Java. 
The data binding is Axis Data Binding (adb).

 It appears that there are mismatches between the expectations of the  
generated adb code and the output of the URL to SOAPEnvelope transcoder: 
SchemaUtil.handleMediaTypeURLEncoded()

 1) SchemaUtil.handleMediaTypeURLEncoded() appears to strip off the
 namespace information when constructing an OMElement for the SOAP
 message body.  The ADB data binding assumes that the namespace
 information is present when unmarshalling SOAP message input.

 2) SchemaUtil.handleMediaTypeURLEncoded() assumes that complex XML data
 types are specified as <sequence> as opposed to <all>.  Attempts to use
 complex types specified with <all> will silently fail. 

Replacing the call to createOMElement in SchemaUtil.handleMediaTypeURLEncoded() 
 to:

soapFactory.createOMElement(name, 
                                                            
soapFactory.createOMNamespace(targetNamespace,
                                                                                
          xmlSchemaElement.getQName().getPrefix()),
                                                            
bodyFirstChild).setText(parameterValuesArray[0]);

Fixes this problem for me.

The WSDL in case is provided here:

<?xml version="1.0"?>

<definitions name="exampleCatalogSearch"
             targetNamespace="http://catalog.ws.example.com/exampleCatalog";
                         
xmlns:tns="http://catalog.ws.example.com/exampleCatalog";
             xmlns:xsd="http://www.w3.org/2001/XMLSchema";
                 xmlns:xsd1="http://catalog.ws.example.com/xsd";
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
             xmlns="http://schemas.xmlsoap.org/wsdl/";
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

  <!-- API Data Types -->

  <types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema";
                        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
                targetNamespace="http://catalog.ws.example.com/xsd";
                        elementFormDefault="qualified">
      <complexType name="ResultElement">
        <all>
          <element name="requestId"            type="xsd:string"/>
          <element name="keyword"              type="xsd:string"/>
          <element name="artist"               type="xsd:string"/>
          <element name="title"                type="xsd:string"/>
          <element name="contentType"          type="xsd:string"/>
        </all>
      </complexType>

      <complexType name="SOAPStruct">
                  <sequence>
            <element name="requestId"              type="xsd:string"/>
            <element name="requestLimit"           type="xsd:int"/>
            <element name="artist"                 type="xsd:string"/>
            <element name="title"                  type="xsd:string"/>
            <element name="keyword"               type="xsd:string"/>
                 </sequence>
      </complexType>
                
          <complexType name="ArrayOfResultElement_literal">
       <sequence>
         <element maxOccurs="unbounded" minOccurs="1" name="ResultElement"
                         type="xsd1:ResultElement"/>
       </sequence>
      </complexType>
                
          <element name="resultReturn" 
type="xsd1:ArrayOfResultElement_literal"/>
                
          <element name="requestParam" type="xsd1:SOAPStruct"/>
                
    </schema>
  </types> 

  <!-- Messages for the example Catalog Search API -->

  <message name="exampleCatalogSearch">
    <part name="a" element="xsd1:requestParam"/>
  </message>

  <message name="exampleCatalogSearchResponse">
    <part name="result" element="xsd1:resultReturn"/>           
  </message>

  <!-- Port for API, "exampleCatalogSearch" -->

  <portType name="exampleCatalogSearchPortType">

    <operation name="exampleCatalogSearch">
      <input message="tns:exampleCatalogSearch" name="exampleCatalogSearch"/>
      <output message="tns:exampleCatalogSearchResponse"
                  name="exampleCatalogSearchResponse"/>
    </operation>

  </portType>


  <!-- Binding for Catalog Search APIs - RPC, SOAP over HTTP -->

  <binding name="exampleCatalogSearchBinding" 
type="tns:exampleCatalogSearchPortType">
     <soap:binding style="document"
                 transport="http://schemas.xmlsoap.org/soap/http"/>

     <operation name="exampleCatalogSearch">
            <soap:operation soapAction="tns:exampleCatalogSearch" style="rpc"/>
            <input name="exampleCatalogSearch">
                <soap:body use="literal"/>
            </input>
            <output name="exampleCatalogSearchResponse">
                          <soap:body use="literal"/>
            </output>
        </operation>
  </binding>

  <!-- Endpoint for example Catalog Search APIs -->
  <service name="exampleCatalogSearchService">
    <port binding="tns:exampleCatalogSearchBinding" 
name="exampleCatalogSearchPort">
      <soap:address
                  location="http://catalog.ws.example.com/"/>
    </port>
  </service>

</definitions>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to