首页 > 代码库 > 现有Web Service Client使用Microsoft WSE 2.0

现有Web Service Client使用Microsoft WSE 2.0

我安装了WSE 2.0 SP3,Setup Type选择Runtime。如果想要让Visual Studio 2005以上版本集成WSE需稍费周折,默认集成Visual Studio 2005。

1、引用Microsoft.Web.Services2.dll。

2、修改Visual Studio自动生成的Web Service Client,继承Microsoft.Web.Services2.WebServicesClientProtocol(如果Update Web Reference需要再次手动编辑)。

3、假设对方的Web Service需要提供WS-Securtiy简单的Username Token认证,但我们不需要对Response进行校验,可以在应用程序配置文件中将allowEmptyTransform设置为true。

<?xml version="1.0" encoding="utf-8"?><configuration>  <configSections>    <section name="microsoft.web.services2"             type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />  </configSections>  <microsoft.web.services2>    <security>      <allowEmptyTransform enabled="true" />    </security>  </microsoft.web.services2></configuration>