Recently, I am trying to use .net WCF support team using JAX-WS. Due to the security of the service, I have to set the user authorization of the HTTP header with some signature in it. I solved this by doing something like this:
BindingProvider bp = (BindingProvider) port; bp.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, Collections.singletonMap("Authorization",Collections.singletonList(authHeader)));
However, when I call the service, I get an exception:
com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html; charset=UTF-8 Supported ones are: [text/xml] com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284) com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118) com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278) com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180) com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
And it seems to me that for my request in the service there may be a requirement to be a text / text type of content. How to install it? I searched and read the documentation a lot, but I seem to be unable to understand. Of course, the exception may be something other than the Content-Type parameter (since I read that jax-ws uses text / xml by default), but I'm not sure.
Thanks in advance!
java web-services jax-ws wcf client
El che
source share