4

非常に単純な SOAP Web サービス呼び出しであると考えていたものから応答を返すために、手巻きの HTTP 要求を作成しようとしています。しかし、リクエストを適切に作成するのに問題があり、期待する応答が得られません。


該当wsdlするステートメント:

wsdl ターゲット名前空間:

targetNamespace="http://tempuri.org/"

wsdl サービス

<wsdl:service name="TrackerService">
  <wsdl:port name="BasicHttpBinding_ITrackerService" binding="tns:BasicHttpBinding_ITrackerService">
    <soap:address location="http://mydomain.com/TrackerServiceSite/wctest2.TrackerService.svc"/>
  </wsdl:port>
</wsdl:service>

wsdl メッセージ

<wsdl:message name="ITrackerService_GetStub_InputMessage">
  <wsdl:part name="parameters" element="tns:GetStub" /> 
</wsdl:message>
<wsdl:message name="ITrackerService_GetStub_OutputMessage">
  <wsdl:part name="parameters" element="tns:GetStubResponse" /> 
</wsdl:message>

wsdl バインディングと SOAP 操作

<wsdl:binding name="BasicHttpBinding_ITrackerService" type="tns:ITrackerService">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        .
        . <!—- Omitted for brevity --> 
        .
  <wsdl:operation name="GetStub">
    <soap:operation soapAction="http://tempuri.org/ITrackerService/GetStub" style="document"/>
    <wsdl:input>
        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
        <soap:body use="literal"/>
    </wsdl:output>
  </wsdl:operation>
</wsdl:binding>

EXPECTED リターン レスポンス

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header />
  <s:Body>
      <GetStubResponse xmlns="http://tempuri.org/">
        <GetStubResult xmlns:a=http://schemas.datacontract.org/2004/07/wctest2 xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <a:Password>SOMEPASS</a:Password>
          <a:Username>SOMEUSER</a:Username>
        </GetStubResult>
      </GetStubResponse>
  </s:Body>
</s:Envelope>

これまでの HTTP リクエスト:

POST http://mydomain.com/TrackerServiceSite/wctest2.TrackerService.svc HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: 297
Host: mydomain.com

<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>
       <GetStub xmlns="http://tempuri.org/"/>
   </soap:Body>
</soap:Envelope>

HTTP レスポンス

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode>
      <faultstring xml:lang="en-US">
          The message with Action '' cannot be processed at the receiver, due to a 
          ContractFilter mismatch at the EndpointDispatcher. This may be because of 
          either a contract mismatch (mismatched Actions between sender and receiver) 
          or a binding/security mismatch between the sender and the receiver.  Check 
          that sender and receiver have the same contract and the same binding 
          (including security requirements, e.g. Message, Transport, None).
      </faultstring>
    </s:Fault>
  </s:Body>
</s:Envelope>

リクエストのどこかに wsdl ファイルの a を含める必要があることはsoapAction確かですが、どこに含めるかはわかりません。他に何が欠けていますか?どんな助けでも大歓迎です。

4

1 に答える 1

10

ソープアクションをSOAPActionHTTPヘッダーに配置します

于 2012-05-10T13:28:03.523 に答える