Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » UnsupportedMediaException when calling webservice
UnsupportedMediaException when calling webservice [message #1239498] Tue, 04 February 2014 10:13 Go to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

I created a webService in Scout. Now I try to call this webservive from a plain html/javascript/jquery page. I tried about all the possible combinations of data, dataType and other parameters for my webservice but nothing seems to work. I always get an exception like below. Any idea what I am doing wrong?

Below is the soapRequest I made.

Regards Bertin


var wsUrl = 'http://localhost:8080/xplatformtest_server/jaxws/PersonenWebService/getPersonen';

var soapRequest = '<?xml version="1.0" encoding="utf-8"?>' +
	'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '+ 
		'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '+
		'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" ' + 
		'xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/" ' +
		'xmlns="http://schemas.xmlsoap.org/wsdl/">' +
		'<soap:Body>'+ 
		'</soap:Body>'+  
	        '</soap:Envelope>';

$.ajax( {
        type:'POST',
	url: wsUrl,
       	dataType: "XML", 
	data: soapRequest,
	success:processSuccess,
	error:processError
});
		




feb 04, 2014 11:01:53 AM com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit handle
SEVERE: Unsupported Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Supported ones are: [text/xml]
com.sun.xml.internal.ws.server.UnsupportedMediaException: Unsupported Content-Type: application/x-www-form-urlencoded; charset=UTF-8 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:343)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:321)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.access$400(HttpAdapter.java:81)
at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:576)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at org.eclipse.scout.jaxws.internal.servlet.ServletAdapter.handle(ServletAdapter.java:49)
at org.eclipse.scout.jaxws.internal.servlet.EndpointServlet.handleRequest(EndpointServlet.java:100)
at org.eclipse.scout.jaxws.internal.servlet.EndpointServlet.handleRequest(EndpointServlet.java:74)
at org.eclipse.scout.jaxws.internal.servlet.EndpointServlet.doPost(EndpointServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.scout.jaxws.JaxWsServlet.access$0(JaxWsServlet.java:1)
at org.eclipse.scout.jaxws.JaxWsServlet$1$1.run(JaxWsServlet.java:63)
Re: UnsupportedMediaException when calling webservice [message #1239552 is a reply to message #1239498] Tue, 04 February 2014 12:52 Go to previous message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 201
Registered: November 2010
Senior Member
JAX-WS RI throws this exception when it encounters a message that is not correctly recognized as a SOAP message. In your case, the message body seem to be okay, but the HTTP headers are not. As the exception states, the "Content-type" header has to be of type "text/xml", but apparently jQuery sends "application/x-www-form-urlencoded" per default. Try setting the expected content-type explicitly then calling ajax().

Kind regards,
Beat
Previous Topic:Tab key in RAP
Next Topic:Single Sourcing RAP & SWT
Goto Forum:
  


Current Time: Tue Mar 19 04:32:15 GMT 2024

Powered by FUDForum. Page generated in 0.01828 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top