views:

806

answers:

2

I am writing a web service starting with writing the WSDL. I have been generating server-side skeleton code using wsimport and then writing my own implementing class. I'm running the web service on an Axis2 server. When using soapUI, the SOAP messages coming to and from the service look fine, but when using a web service client, I'm getting null in the client-side stubs. I've heard that this could be a namespace issue, but I see anything wrong. Here is my copy of the WSDL. Any help would be appreciated.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://test.sa.lmco.com" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" 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://test.sa.lmco.com"&gt;


<!-- **************** -->
<!-- **   Types    ** -->
<!-- **************** -->
<wsdl:types>
    <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://test.sa.lmco.com"&gt;
        <xs:element name="sayHello">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="s" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="sayHelloResponse">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>

        <xs:element name="getTaxonomyNode">
            <xs:complexType>
             <xs:sequence>
              <xs:element name="taxonomyId" minOccurs="1" maxOccurs="1" type="xs:int" />
              <xs:element name="nodeId" type="xs:int" />
             </xs:sequence>
            </xs:complexType>
        </xs:element>

        <xs:element name="getTaxonomyNodeResponse">
            <xs:complexType>
             <xs:sequence>
              <xs:element name="resultNode" type="ns:TaxonomyNode" />
             </xs:sequence>
            </xs:complexType>
        </xs:element>

        <xs:element name="getChildren">
            <xs:complexType>
             <xs:sequence>
              <xs:element name="taxonomyId" minOccurs="1" maxOccurs="1" type="xs:int" />
              <xs:element name="parentNodeId" minOccurs="1" maxOccurs="1" type="xs:int" />
             </xs:sequence>
            </xs:complexType>
        </xs:element>

        <xs:element name="getChildrenResponse">
            <xs:complexType>
             <xs:sequence>
              <xs:element name="childNodes" minOccurs="0" maxOccurs="unbounded" type="ns:TaxonomyNode" />
             </xs:sequence>
            </xs:complexType>
        </xs:element>



        <xs:complexType name="TaxonomyNode">
         <xs:sequence>
          <xs:element name="taxonomyId" type="xs:int" />
          <xs:element name="nodeId"     type="xs:int" />
         </xs:sequence>
        </xs:complexType>


        <xs:complexType name="LCD">
         <xs:sequence>
          <xs:element name="language" type="xs:string" />
          <xs:element name="content" type="xs:string" />
          <xs:element name="description" type="xs:string" />
         </xs:sequence>
        </xs:complexType> 

    </xs:schema>
</wsdl:types>

<!-- ***************** -->
<!-- **  Messages   ** -->
<!-- ***************** -->
<wsdl:message name="sayHelloRequest">
    <wsdl:part name="parameters" element="ns:sayHello"/>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
    <wsdl:part name="parameters" element="ns:sayHelloResponse"/>
</wsdl:message>

<wsdl:message name="getTaxonomyNodeRequest">
    <wsdl:part name="parameters" element="ns:getTaxonomyNode" />
</wsdl:message>
<wsdl:message name="getTaxonomyNodeResponse">
    <wsdl:part name="parameters" element="ns:getTaxonomyNodeResponse" />
</wsdl:message>

<wsdl:message name="getChildrenRequest">
    <wsdl:part name="parameters" element="ns:getChildren" />
</wsdl:message>
<wsdl:message name="getChildrenResponse">
    <wsdl:part name="parameters" element="ns:getChildrenResponse" />
</wsdl:message>

<!-- ******************* -->
<!-- **   PortTypes   ** -->
<!-- ******************* -->
<wsdl:portType name="HelloWSPortType">
    <wsdl:operation name="sayHello">
        <wsdl:input message="ns:sayHelloRequest" wsaw:Action="urn:sayHello"/>
        <wsdl:output message="ns:sayHelloResponse" wsaw:Action="urn:sayHelloResponse"/>
    </wsdl:operation>

    <wsdl:operation name="getTaxonomyNode">
        <wsdl:input  message="ns:getTaxonomyNodeRequest"  wsaw:Action="urn:getTaxonomyNode" />
        <wsdl:output message="ns:getTaxonomyNodeResponse" wsaw:Action="urn:getTaxonomyNodeResponse" />
    </wsdl:operation>

    <wsdl:operation name="getChildren">
        <wsdl:input  message="ns:getChildrenRequest"  wsaw:Action="urn:getChildren" />
        <wsdl:output message="ns:getChildrenResponse" wsaw:Action="urn:getChildrenResponse" />
    </wsdl:operation>

</wsdl:portType>


<!-- ****************** -->
<!-- ** Bindings     ** -->
<!-- ****************** -->
<wsdl:binding name="HelloWSServiceSoap11Binding" type="ns:HelloWSPortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <wsdl:operation name="sayHello">
        <soap:operation soapAction="urn:sayHello" style="document"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>

    <wsdl:operation name="getTaxonomyNode">
        <soap:operation soapAction="urn:getTaxonomyNode" style="document" />
        <wsdl:input>
         <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output>
         <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>

    <wsdl:operation name="getChildren">
        <soap:operation soapAction="urn:getChildren" style="document" />
        <wsdl:input>
  <soap:body use="literal" />
 </wsdl:input>
 <wsdl:output>
  <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>


</wsdl:binding>


<!-- **************** -->
<!-- ** Service    ** -->
<!-- **************** -->
<wsdl:service name="HelloWS">
    <wsdl:port name="HelloWSServiceHttpSoap11Endpoint" binding="ns:HelloWSServiceSoap11Binding">
        <soap:address location="http://162.16.129.25:9090/axis2/services/HelloWS"/&gt;
    </wsdl:port>

</wsdl:service>

A: 

I'm having the same issue.

I'm using an iPhone app to send the soap requests, and I get null responses. If my formatting is wrong, however, I still get the error messages back.

Maybe that can clue you in on the cause, I'm not very experienced with SOAP.

Corey Floyd
A: 

This could be because of separate WSDL files. If you specify WSDL separately in META-INF then AXIS2 passes arguments of the webservice as an OMElement. I.e. if you have used other datatypes as arguments in service API and you have a WSDL in META-INF then while calling Service the parameters are OMElement not String / int or etc...

Piyush.

Piyush