SOAP Web服务:多台服务器,一个接口 [英] SOAP web service: many servers, one interface

查看:168
本文介绍了SOAP Web服务:多台服务器,一个接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况中,我将需要服务器任意数量来提供同样的SOAP Web服务。我想生成一组代理类,并能够提供他们的位置在不同的服务器在运行时指向他们。不幸的是,它看起来好像 WSDL:端口节点(的 WSDL孩子:服务)需要一个特定的地址服务器是很难codeD。看来,由于这个网址将被烤成我的代理类。我知道,我可能会用手工编辑生成的代理类,或修改code一代修改这一点,但我真的preFER不诉诸这一点。我觉得有必须是一个更好的办法来解决这个问题。我只是想从分离的服务将驻留在该位置的接口定义。我使用VS2008和C#.NET,如果这是任何帮助,但最好将是一个语言无关(SOAP或特定WSDL),一般的解决这个问题。

I have a scenario in which I'm going to need an arbitrary number of servers to provide the same SOAP web service. I would like to generate one set of proxy classes and be able to supply them with a location to point them at the different servers at runtime. Unfortunately, it looks as though the wsdl:port node (child of wsdl:service) requires the address of a specific server to be hardcoded. It appears that due to this the URL will be baked into my proxy classes. I know that I could potentially modify this by hand-editing the generated proxy classes, or modifying the code generation, but I'd really prefer not to resort to that. I feel like there's got to be a better way to solve this problem. I just want to decouple the interface definition from the location that the service will be residing at. I'm using VS2008 and C#.NET if that's of any help though best would be a language-agnostic (SOAP or WSDL specific) general solution to this problem.

推荐答案

没有,在.net中,您可以在运行时更改网址。

No, in .NET you can change the URL at runtime.

Service svc = new Service ();
svc.url = "Value read from config. file or some such"
output = svc.method (input);

这篇关于SOAP Web服务:多台服务器,一个接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆