aspose file tools*
The moose likes Web Services and the fly likes UnsupportedMediaException -> logging response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "UnsupportedMediaException -> logging response" Watch "UnsupportedMediaException -> logging response" New topic
Author

UnsupportedMediaException -> logging response

Stefan Gerber
Ranch Hand

Joined: Mar 08, 2008
Posts: 33
Hello,
I get the following exception. Now i'm looking for a way how i can log the incomming message. I tried to use the SOAPHandler but there is the problem that
the exception is thrown earlier and i don't get the message. Is there an other way how i can log the message that is send from the server?

thanks

com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html Supported ones are: [text/xml]
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:284)
at com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:118)
at com.sun.xml.internal.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:278)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:180)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy36.isAlive(Unknown Source)
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Stefan,

Try using Fiddler or Wireshark or something similar to that to capture incoming (if used on client) or outgoing (if used on server) HTTP response message and then you can look into HTTP body for SOAP message.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Stefan Gerber
Ranch Hand

Joined: Mar 08, 2008
Posts: 33
Hello,
Thanks for your answer. But I would like to have a solution where i don't have to install a third party product on a client machine.
But i guess if there is no *Handler that can be added to the handlerchain to protocol the communication.

If a webservice is down and a html error page is shown instead, there is no way to show the error message to the user.
I'm looking for something where i can get the message. The only exception i get is this UnsupportedMediaException.

thanks
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Stefan,
The only way which you can see SOAP message without installing a third-party tool is to use SOAP Handlers. But, you said that you already tried it. The other way is to use implementing web services API if it provides any methods to output SOAP message.
Stefan Gerber
Ranch Hand

Joined: Mar 08, 2008
Posts: 33
Hello,
The Problem with the SOAP Handlers is that the handlers are not called when a html content is send by the server. So i need a possibility / handler that can be registered bevor the api tries to parse the message. What do you mean with "implementing web services API"? till know i haven't found a way to register other handlers.

regards stefan
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Stefan,


The Problem with the SOAP Handlers is that the handlers are not called when a html content is send by the server

I really doubt if you say they are not called. The purpose of SOAP handlers is to do some task before or after the webservice invocation. Well, all the web service requests and responses are usually HTTP requests and responses but contain SOAP message in their body unless you are using a different transport protocol.


What do you mean with "implementing web services API"? till know i haven't found a way to register other handlers.

I think some webservice API classes may provide methods to probably output SOAP message, which I was not sure but suggesting you to check out your webservice java API documentation for any.
 
Consider Paul's rocket mass heater.
 
subject: UnsupportedMediaException -> logging response