0

私はWSDLファイルを持っています.

<?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:Header>
    <AuthSoapHd xmlns="http://foobar.org/">
      <strUserName>string</strUserName>
      <strPassword>string</strPassword>
    </AuthSoapHd>
  </soap:Header>
  <soap:Body>
    <SearchQuotes xmlns="http://foobar.org/">
      <searchtxt>string</searchtxt>
    </SearchQuotes>
  </soap:Body>
</soap:Envelope>

これを解決するために、私はこれをしました

>> from SOAPpy import WSDL
 >> WSDLFILE = '/path/foo.wsdl'
 >> server = WSDL.Proxy(WSDLFILE)
 >> server.SearchQuotes('rel')

このエラーが発生します

faultType: <Fault soap:Server: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.

私はそれをデバッグし、これを得ました

*** Outgoing SOAP ******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
<SOAP-ENV:Body>
<SearchQuotes SOAP-ENC:root="1">
<v1 xsi:type="xsd:string">rel</v1>
</SearchQuotes>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

ヘッダーが含まれていないことがわかります。WSDL ファイルにバグがあると思います。さて、この発信 SOAP リクエストにヘッダーを追加する方法を誰かに提案してもらえますか。

あらゆる種類の助けをいただければ幸いです。前もって感謝します

4

1 に答える 1

0

テストされていませんが、ドキュメントが提案するメソッドを使用して SOAP ヘッダーを追加できると思います。つまり、SOAPpy.Headerインスタンスを作成して準備し、それserver = server._hd (hd)を備えたプロキシを取得するために使用できますあなたが言うように、壊れた WSDL -- 代わりに WSDL を修正したほうがよいでしょうか?)。

于 2009-09-26T18:23:32.410 に答える