0

I'm very new to web services. I used eclipse and some tutorials from the web to create a simple web service called DeScriptor which I uploaded to a Tomcat server. It's accessible through this URL

http://www.xwizard.de:8080/services/DeScriptor

and according to the message written out there, it appears to be working (right?).

So far, so good, but now I don't know how to call it. The service has a single method String retrieveSVGFromScript(String scrp) which I tried to call with this AJAX code:

var hallowelt = "Hallo Welt";
var params = JSON.stringify({scrp: hallowelt});

$.ajax({
    type: "POST",
    url: "http://www.xwizard.de:8080/services/DeScriptor/retrieveSVGFromScript",
    data: params,
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    crossDomain: true,
    success: function (msg) {
        console.log(msg.d);
    },
    error: function (xhr, status, error) {
        // Some error handling.
    }
});

hoping that I'd get the result string of the method by msg.d, but instead I got this not so informative error message:

jquery.js:8630 POST http://www.xwizard.de:8080/services/DeScriptor/retrieveSVGFromScript 500 (Internal Server Error)

Can somebody point me in the right direction?

EDIT: You can find the WSDL here: http://www.xwizard.de:8080/services/DeScriptor?wsdl

lukas.coenig
  • 541
  • 1
  • 7
  • 19

1 Answers1

1

You are trying to call a server webservice using REST style (i.e. setting content-type, providing params as JSON message, etc.).

But the webservice expects a SOAP message. An example how to send a SOAP message with Javascript can be found here.

Community
  • 1
  • 1
wero
  • 32,544
  • 3
  • 59
  • 84
  • I tried the suggestion in many different facets, but I can't get it to work. It still shows the same error 500. I implemented it here: http://www.xwizard.de:8080/Wizz?webservice (the error shows up in the console). Sorry to bother, but I just don't know how to go on... – lukas.coenig Mar 19 '16 at 18:38
  • @lucas.coenig there seems to be a problem in the werbservice implementation, see http://wsdlbrowser.com/soapclient?wsdl_url=http%3A%2F%2Fwww.xwizard.de%3A8080%2Fservices%2FDeScriptor%3Fwsdl&function_name=retrieveSVGFromScript – wero Mar 19 '16 at 18:58
  • So it DOES work in principle! Thanks for the great debugging site! I'll look into it... – lukas.coenig Mar 19 '16 at 19:02