用于动态端点的 Apache CXF 客户端
我现在使用 Apache CXF 作为 .NET 服务的 Web 服务客户端来绕过 NTLM 身份验证。它工作得很好,但我想知道为什么我似乎无法设置 Web 服务目标端点。出于某种奇怪的原因,CXF 似乎想要在运行时使用 WSDL - 不确定。它从 WSDL 获取物理端点,我猜这在测试环境中工作得很好,但在部署时它肯定会发生变化。
下面是一些要演示的代码:
MyWebServices service = new MyWebServices ();
MyWebServicesSoap port = service.getMyWebServicesSoap12();
// Turn off chunking so that NTLM can occur
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
port.doSomethingUseful();
同样,我在 CXF 客户端 API 中没有看到允许我设置服务端点的地方。无论如何我都看不到。在本例中,目标是 http://localhost/integration/webservices/mywebservices.asmx,但我可以在任何地方。这个行人问题肯定已经得到解决了吗?
I'm now using Apache CXF as a web services client for a .NET service to get around NTLM authentication. It works great, but I'm wondering why I can't seem to be able to set the web service target endpoint. CXF seems to want the WSDL at runtime for some strange reason - not sure. It takes the physical endpoint from the WSDL, which works fine in test environments I guess, but at deployment time it's sure to change.
Here's some code to demonstrate:
MyWebServices service = new MyWebServices ();
MyWebServicesSoap port = service.getMyWebServicesSoap12();
// Turn off chunking so that NTLM can occur
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
port.doSomethingUseful();
Again, there is no place that I can see in the CXF client API that allows me to set the service endpoint. Not that I can see anyway. In this case, the target is http://localhost/integration/webservices/mywebservices.asmx, but I could be anywhere. Surely this pedestrian problem is solved somehow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请尝试以下操作:
或者,
MyWebServices
可能具有其他获取 WSDL 位置 URL 的 getXXX 方法Try the following:
Alternatively,
MyWebServices
might have other getXXX methods that take a URL for the WSDL location在 CXF 2.6.1 中工作
Working in cxf 2.6.1
这对我有用。
This worked for me.