2017-10-06 39 views
0

我需要將以下SOAP頭傳遞給WCF服務調用。如何將原始XML作爲SOAP頭傳遞給WCF代理類?

<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
    <wsu:Timestamp wsu:Id="TS-3DCA13685AB558766615063665309446"> 
     <wsu:Created>2017-09-25T19:08:50.943Z</wsu:Created> 
     <wsu:Expires>2017-09-25T20:48:50.943Z</wsu:Expires> 
    </wsu:Timestamp> 
    <wsse:UsernameToken wsu:Id="UsernameToken-3DCA13685AB558766615063665252595"> 
     <wsse:Username>prdIDXXXX</wsse:Username> 
     <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXXX</wsse:Password> 
     <wsu:Created>2017-09-25T19:08:45.259Z</wsu:Created> 
    </wsse:UsernameToken> 
    </wsse:Security> 

問題是,大多數在stackoverflow或其他論壇的解決方案通過創建一個HttpWebRequest對象來做到這一點。

例如:calling WCF services using SOAP

然而,在我來說,我已經從WSDL生成的服務代理類。代理類已經創建了服務調用簽名:

myResponseObject = ServiceProxy.MyServiceMethod(myRequestObject1, myRequestObject2); 

如何在服務調用中「注入」我的soap頭文件?

回答

相關問題