【发布时间】:2009-06-18 11:00:13
【问题描述】:
我正在尝试使用第三方网络服务(因此我无权访问网络服务代码)。 在 Visual Studio 2008 中,我创建了一个新的网站项目(ASP 和 c#),并添加了 Web 引用(不是 Web 服务!所以我猜它不是 WCF 服务...对吗?)。
问题是,从网络服务的文档中我知道每个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>
【问题讨论】:
标签: c# visual-studio-2008 web-services soap asmx