none
SOAP Response from SVCUTIL generated class does not match Expected Response - WCF RRS feed

  • Question

  • Hello, this is my first time working with WCF and using a WSDL.  I generated a WCF proxy class using SVCUTIL from the WSDL:

    http://dealer.aermanufacturing.com/getInventoryStatus.asmx?wsdl

    When I test the service my response is:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">   <soap:Body>      <getInventoryStatusResponse xmlns="http://dealer.aermanufacturing.com/getInventoryStatus.asmx">         <getInventoryStatusResult>            <Result>               <InStock></InStock>               <EstDeliveryDate></EstDeliveryDate>               <EstDeliveryTime></EstDeliveryTime>               <DeliveryLocation></DeliveryLocation>            </Result>         </getInventoryStatusResult>      </getInventoryStatusResponse>   </soap:Body></soap:Envelope>

    However the expected response is:

    soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <getInventoryStatusResponse xmlns="http://www.aermanufacturing.com/AERInventoryCheck/">
             <getInventoryStatusResult>
                <xs:schema id="AER_x0020_Inventory" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
                   <xs:element name="AER_x0020_Inventory" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
                      <xs:complexType>
                         <xs:choice minOccurs="0" maxOccurs="unbounded">
                            <xs:element name="Inventory">
                               <xs:complexType>
                                  <xs:sequence>
                                     <xs:element name="InStock" type="xs:string" minOccurs="0"/>
                                     <xs:element name="EstDeliveryDate" type="xs:string" minOccurs="0"/>
                                     <xs:element name="EstDeliveryTime" type="xs:string" minOccurs="0"/>
                                     <xs:element name="DeliveryLocation" type="xs:string" minOccurs="0"/>
                                  </xs:sequence>
                               </xs:complexType>
                            </xs:element>
                         </xs:choice>
                      </xs:complexType>
                   </xs:element>
                </xs:schema>
                <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
                   <AER_x0020_Inventory xmlns="">
                      <Inventory diffgr:id="Inventory1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
                         <InStock/>
                         <EstDeliveryDate/>
                         <EstDeliveryTime/>
                         <DeliveryLocation/>
                      </Inventory>
                   </AER_x0020_Inventory>
                </diffgr:diffgram>
             </getInventoryStatusResult>
          </getInventoryStatusResponse>
       </soap:Body>
    </soap:Envelope>
     

    Why the discrepancy and how do I fix it?  Am I generating the proxy class incorrectly when using SVCUTIL?  I am try to avoid hard-coding the response.  

    Thanks

    Friday, April 14, 2017 11:32 AM

All replies

  • How did you get expected response? Could you share us the reason you need “xs:schema” in response? In my option, it should be defined in wsdl, and there is no need to define in response.

    Checking the demo of request and response for your service by “http://dealer.aermanufacturing.com/getInventoryStatus.asmx?op=getInventoryStatus”, there are no these parts either.

    The expected results are below and which is similar to the response from SVCUTIL client.

    HTTP/1.1 200 OK
    Content-Type: text/xml; charset=utf-8
    Content-Length: length
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <getInventoryStatusResponse xmlns="http://dealer.aermanufacturing.com/getInventoryStatus.asmx">
          <getInventoryStatusResult>
            <anyType>
              <InStock>string</InStock>
              <EstDeliveryDate>string</EstDeliveryDate>
              <EstDeliveryTime>string</EstDeliveryTime>
              <DeliveryLocation>string</DeliveryLocation>
            </anyType>
            <DealerCode>string</DealerCode>
            <SupplierCode>string</SupplierCode>
            <PartNumber>string</PartNumber>
            <Quantity>string</Quantity>
            <WarehouseLocation>string</WarehouseLocation>
          </getInventoryStatusResult>
        </getInventoryStatusResponse>
      </soap:Body>
    </soap:Envelope>
    HTTP/1.1 200 OK
    Content-Type: application/soap+xml; charset=utf-8
    Content-Length: length
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
      <soap12:Body>
        <getInventoryStatusResponse xmlns="http://dealer.aermanufacturing.com/getInventoryStatus.asmx">
          <getInventoryStatusResult>
            <anyType>
              <InStock>string</InStock>
              <EstDeliveryDate>string</EstDeliveryDate>
              <EstDeliveryTime>string</EstDeliveryTime>
              <DeliveryLocation>string</DeliveryLocation>
            </anyType>
            <DealerCode>string</DealerCode>
            <SupplierCode>string</SupplierCode>
            <PartNumber>string</PartNumber>
            <Quantity>string</Quantity>
            <WarehouseLocation>string</WarehouseLocation>
          </getInventoryStatusResult>
        </getInventoryStatusResponse>
      </soap12:Body>
    </soap12:Envelope>



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 17, 2017 3:01 AM