Question

I have to create a .NET web service client which interface a Java AXIS web service. My problem is related to the fact that when invoking the WS this return an array of 256 elements (which is right) but every element has null value in its properties.

The wsdl is as follow:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://service.sms.mycompany.eu" 
                  xmlns:apachesoap="http://xml.apache.org/xml-soap" 
          xmlns:impl="http://service.sms.mycompany.eu" 
          xmlns:intf="http://service.sms.mycompany.eu" 
          **xmlns:tns1="http://model.sms.mycompany.eu"** 
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
          xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" 
          targetNamespace="http://service.sms.mycompany.eu" 
          xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://model.sms.mycompany.eu"/>
   <element name="getCountries">
    <complexType/>
   </element>
   <element name="getCountriesResponse">
    <complexType>
     <sequence>
      <element maxOccurs="unbounded" name="getCountriesReturn" type="**tns1:Country**"/>
     </sequence>
    </complexType>
   </element>
  </schema>
  <schema elementFormDefault="qualified" 
          targetNamespace="http://model.sms.mycompany.eu" 
          xmlns="http://www.w3.org/2001/XMLSchema">
   <complexType name="Country">
    <sequence>
     <element name="description" nillable="true" type="xsd:string"/>
     <element name="id" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
  </schema>
 </wsdl:types>
   <wsdl:message name="getCountriesRequest">
      <wsdl:part element="impl:getCountries" name="parameters"></wsdl:part>
   </wsdl:message>
   <wsdl:message name="getCountriesResponse">
      <wsdl:part element="impl:getCountriesResponse" name="parameters"></wsdl:part>
   </wsdl:message>
   <wsdl:operation name="getCountries">
      <wsdl:input message="impl:getCountriesRequest" name="getCountriesRequest"></wsdl:input>
      <wsdl:output message="impl:getCountriesResponse" name="getCountriesResponse"></wsdl:output>
   </wsdl:operation>
   <wsdl:portType name="SapServiceOut">
      <wsdl:operation name="getCountries">
         <wsdl:input message="impl:getCountriesRequest" name="getCountriesRequest">
       </wsdl:input>
       <wsdl:output message="impl:getCountriesResponse" name="getCountriesResponse"></wsdl:output>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name="SapServiceOutSoapBinding" type="impl:SapServiceOut">
      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getCountries">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getCountriesRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="getCountriesResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="SapServiceOutService">
      <wsdl:port binding="impl:SapServiceOutSoapBinding" name="SapServiceOut">
         <wsdlsoap:address location="http://localhost:8080/XBP/services/SapServiceOut"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

I have tested the service with SoapUI and this is the result

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      **<getCountriesResponse xmlns="http://service.sms.mycompany.eu">**
         <getCountriesReturn>
            <description>Afghanistan</description>
            <id>AF</id>
         </getCountriesReturn>
         <getCountriesReturn>
            <description>Antigua/Barbuda</description>
            <id>AG</id>
         </getCountriesReturn>
         ...
      </getCountriesResponse>
   </soapenv:Body>
</soapenv:Envelope>

I have seen that there is a difference between the two namespaces (enclosed between **) but still I dont understand how to correct the WSDL to make it work.

Can somebody address me on right way? Thanks a lot

Was it helpful?

Solution

In the response all the objects are on the same schema but in your wsdl you define getCountriesReturn with a type of another namespace. You can fix it changing your wsdl to include Country type in the http://service.sms.mycompany.eu schema:

<wsdl:definitions targetNamespace="http://service.sms.mycompany.eu" 
              xmlns:apachesoap="http://xml.apache.org/xml-soap" 
      xmlns:impl="http://service.sms.mycompany.eu" 
      xmlns:intf="http://service.sms.mycompany.eu" 
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
      xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
    <schema elementFormDefault="qualified" 
      targetNamespace="http://service.sms.mycompany.eu" 
      xmlns="http://www.w3.org/2001/XMLSchema">
        <element name="getCountries">
            <complexType/>
        </element>
        <element name="getCountriesResponse">
            <complexType>
                <sequence>
                    <element maxOccurs="unbounded" name="getCountriesReturn" type="Country"/>
                </sequence>
            </complexType>
        </element>
        <complexType name="Country">
            <sequence>
                <element name="description" nillable="true" type="xsd:string"/>
                <element name="id" nillable="true" type="xsd:string"/>
            </sequence>
        </complexType>
    </schema>
</wsdl:types>
<wsdl:message name="getCountriesRequest">
    <wsdl:part element="impl:getCountries" name="parameters"/>
</wsdl:message>
<wsdl:message name="getCountriesResponse">
    <wsdl:part element="impl:getCountriesResponse" name="parameters"/>
</wsdl:message>
<wsdl:operation name="getCountries">
    <wsdl:input message="impl:getCountriesRequest" name="getCountriesRequest"/>
    <wsdl:output message="impl:getCountriesResponse" name="getCountriesResponse"/>
</wsdl:operation>
<wsdl:portType name="SapServiceOut">
    <wsdl:operation name="getCountries">
        <wsdl:input message="impl:getCountriesRequest" name="getCountriesRequest">
        </wsdl:input>
        <wsdl:output message="impl:getCountriesResponse" name="getCountriesResponse"/>
    </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="SapServiceOutSoapBinding" type="impl:SapServiceOut">
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getCountries">
        <wsdlsoap:operation soapAction=""/>
        <wsdl:input name="getCountriesRequest">
            <wsdlsoap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="getCountriesResponse">
            <wsdlsoap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="SapServiceOutService">
    <wsdl:port binding="impl:SapServiceOutSoapBinding" name="SapServiceOut">
        <wsdlsoap:address location="http://localhost:8080/XBP/services/SapServiceOut"/>
    </wsdl:port>
</wsdl:service>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top