java 当 WSDL 使用 SOAP 1.2 时生成 webservice 客户端
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7043561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Generate webservice client when WSDL uses SOAP 1.2
提问by Oscar
I have a WSDL file which I want to generate a webservice client from. The problem is that the WSDL I've gotten uses SOAP 1.2:
我有一个 WSDL 文件,我想从中生成一个 web 服务客户端。问题是我得到的 WSDL 使用了 SOAP 1.2:
<wsdl:definitions xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" [...]>
And
和
<wsoap12:operation soapAction="[...]" />
When I try to generate a client from this I only get the request/response Java beans.
当我尝试从中生成客户端时,我只能获得请求/响应 Java bean。
If I on the other hand edit the WSDL to use SOAP 1.1 (and nothingelse), everything generates beautifully, except that it will send SOAP 1.1 request instead of SOAP 1.2, and the server will yell at me to use 1.2 instead...
另一方面,如果我编辑 WSDL 以使用 SOAP 1.1(而不是其他任何东西),那么一切都会很好地生成,除了它会发送 SOAP 1.1 请求而不是 SOAP 1.2,并且服务器会大喊我使用 1.2 代替......
I generate the code using Spring Tool Suite on Windows 7 by right clicking the WSDLs and selecting "Web services > Generate client". All this have worked like a charm before, when we were using SOAP 1.1.
我在 Windows 7 上使用 Spring Tool Suite 生成代码,方法是右键单击 WSDL 并选择“Web 服务 > 生成客户端”。以前,当我们使用 SOAP 1.1 时,所有这些都非常有效。
I've also tried to generate it with wsimport
of the maven plugin jaxws-maven-plugin
to no avail; it too generates only the beans, not the proxy.
我也尝试使用wsimport
maven 插件生成它,jaxws-maven-plugin
但无济于事;它也只生成 bean,而不生成代理。
Is there a way to get this to work? Or is there some way I can modify the generated *ServiceProxy.java
classes for them to use SOAP 1.2 instead of 1.1?
有没有办法让它发挥作用?或者有什么方法可以*ServiceProxy.java
为他们修改生成的类以使用 SOAP 1.2 而不是 1.1?
采纳答案by cs94njw
You might want to look at Metro. That should support Soap 1.2.
你可能想看看地铁。那应该支持 Soap 1.2。
Someone posted a reference to client gen using Metro here: Generating Metro Client Using Local WSDL File
有人在此处使用 Metro 发布了对客户端 gen 的引用:使用本地 WSDL 文件生成 Metro 客户端
Metro wsimport options: http://metro.java.net/1.2/docs/wsimport.html
Metro wsimport 选项:http: //metro.java.net/1.2/docs/wsimport.html