修复 ContractRef 和 docRef 上的非标准 Web 服务器端口
我的问题与此密切相关:如何我可以从非标准端口使用 .NET Web 服务吗?。我的 Web 服务在端口转发防火墙后面运行,因此 WSDL 文档中报告的端口号包含内部高编号端口。我编写了一个 SoapExtensionReflector 类,它能够重写 WSDL 文档。因此,像 example.com/path/loginservice?wsdl 这样的请求会被正确处理。
但是,这不会处理“disco”请求:example.com/path/loginservice?disco。这将返回如下 XML 文档:
<discovery>
<contractRef ref="http://example.com:10092/loginservice.asmx?wsdl" docRef="http://example.com:10092/loginservice.asmx"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q1:LoginServiceSoap"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q2:LoginServiceSoap12"/>
</discovery>
虽然 SoapExtensionReflector 已正确重写了soap 绑定,但contractRef 和docRef URL 具有高编号端口。我怎样才能重写它们呢?
My problem is closely related to this one: How can I use .NET web services from non-standard ports?. My web service runs behind a port-forwarding firewall, so the port numbers reported in the WSDL document contain the internal high-numbered port. I wrote a SoapExtensionReflector class which is able to rewrite the WSDL document. So a request like example.com/path/loginservice?wsdl is handled correctly.
However, this doesn't handle the "disco" request: example.com/path/loginservice?disco. This returns an XML document like this:
<discovery>
<contractRef ref="http://example.com:10092/loginservice.asmx?wsdl" docRef="http://example.com:10092/loginservice.asmx"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q1:LoginServiceSoap"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q2:LoginServiceSoap12"/>
</discovery>
While the soap bindings have been properly re-written by the SoapExtensionReflector, the contractRef and docRef URLs have the high-numbered port. How can I rewrite them as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
终于想通了一些事情。将所有内容迁移到 WCF 后,使用 svcutil 手动创建代理类。我想您可能可以使用旧的 asp.net Web 服务附带的 wsdl 工具做同样的事情,但我还没有尝试过。
Finally figured something out. Created proxy classes manually using svcutil after migrating everything to WCF. I figure you could probably do the same thing using the wsdl tool that came with the old asp.net web services, but I haven't tried that.