我有一个非常令人沮丧的问题。我与JAX WS创建Web服务 注释和Endpoint.publish(...)的把戏。当然,它使用com.sun.net.HttpServer。当我尝试添加在Visual Studio中的服务引用,它不会让步。服务器说:
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:
unsupportent内容类型:只接受文字/ XML
unsupportent content-type: accepted only text/xml
但与.NET应用程序/肥皂+ xml内容类型的要求。
But .net asks with application/soap+xml content-type.
如何更改内容类型的JAX WS?或者说,如何更改的Visual Studio的内容类型添加引用啄。
How do i change the content-type in jax ws? Or, how do i change the content type of visual studio add reference thingy.
感谢您。这是非常令人沮丧的!
Thank you. It's very frustrating!
谷歌上搜索,我发现后...
After googling i found...
您好,
我已经解决了这个问题。
I've resolved the problem.
应用程序/肥皂+ XML的内容 输入用于SOAP 1.2的消息 而文本/ XML用于SOAP 1.1。 因此,客户端发送SOAP 1.2 请求和服务预计只有SOAP 1.1。
'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.
地铁使用SOAP 1.1在默认情况下。如何 使SOAP 1.2绑定解释 这里: - http://forums.java.net/jive/thread.jspa?messageID= 322894 - https://metro.dev.java.net/1.4/docs/soap12。 HTML
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
参考。希望这有助于:)
编辑:试试下面的注释...
try the below annotations...
@WebService
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
或
Endpoint endpoint = Endpoint.create("http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/", impl);
endpoint.publish("http://localhost:9080/PatientDiscovery");