我正在尝试使用第三方Web服务(因此我无法访问Web服务代码)。
在Visual Studio 2008中,我创建了一个新的Web站点项目(ASP和c#),并添加了Web引用(不是Web服务!所以我猜它不是WCF服务...正确吗?)。
问题在于,从Web服务文档中我知道每个SOAP请求都必须使用以下信封和头部发送,请告诉我如何在我的SOAP请求中添加这些内容? 我找到的所有解决方案都需要修改Web服务源或代理,但我不能这样做,因为我没有访问Web服务源和Visual Studio 2008客户端中的Web服务代理只存在于只读临时文件中!
问题在于,从Web服务文档中我知道每个SOAP请求都必须使用以下信封和头部发送,请告诉我如何在我的SOAP请求中添加这些内容? 我找到的所有解决方案都需要修改Web服务源或代理,但我不能这样做,因为我没有访问Web服务源和Visual Studio 2008客户端中的Web服务代理只存在于只读临时文件中!
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" soap:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Username>gimme.data@stats.com</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Ima5tatto</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body xmlns:ns2="http://neighbourhood.statistics.gov.uk/nde/v1-0/discoverystructs">
<ns2:AreaAtLevelElement>
<AreaIdWithLevelType>
<AreaId>276704</AreaId>
<LevelTypeId>12</LevelTypeId>
</AreaIdWithLevelType>
</ns2:AreaAtLevelElement>
</soap:Body>
</soap:Envelope>