Empty Response from web service (WSDL SOAP)

12,933

Thanks for posting the response as collected by Fiddler. I am actually seeing more than one problem in the WSDL and in the response conformance to the WSDL datatypes.

First issue: WSDL consistency/completeness

Note that the input and output messages refer to tns:DownloadShipmentDataV001 and tns:DownloadShipmentDataV001Response, respectively. xmlns:tns="http://schemas.ccc.com/AROPInventory/bpm/external" is the relevant prefix:namespace binding in the context of the message definitions, thus the fully-qualified names of the request and response message elements are {http://schemas.ccc.com/AROPInventory/bpm/external}DownloadShipmentDataV001 and {http://schemas.ccc.com/AROPInventory/bpm/external}DownloadShipmentDataV001Response, respectively.

By virtue of the targetNamespace="http://schemas.argility.com/AROPInventory/bpm/external" declaration, the fully-qualified name of the elements defined in the types section of the WSDL document are {http://schemas.argility.com/AROPInventory/bpm/external}DownloadShipmentDataV001 and {http://schemas.argility.com/AROPInventory/bpm/external}DownloadShipmentDataV001Response. This is a problem because the actual types referred to in the message definitions are missing from the WSDL and any imported/included documents.

A stub generator should complain about this when trying to consume the WSDL.

The external company should really correct this issue, but you could copy the WSDL and make a tweak by declaring the namespace of the actual element from the types section and binding to a prefix, then using that prefix in the message definition (weakness being you have an extra step in keeping up with any changes in their service definition):

xmlns:fromtype="http://schemas.argility.com/AROPInventory/bpm/external"
 ...
  <wsdl:message name="DownloadShipmentDataV001Input">
    <wsdl:part name="body" element="fromtype:DownloadShipmentDataV001" />
  </wsdl:message>
  <wsdl:message name="DownloadShipmentDataV001Output">
    <wsdl:part name="body" element="fromtype:DownloadShipmentDataV001Response" />
  </wsdl:message>

Second issue: Response Message Does Not Match Schema

Assume that the WSDL was consistent and called out the fully-qualified datatype from the types section. The response message's fully-qualified element structure would then be expected to be something like:

{http://schemas.argility.com/AROPInventory/bpm/external}DownloadShipmentDataV001Response
  {http://schemas.argility.com/AROPInventory/bpm/external}Shipments
    {http://schemas.argility.com/AROPInventory/bpm/external}Shipment
      {http://schemas.argility.com/AROPInventory/bpm/external}ShipmentNumber
      {http://schemas.argility.com/AROPInventory/bpm/external}Cartons
        {http://schemas.argility.com/AROPInventory/bpm/external}Carton
 ...

However, the actual structure in the response message is:

{http://schemas.argility.com/AROPInventory/bpm/external}DownloadShipmentDataV001Response
  {http://schemas.argility.com/AROPInventory/bpm/external}Shipments
    {http://schemas.argility.com/AROPInventory/bpm/external}ShipmentHeader
      {http://schemas.argility.com/AROPInventory/bpm/external}ShipmentNumber
 ...

Note that ShipmentHeader is never declared as an element in the WSDL types section and is not imported from another document. If the unmarshaller is using the datatype definition provided in the WSDL, it does not understand the ShipmentHeader or its subelements so probably would leave those out (as you are seeing).

The correction for this issue is to match up the datatype schema definition with the actual response from the service. Again, the external organization hosting the service should correct this (their service is not in compliance with the given WSDL), but you could again tweak locally with the same caveat about extra steps keeping 'your' wsdl in lock-step with their service.

I hope this helps and respond back with further questions.

Share:
12,933

Related videos on Youtube

Liz Engelke
Author by

Liz Engelke

Updated on September 15, 2022

Comments

  • Liz Engelke
    Liz Engelke over 1 year

    I am using Visual studio 2008 C# Windows application to connect to a webservice created by an external company. The service is a WSDL url, which is a basic soap request and response. I have inported the service as a service reference. I can call the service, and receive no errors, but the reponse is nothing. When monitoring the soap request and response in Fiddler, i see a response coming back, but it's as if VS cannot interpret the response. I have looked at creating xsd's, but get an error stating that there's already a schema. So I am at a total loss. I hope someone can help. I apologise if this exact issue has been solved before, but i cannot find anything that resolves my problem.

    Thanks in advance!

    The code I am using to connect to the service is as follows:

     ServiceReference1.bpm bbb = new TestingWSDL.ServiceReference1.bpm();
    
            ServiceReference1.BPMExternalAppServicesV001Client soapClient = new TestingWSDL.ServiceReference1.BPMExternalAppServicesV001Client();
    
            ServiceReference1.DownloadShipmentDataV001 req = new TestingWSDL.ServiceReference1.DownloadShipmentDataV001();
            ServiceReference1.DownloadShipmentDataV001Response resp = new TestingWSDL.ServiceReference1.DownloadShipmentDataV001Response();
    
            try
            {
    
                soapClient.DownloadShipmentDataV001(req,out resp);
    
            }
            catch(Exception err)
            {
                MessageBox.Show(err.Message);
            }
    

    the response object does not have any data in. I cannot post an image, as i am not allowed.

    The WSDL is quite long and is as follows:

        <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:tns="http://schemas.ccc.com/AROPInventory/bpm/external" xmlns:inst="http://schemas.aaa.com/bpm/instance/1.0" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="BPMExternalAppServicesV001" targetNamespace="http://schemas.ccc.com/AROPInventory/bpm/external" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
        <xsd:schema xmlns:tns1="http://schemas.ccc.com/AROPInventory/bpm/external" xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.argility.com/AROPInventory/bpm/external" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <xsd:import namespace="http://schemas.aaa.com/bpm/instance/1.0" />
          <xsd:element name="UploadShipmentDataV001">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element ref="tns1:Shipments" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
          <xsd:element xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" name="Shipments">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element minOccurs="0" maxOccurs="unbounded" name="Shipment">
                  <xsd:complexType>
                    <xsd:sequence>
                      <xs:element name="ShipmentNumber" type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" />
                      <xsd:element name="Cartons">
                        <xsd:complexType>
                          <xsd:sequence>
                            <xsd:element minOccurs="0" maxOccurs="unbounded" name="Carton">
                              <xsd:annotation>
                                <xsd:documentation>0:not damaged 1:damaged 2: Rejected0:not damaged 1:damaged 2: Rejected0:not damaged 1:damaged 2: Rejected</xsd:documentation>
                              </xsd:annotation>
                              <xsd:complexType>
                                <xsd:sequence>
                                  <xs:element name="CartionID" type="xs:byte" xmlns:xs="http://www.w3.org/2001/XMLSchema" />
                                  <xs:element name="Status" type="xs:byte" xmlns:xs="http://www.w3.org/2001/XMLSchema" />
                                </xsd:sequence>
                              </xsd:complexType>
                            </xsd:element>
                          </xsd:sequence>
                        </xsd:complexType>
                      </xsd:element>
                    </xsd:sequence>
                  </xsd:complexType>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="TestUploadShipMentV001">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element ref="tns1:Shipments" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="TestUploadShipMentV001Response" />
          <xsd:element name="UploadShipmentDataV001Response" />
          <xsd:element name="DownloadShipmentDataV001">
            <xsd:complexType>
              <xsd:sequence />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="DownloadShipmentDataV001Response">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element ref="tns1:Shipments" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:schema>
        <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.aaa.com/bpm/instance/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <xsd:element name="bpm">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="instance_id" type="xsd:string" />
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:schema>
      </wsdl:types>
      <wsdl:message name="DownloadShipmentDataV001Input">
        <wsdl:part name="body" element="tns:DownloadShipmentDataV001" />
      </wsdl:message>
      <wsdl:message name="DownloadShipmentDataV001Output">
        <wsdl:part name="body" element="tns:DownloadShipmentDataV001Response" />
      </wsdl:message>
      <wsdl:message name="HeaderOutput">
        <wsdl:part name="BPMHeader" element="inst:bpm" />
      </wsdl:message>
      <wsdl:portType name="BPMExternalAppServicesV001">
        <wsdl:operation name="DownloadShipmentDataV001">
          <wsdl:input message="tns:DownloadShipmentDataV001Input" />
          <wsdl:output message="tns:DownloadShipmentDataV001Output" />
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="BPMExternalAppServicesV001" type="tns:BPMExternalAppServicesV001">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="DownloadShipmentDataV001">
          <soap:operation soapAction="" style="document" />
          <wsdl:input>
            <soap:body use="literal" />
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal" />
            <soap:header message="tns:HeaderOutput" part="BPMHeader" use="literal" />
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="BPMExternalAppServicesV001Service">
        <wsdl:port name="BPMExternalAppServicesV001Port" binding="tns:BPMExternalAppServicesV001">
          <soap:address location="http://aaa/aaa/com.eibus.web.soap.Gateway.wcp?organization=o=system,cn=aaa,cn=aaa,o=ho.bbb.co.za" />
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>
    

    The fiddler response is as follows:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" 
            xmlns="http://schemas.aaa.com/General/1.0/">
            <sender>
                <reply-to>
                    cn=Business Process Management,cn=Business Process Management,cn=soap nodes,o=system,cn=aaa,cn=aaa20,o=ho.bbb.co.za
                </reply-to>
                <organizationalContext>o=system,cn=aaa,cn=aaa20,o=ho.bbb.co.za</organizationalContext>
                <component>cn=Business Process Management,cn=soap nodes,o=system,cn=aaa,cn=aaa20,o=ho.bbb.co.za</component>
            </sender>
            <receiver>
                <component>cn=webgateway@poc-aaa,cn=aaa,cn=aaa20,o=ho.bbb.co.za</component>
                <sent-to xmlns="http://schemas.aaa.com/General/1.0/">socket://poc-aaa:20379/</sent-to>
            </receiver>
            <msg-id>00505680-004E-11E1-FBF1-7CB604BB1FC0</msg-id>
        </header>
        <bpm xmlns="http://schemas.aaa.com/bpm/instance/1.0">
            <instance_id>26c34038-bea4-459c-a0ad-86b462ae90cb</instance_id>
        </bpm>
    </s:Header>
    <s:Body>
        <DownloadShipmentDataV001Response xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.argility.com/AROPInventory/bpm/external">
            <Shipments xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.argility.com/AROPInventory/bpm/external">
                <ShipmentHeader>
                    <ShipmentNumber>S001</ShipmentNumber>
                    <ReceivingBranch>B000028</ReceivingBranch>
                    <SendingBranch>B000001</SendingBranch>
                    <ExpectedDate>2012/07/30</ExpectedDate>
                    <TotalNrOfCartons>2</TotalNrOfCartons>
                    <ShipmentStatus>E</ShipmentStatus>
                    <Cartons>
                        <Carton>
                            <CartonHeader>
                                <NrOfItems>2</NrOfItems>
                                <CartionID>99</CartionID>
                            </CartonHeader>
                            <CartonDetail>
                                <SKU>12345</SKU>
                                <Description>abc</Description>
                                <SerialNumber>6789</SerialNumber>
                                <QtySent>20</QtySent>
                                <QtyReceived/>
                            </CartonDetail>
                            <CartonDetail>
                                <SKU>12390</SKU>
                                <Description>abc</Description>
                                <SerialNumber>67232</SerialNumber>
                                <QtySent>2</QtySent>
                                <QtyReceived/>
                            </CartonDetail>
                        </Carton>
                        <Carton>
                            <CartonHeader>
                                <NrOfItems>2</NrOfItems>
                                <CartionID>100</CartionID>
                            </CartonHeader>
                            <CartonDetail>
                                <SKU>12345</SKU>
                                <Description>abc</Description>
                                <SerialNumber>6789</SerialNumber>
                                <QtySent>20</QtySent>
                                <QtyReceived/>
                            </CartonDetail>
                            <CartonDetail>
                                <SKU>12390</SKU>
                                <Description>abc</Description>
                                <SerialNumber>67232</SerialNumber>
                                <QtySent>2</QtySent>
                                <QtyReceived/>
                            </CartonDetail>
                        </Carton>
                    </Cartons>
                </ShipmentHeader>
                <ShipmentHeader>
                    <ShipmentNumber>S002</ShipmentNumber>
                    <ReceivingBranch>B000029</ReceivingBranch>
                    <SendingBranch>B000002</SendingBranch>
                    <ExpectedDate>2012/06/3</ExpectedDate>
                    <TotalNrOfCartons>21</TotalNrOfCartons>
                    <ShipmentStatus>E</ShipmentStatus>
                    <Cartons>
                        <Carton>
                            <CartonHeader>
                                <NrOfItems>3</NrOfItems>
                                <CartionID>91</CartionID>
                            </CartonHeader>
                            <CartonDetail>
                                <SKU>12345</SKU>
                                <Description>abc</Description>
                                <SerialNumber>6789</SerialNumber>
                                <QtySent>20</QtySent>
                                <QtyReceived/>
                            </CartonDetail>
                            <CartonDetail>
                                <SKU>12390</SKU>
                                <Description>abc</Description>
                                <SerialNumber>67232</SerialNumber>
                                <QtySent>2</QtySent>
                                <QtyReceived/>
                            </CartonDetail>
                        </Carton>
                        <Carton>
                            <CartonHeader>
                                <NrOfItems>1</NrOfItems>
                                <CartionID>97</CartionID>
                            </CartonHeader>
                            <CartonDetail>
                                <SKU>12390</SKU>
                                <Description>abc</Description>
                                <SerialNumber>67232</SerialNumber>
                                <QtySent>2</QtySent>
                                <QtyReceived/>
                            </CartonDetail>
                        </Carton>
                    </Cartons>
                </ShipmentHeader>
            </Shipments>
        </DownloadShipmentDataV001Response>
    </s:Body>
    </s:Envelope>
    
  • Liz Engelke
    Liz Engelke over 11 years
    Thank you so much. I have marked your answer, as I have spoken to some other more knowledgeable colleagues, and they agree. Have sent through the info to the company creating the service, and they will correct the service for me.