• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Derek McKee
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!