I apologize for the formatting of my previous post. Repost in plain text below:


Hi,

I'm having trouble binding a typed array in a client of a web service.

Given the operation "getMyElems", the WSDL (pasted further down in
this message) specifies a return type of "ArrayOfMyElem". I am unable
to figure out how to bind this to an array of MyElem.

I am using Axis' WSDL2Java to generate a client from the WSDL and I
would like to be able to have something like:

  TestService svc = new TestServiceStub(...);
  MyElem[] myElems = svc.getMyElems();

However, when I try to generate a client using WSDL2Java, I get the
following exception:

Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException:
Cannot unwrap element {....service}getMyElemsResponse:
no abstract mapping definition found for type
{....service}ArrayOfMyElem (used by element
{....service}getMyElemsReturn)
 at 
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:256)

I have attached the relevant WSDL, sample SOAP message and binding below.

Any help would be greatly appreciated.

-thom



Binding:

<?xml version="1.0" encoding="UTF-8"?>
<binding force-classes="true" xmlns:tns="....service" value-style="element">
  <namespace uri="...service" default="elements"/>

  <mapping abstract="true" type-name="tns:MyElem"
class="...service.MyElem" ordered="false">
      <value name="id" field="id" usage="optional"/>
  </mapping>

</binding>


The SOAP message that is returned on invoking getMyELems is:

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
 <soapenv:Body>
    <ns:getMyElemsResponse xmlns:ns="http://....service";>
       <ns:getMyElemsReturn>
          <ns:myElem>
             <ns:id>1</ns:id>
          </ns:myElem>
          <ns:myElem>
             <ns:id>2</ns:id>
          </ns:myElem>
          <ns:myElem>
             <ns:id>3</ns:id>
          </ns:myElem>
       </ns:getMyElemsReturn>
    </ns:getMyElemsResponse>
 </soapenv:Body>
</soapenv:Envelope>


WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
  name="TestService"
  targetNamespace="http://com.servicetester.service";
  xmlns:impl="http://com.servicetester.service";
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

  <!-- WSDL Types -->
  <wsdl:types>
      <xsd:schema>
          <xsd:element name="getMyElems">
              <xsd:complexType/>
          </xsd:element>
          <xsd:element name="getMyElemsResponse">
              <xsd:complexType>
                  <xsd:sequence>
                      <xsd:element name="getMyElemsReturn"
type="impl:ArrayOfMyElem"/>
                  </xsd:sequence>
              </xsd:complexType>
          </xsd:element>
          <xsd:complexType name="MyElem">
              <xsd:all>
                  <xsd:element name="id" nillable="false" type="xsd:int">
                  </xsd:element>
              </xsd:all>
          </xsd:complexType>
          <xsd:complexType name="ArrayOfMyElem">
              <xsd:sequence>
                  <xsd:element name="myElem" minOccurs="0"
maxOccurs="unbounded" form="qualified" type="impl:MyElem" />
              </xsd:sequence>
          </xsd:complexType>
      </xsd:schema>
  </wsdl:types>

  <!-- Messages -->
  <wsdl:message name="getMyElems1Request">
      <wsdl:part element="impl:getMyElems" name="parameters"/>
  </wsdl:message>
  <wsdl:message name="getMyElems1Response">
      <wsdl:part element="impl:getMyElemsResponse" name="parameters"/>
  </wsdl:message>

  <!-- Port Type -->
  <wsdl:portType name="TestServicePortType">
      <wsdl:operation name="getMyElems">
          <wsdl:input message="impl:getMyElems1Request"
                      name="getMyElems1Request"/>
          <wsdl:output message="impl:getMyElems1Response"
                       name="getMyElems1Response"/>
      </wsdl:operation>
  </wsdl:portType>

  <!-- WSDL Binding -->
  <wsdl:binding name="TestServiceSoapBinding" type="impl:TestServicePortType">
      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getMyElems">
          <wsdlsoap:operation soapAction="getMyElems" style="document"/>
          <wsdl:input name="getMyElems1Request">
              <wsdlsoap:body use="literal"/>
          </wsdl:input>
          <wsdl:output name="getMyElems1Response">
              <wsdlsoap:body use="literal"/>
          </wsdl:output>
     </wsdl:operation>
  </wsdl:binding>

  <!-- Service Definition -->
  <wsdl:service name="TestService">
      <wsdl:port binding="impl:TestServiceSoapBinding" name="TestService">
          <wsdlsoap:address
location="http://localhost:8080/service-ws/services/TestService"/>
      </wsdl:port>
  </wsdl:service>

</wsdl:definitions>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to