aspose file tools*
The moose likes Web Services and the fly likes Nondescript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Nondescript "Unsupported Content-Type" error when connecting to https Sharepoint web services" Watch "Nondescript "Unsupported Content-Type" error when connecting to https Sharepoint web services" New topic
Author

Nondescript "Unsupported Content-Type" error when connecting to https Sharepoint web services

Derek McKee
Greenhorn

Joined: Dec 23, 2010
Posts: 1
I have successfully connected to the web services of an unsecured (http) Sharepoint site. Using similar code and following the same steps, I receive the following error when trying to connect to the web services of a secured (ssl/https) Sharepoint site:

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 $Proxy30.getListItems(Unknown Source)
at com.sharepoint.testConnection.Manager2.displaySharePointList(Manager2.java:53)
at com.sharepoint.testConnection.Manager2.main(Manager2.java:77)


Any ideas why I am getting this error and what it means? If the server is returning a html message with something like a 401 error, why doesn't the error message indicate so, as it did so when I was working on connecting to the unsecured Sharepoint site?

I tried to view the server response messages using Wireshark for more details, but I don't know how to decrypt them and I don't really know what I'm looking for. When connecting to the unsecured site, I was able to see and open HTML/XML responses.

I wrote my code closely following http://davidsit.wordpress.com/2010/02/10/reading-a-sharepoint-list-with-java-tutorial/ and generated WSDL proxy classes using wsimport (java jdk 1.6.0_21),
"C:\Program Files\Java\jdk1.6.0_21\bin\wsimport.exe" -p com.microsoft.schemas.sharepoint.soap -keep -extension Lists.wsdl -d "C:\Documents and Settings\...\src"
:

shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: text/html Supported ones are: [text/xml]

Content type for SOAP message should be either text/xml for SOAP 1.1 or application/soap+xml for SOAP 1.2. In your case its text/html that is the reason you are getting this exception.

earlier I created secure client using axis2. You could look at post below.
http://shivendra-tripathi.blogspot.com/2010/11/enabling-ssl-for-axis2-service-and.html


SCJP 1.5(97%) My Blog
 
Don't get me started about those stupid light bulbs.
 
subject: Nondescript "Unsupported Content-Type" error when connecting to https Sharepoint web services