1

In our project we have the following jax-ws application client (there are many more methods so I just added the one we're having issues with):

@WebService(
   name = "SMEVMessageExchangePortType",
   targetNamespace = "urn://x-artefacts-smev-gov-ru/services/message-exchange/1.1"
)
@SOAPBinding(
   parameterStyle = ParameterStyle.BARE
)
public interface SMEVMessageExchangePortType {

   @WebResult(
      name = "GetRequestResponse",
      targetNamespace = "urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.1",
      partName = "parameters"
   )
   @Produces
   GetRequestResponse getRequest(@WebParam(name = "GetRequestRequest",targetNamespace = "urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.1",partName = "parameters") GetRequestRequest var1) throws InvalidContentException, SMEVFailureException, SenderIsNotRegisteredException, SignatureVerificationFaultException, UnknownMessageTypeException;

}

It worked fine untill recently we started getting responses as text/plain not as text/xml

It led to the following exception:

com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/plain;charset=utf-8 Supported ones are: [text/xml]

My question is whether it's possible to modify the code to treat any given text/plain response as text/xml

Ideally to have something similar to @Produces and @Consumes just like in JAX-RS

If not, maybe we could use a third-party SOAP library which implements that behaviour?

Joe D
  • 44
  • 1
  • 10

1 Answers1

0

As long as you're not getting text/html as a response, you can use my answer on this question to rewrite the content type: jax-ws: unsupported Media Exception content-type from server side

Or if possible you could use a reverse proxy as described here: SOAP unsupported media exception text/plain Supported ones are: [text/xml]

slindenau
  • 1,091
  • 2
  • 11
  • 18