Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net WSE2的部分使用_.net_Web Services_Wse_Wse2.0 - Fatal编程技术网

.net WSE2的部分使用

.net WSE2的部分使用,.net,web-services,wse,wse2.0,.net,Web Services,Wse,Wse2.0,我正在编写一个.NETWeb服务,它将取代旧的.NETWeb服务。 为了不破坏现有客户机,我不能更改接口。 这意味着没有WSE访问此web服务 “旧”web服务直接访问数据库 “新”服务不直接访问数据库,而是使用另一个web服务来访问。另一个web服务已经被其他一些应用程序使用 因此,基本上,我是在另一个(私有)web服务前面编写一个(公共)web服务 让我们将新的公共web服务称为“Front”,将现有的私有web服务称为“Back” 问题是“Back”需要WSE2身份验证,而“Front”需

我正在编写一个.NETWeb服务,它将取代旧的.NETWeb服务。 为了不破坏现有客户机,我不能更改接口。 这意味着没有WSE访问此web服务

“旧”web服务直接访问数据库

“新”服务不直接访问数据库,而是使用另一个web服务来访问。另一个web服务已经被其他一些应用程序使用

因此,基本上,我是在另一个(私有)web服务前面编写一个(公共)web服务

让我们将新的公共web服务称为“Front”,将现有的私有web服务称为“Back”

问题是“Back”需要WSE2身份验证,而“Front”需要在没有WSE2的情况下可以访问

如何在web.config中配置它?我有microsoft.web.services2部分和soapExtensionTypes部分,如下所示:

<microsoft.web.services2>
  <diagnostics>
     <trace enabled="true" input="InputTrace.log" output="OutputTrace.log" />
  </diagnostics>
  <policy>
     <cache name="policyCache.config" />
  </policy>



最后我自己找到了答案,它在策略文件中。我必须为不同的策略定义不同的端点。诸如此类:

<?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="http://schemas.microsoft.com/wse/2003/06/Policy">
  <mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy">
     <!-- calls to this web services will use wse -->
     <endpoint uri="http://the.service.that.needs.wse2.asmx">
        <defaultOperation>
           <request policy="#Sign-Username" />
           <response policy="" />
           <fault policy="" />
        </defaultOperation>        
     </endpoint>
    <!-- no policies for other endpoints -->
    <defaultEndpoint>
      <defaultOperation>
      </defaultOperation>
    </defaultEndpoint>
  </mappings>
  <policies [...]>
    [...]
  </policies>
</policyDocument>

[...]

现在我想了解如何动态配置端点uri,但这可能是另一个问题。

WSE已过时。WSE2甚至更加过时。不要使用它。任何依赖WSE2的客户端都需要立即更新,因为WSE2不仅已经过时,而且还使用非标准协议。好吧,谢谢你,但这不是问题所在,我也不是做出这些决定的人。但是你有什么建议,WSE3?不,根本不是WSE。所有新的web服务或客户端开发都使用WCF。因为WCF代表“Windows通信基金会”,我怀疑这是标准协议。WCF是微软所有其他web服务技术的替代品,绝对支持标准WS-*协议。WSE是在ASMXWeb服务之上获得此类支持的过渡产品。WSE2实现的协议还不是最终协议。使用WSE2会遇到越来越多的麻烦,因为它使用的一些协议已被最终版本所取代。WCF实现了最终版本,并被设计为保持最新(WSE不能做到这一点)。我怀疑WSE能否动态配置端点,但祝你好运。你应该克服你对WCF的怀疑,考虑到它可以完全满足你的需求。顺便说一句,它已经推出近五年了。下次我从头开始构建web服务时,我可能会检查WCF,但现在还不能更改现有的web服务。
<?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="http://schemas.microsoft.com/wse/2003/06/Policy">
  <mappings xmlns:wse="http://schemas.microsoft.com/wse/2003/06/Policy">
     <!-- calls to this web services will use wse -->
     <endpoint uri="http://the.service.that.needs.wse2.asmx">
        <defaultOperation>
           <request policy="#Sign-Username" />
           <response policy="" />
           <fault policy="" />
        </defaultOperation>        
     </endpoint>
    <!-- no policies for other endpoints -->
    <defaultEndpoint>
      <defaultOperation>
      </defaultOperation>
    </defaultEndpoint>
  </mappings>
  <policies [...]>
    [...]
  </policies>
</policyDocument>