I have a very frustrating problem. I have a web service created with JAX WS annotations and Endpoint.publish(...) trick. Of course, it uses com.sun.net.HttpServer. When I try to add a service reference in Visual studio, it won't budge. The server says:
我有一个非常令人沮丧的问题。我有一个用JAX WS注释和Endpoint.publish(…)技巧创建的web服务。当然,它使用com.sun.net.HttpServer。当我尝试在Visual studio中添加服务引用时,它不会改变。服务器说:
unsupportent content-type: accepted only text/xml
不支持内容类型:只接受文本/xml
But .net asks with application/soap+xml content-type.
但是。net需要应用/soap+xml内容类型。
How do i change the content-type in jax ws? Or, how do i change the content type of visual studio add reference thingy.
如何更改jax ws中的内容类型?或者,如何更改visual studio添加引用内容类型。
Thank you. It's very frustrating!
谢谢你!这是非常令人沮丧的!
1 个解决方案
#1
1
After googling i found...
搜索后我发现……
Hi,
你好,
I've resolved the problem.
我已经解决了这个问题。
'application/soap+xml' is the content type used for SOAP 1.2 messages whereas text/xml is used for SOAP 1.1. Hence the client send SOAP 1.2 requests and service expects only SOAP 1.1.
“application/soap+xml”是用于soap 1.2消息的内容类型,而文本/xml用于soap 1.1。因此客户端发送SOAP 1.2请求,而服务只期望SOAP 1.1。
Metro uses SOAP 1.1 by default. How to enable SOAP 1.2 binding is explained here: - http://forums.java.net/jive/thread.jspa?messageID=322894 - https://metro.dev.java.net/1.4/docs/soap12.html
Metro默认使用SOAP 1.1。如何启用SOAP 1.2绑定的解释如下:- http://forums.java.net/jive/thread.jspa?消息id = 322894 - https://metro.dev.java.net/1.4/docs/soap12.html
Reference. Hope this helps :)
参考。希望这有助于:)
EDIT: try the below annotations...
编辑:试试下面的注释……
@WebService
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
OR
或
Endpoint endpoint = Endpoint.create("http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/", impl);
endpoint.publish("http://localhost:9080/PatientDiscovery");
#1
1
After googling i found...
搜索后我发现……
Hi,
你好,
I've resolved the problem.
我已经解决了这个问题。
'application/soap+xml' is the content type used for SOAP 1.2 messages whereas text/xml is used for SOAP 1.1. Hence the client send SOAP 1.2 requests and service expects only SOAP 1.1.
“application/soap+xml”是用于soap 1.2消息的内容类型,而文本/xml用于soap 1.1。因此客户端发送SOAP 1.2请求,而服务只期望SOAP 1.1。
Metro uses SOAP 1.1 by default. How to enable SOAP 1.2 binding is explained here: - http://forums.java.net/jive/thread.jspa?messageID=322894 - https://metro.dev.java.net/1.4/docs/soap12.html
Metro默认使用SOAP 1.1。如何启用SOAP 1.2绑定的解释如下:- http://forums.java.net/jive/thread.jspa?消息id = 322894 - https://metro.dev.java.net/1.4/docs/soap12.html
Reference. Hope this helps :)
参考。希望这有助于:)
EDIT: try the below annotations...
编辑:试试下面的注释……
@WebService
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
OR
或
Endpoint endpoint = Endpoint.create("http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/", impl);
endpoint.publish("http://localhost:9080/PatientDiscovery");