2012-07-31 2 views
3

Visual Studio 2008 C# Windows 응용 프로그램을 사용하여 외부 회사에서 만든 웹 서비스에 연결합니다. 이 서비스는 기본 SOAP 요청 및 응답 인 WSDL url입니다. 서비스 참조로 서비스를 비공개했습니다. 나는 서비스를 호출 할 수 있고 아무 오류도받지 못한다. 그러나 응답은 아무것도 아니다. Fiddler에서 비누 요청과 응답을 모니터링 할 때 응답이 되돌아 오는 것을 볼 수 있지만 VS가 응답을 해석 할 수없는 것처럼 보입니다. xsd를 만드는 방법을 살펴 보았지만 이미 스키마가 있음을 알리는 오류가 발생합니다. 그래서 저는 완전히 손해를보고 있습니다. 누군가가 도울 수 있기를 바랍니다. 이 정확한 문제가 전에 해결 된 경우 사과하지만 내 문제를 해결할 아무것도 찾을 수 없습니다.웹 서비스 (WSDL SOAP)에서 빈 응답

미리 감사드립니다. 다음과 같이

나는 서비스에 연결하기 위해 사용하고있는 코드는 다음과 같습니다.

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); 
     } 

응답 객체의 모든 데이터가없는 내가 할 수 없습니다 이대로는 이미지를 게시 할 수 없습니다.

은 WSDL은 아주 길고 다음과 같다 : 다음과 같이

<?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> 

피들러 응답은 다음과 같습니다 피들러에 의해 수집으로 응답을 게시

<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>[email protected],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> 
+0

피들러에서 본 응답을 게시하면 계속 진행할 수 있습니다. 하나의 가능성은 웹 서비스로부터의 응답이 wsdl에 명시된 것이 아닌 것입니다. 일반적인 문제는 일관성없는 네임 스페이스입니다. 언 마샬 러는 wsdl의 네임 스페이스를 사용하고 다른 네임 스페이스의 응답 요소를 무시하도록 구성 될 수 있습니다. – dcbyers

+0

@dcbyers에 감사드립니다. 원래 질문에 피들러 응답을 추가했습니다. –

답변

1

감사합니다. 실제로 WSDL 및 WSDL 데이터 유형에 대한 응답 적합성에서 하나 이상의 문제가 발생합니다.

창간호 : WSDL 일관성/완전성 입출력 메시지 각각 tns:DownloadShipmentDataV001tns:DownloadShipmentDataV001Response, 참조하는 것이

참고. xmlns:tns="http://schemas.ccc.com/AROPInventory/bpm/external"이라는 접두어이며 메시지 정의의 컨텍스트에서 네임 스페이스 바인딩이므로 요청 및 응답 메시지 요소의 정규화 된 이름은 각각 {http://schemas.ccc.com/AROPInventory/bpm/external}DownloadShipmentDataV001{http://schemas.ccc.com/AROPInventory/bpm/external}DownloadShipmentDataV001Response입니다. targetNamespace="http://schemas.argility.com/AROPInventory/bpm/external" 선언의 미덕으로

는 WSDL 문서의 종류 섹션에 정의 된 요소의 완전한 이름은 {http://schemas.argility.com/AROPInventory/bpm/external}DownloadShipmentDataV001{http://schemas.argility.com/AROPInventory/bpm/external}DownloadShipmentDataV001Response이다. 이것은 메시지 정의에 언급 된 실제 유형이 WSDL 및 임포트/포함 된 문서에 없기 때문에 문제가됩니다.

스텁 생성기는 WSDL을 사용하려고 할 때 이에 대해 불평해야합니다.

외부 회사에서이 문제를 실제로 해결해야하지만 유형 섹션에서 실제 요소의 네임 스페이스를 선언하고 접두사에 바인딩 한 다음 메시지 정의에서 해당 접두사를 사용하여 WSDL을 복사하고 조정할 수 있습니다 약점 당신이 그들의 서비스 정의의 변경)와 유지에 추가 단계가되는 :

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> 

두 번째 문제 : 응답 메시지

는 WSDL이 일치했다 밖으로라는 것을 가정 스키마 일치하지 않습니다 완전한 데이터 pe 유형 섹션에서.

{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 
... 

그러나, 응답 메시지의 실제 구조는 다음과 같습니다 :로 선언되지 않습니다

{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 
... 

ShipmentHeader 있다는 응답 메시지의 완전한 요소의 구조는 다음과 같이 될 것으로 예상된다 요소를 가져오고 다른 문서에서 가져올 수 없습니다. unmarshaller가 WSDL에 제공된 데이터 유형 정의를 사용하고 있다면, ShipmentHeader 또는 그 하위 요소를 이해할 수 없으므로 (사용자가보고있는 것처럼) unmarshaller가이를 남겨 둘 수 있습니다.

이 문제에 대한 수정은 데이터 유형 스키마 정의를 서비스의 실제 응답과 일치시키는 것입니다. 다시 말하지만, 서비스를 호스팅하는 외부 조직은이를 수정해야합니다 (해당 서비스가 주어진 WSDL을 준수하지 않음). 그러나 'wsdl을 유지하는 추가 단계에 대해 동일한주의 사항으로 로컬에서 다시 조정할 수 있습니다.

도움이 되시고 추가 질문으로 답변 해 주시기 바랍니다.

+0

정말 고마워요. 나는 다른 많은 지식있는 동료들과 이야기를 나눴 기 때문에 당신의 답을 표시했습니다, 그리고 그들은 동의합니다. 정보를 통해 회사를 만들었습니다. 그들은 나를 위해 서비스를 수정합니다. –

0

이 XML 파일을 직접 구문 분석해야합니다.

IBM의 Remedy 소프트웨어와 비슷한 문제가 있습니다. 기본적으로 이것은 끔찍한 소프트웨어이며이 동작은 예상됩니다. 일치하는 코드를 업데이트하더라도 생성중인 실제 XML 문서에서 WSDL을 생성하지는 않습니다 ...이 메서드는 메서드를 변경할 때까지 계속되며 사용자는이를 제어 할 수 없습니다.