私たちのパートナーが提供するサービスを利用する必要があります。私は少し指摘されましたが、セキュリティはPasswordDigestであると言われました。私はそれを見て、すぐにWSEへの参照をたくさん見たので、私は行った。実装が非常に簡単で、すぐに私のメッセージのSOAPヘッダーに入っているPasswordDigestを使って、標準のWSEユーザートークンを持っていました。SoapHttpClientサービスへの呼び出しでhttpヘッダーを追加する
今日私たちがテストを開始したとき、私は即座に(エラーメッセージによって)物事が正しくないと言われました。明らかに、パートナはSOAPヘッダーを調べず、むしろHTTPヘッダーにセキュリティ情報を求めます。
カスタムHTTPヘッダーをプロキシクラスに追加する方法については、多くの記事がありますが、プロキシはSoapHttpClientProtocolから継承し、ヘッダーコレクションを追加しません。私は生のhttpWebRequestを見ていましたが、アクセスする特定のメソッドを持っています。これに対処するための複雑なパラメータがいくつかあります。
カスタムHTTPヘッダーをGetWebRequestメソッドを持たないサービスプロキシクラスに追加する最適な方法は何ですか?参考のため
:
Proxyクラスのdecleration:私は呼び出す必要が
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.3053")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="MtomServiceSoap11", namespace="http://ws.xxxxxxx.com/")]
public partial class MtomServiceService : System.Web.Services.Protocols.SoapHttpClientProtocol {
ターゲット方法:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("uploadDocumentResponse", Namespace="http://ws.edsmtom.citizensfla.com/")]
public uploadDocumentResponse uploadDocument([System.Xml.Serialization.XmlElementAttribute(Namespace="http://ws.xxxxxxx.com/")] uploadDocumentRequest uploadDocumentRequest) {
object[] results = this.Invoke("uploadDocument", new object[] {
uploadDocumentRequest});
return ((uploadDocumentResponse)(results[0]));
}
}
サービスへの実際の呼び出しは簡単です。パスされているオブジェクトはありません。
request.criteria = docCriteria;
request.document = document;
var result = service.uploadDocument(request);
ありがとうございます。
ご自身で回答を記入してください。 – Snowbear