我试图消耗第三方web服务(从组件接口中的Peoplesoft),但为了验证我必须有一个头,看起来像这样:web服务安全头
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>X</wsse:Username>
<wsse:Password>X</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
我加了块在我的应用程序中的web.config文件,该文件要使用的web服务如下:
<system.serviceModel>
<client>
<header>
<endpoint>
<wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>X</wsse:Username>
<wsse:Password>X</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</endpoint>
</header>
</client>
</system.serviceModel>
但头仍然没有出现在XML请求到web服务。
我是否在正确的轨道?
据我所知,以上都不是。我在Visual Studio 2008(.NET 3.5)中添加了一个Web引用。 – jhunter 2009-11-03 20:56:31
然后,如果我没有记错,默认行为应该是创建WCF绑定到Web服务。 – 2009-11-03 21:28:56