SOAP EnvelopeのWCFと入力パラメータ順序
-
12-12-2019 - |
質問
WebHTTPBindingを使用するWCF Webサービス(SOAP 1.1)でオブジェクト参照のインスタンスに設定されていません。(SOAP 1.1)エラーが発生しない。
すき。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:not="http://schemas.globalfoundries.com/NotificationService">
<soapenv:Header/>
<soapenv:Body>
<not:NotifyWorkflowItemUpdate>
<not:userIDs>testUserID</not:userIDs>
<not:taskID>testTaskID</not:taskID>
<not:taskType>testTaskType</not:taskType>
<not:status>testStatus</not:status>
<not:appID>testAppID</not:appID>
<not:message>testMessage</not:message>
</not:NotifyWorkflowItemUpdate>
</soapenv:Body>
</soapenv:Envelope>
.
しかし、リクエストテンプレートの入力パラメータの順序を変更した場合、前述のエラーが発生します。すなわち(注)(注)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:not="http://schemas.globalfoundries.com/NotificationService">
<soapenv:Header/>
<soapenv:Body>
<not:NotifyWorkflowItemUpdate>
<not:message>testMessage</not:message>
<not:taskID>testTaskID</not:taskID>
<not:taskType>testTaskType</not:taskType>
<not:status>testStatus</not:status>
<not:appID>testAppID</not:appID>
<not:userIDs>testUserID</not:userIDs>
</not:NotifyWorkflowItemUpdate>
</soapenv:Body>
</soapenv:Envelope>
.
これはなぜ起こっているのですか?要求パラメータは、名前ではなく順序で.NETメソッドパラメータにマッピングされていますか?名前付きパラメータマッピングを可能にするためにサービス契約に指定する必要がある属性はありますか?
解決
WCFサービスインタフェースに XMLSerializerFormat クラスを使用する必要があります。
.
[ServiceContract, XmlSerializerFormat]
public interface IGoodMessageService
{
...
}
問題と解決策について説明します。 HTTP:///neimke.blogspot.com.tr/2012/03/serialization-ordering-causes-problems.html
他のヒント
SOAPメッセージのXMLスキーマは注文を指定します。要素のXML順序で、WCFはスキーマに対してXMLを検証しています。
所属していません StackOverflow