سؤال

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 content-type: accepted only text/xml

But .net asks with application/soap+xml content-type.

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...

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.

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

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"); 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top