Skip to Content

How to call SOAP web service from server side java script(XSJS) ?

Hi All,

I am struggling to call SOAP web service(RFC published as web service) from HANA.

I have created one "XXXX.xshttpdest" and one "XX.xsjs" as below.

XXXX.xshttpdest :-

host = "host name";

port = 8000;

description = "XXXX";

useSSL = false;

pathPrefix = "/PATH OF WS";

authType = none;

useProxy = false;

proxyHost = "";

proxyPort = 0;

timeout = 0;

XX.xsjs :-

try{

var dest = $.net.http.readDestination("PKG", "XXXX");

var client = new $.net.http.Client();

var req = new $.web.WebRequest($.net.http.GET,"?xType=YY");

var c = 0;

client.request(req, dest);

var  response= client.getResponse();

var body = '';

if (response.body) {

          body = response.body.asString();

          $.response.setBody( " body---> " + body);

}

else

          {

          $.response.setBody("Nothing from ERP,  and response status="+response.status);

          }

 

}

catch (e) {

          // TODO: handle exception

          $.response.setBody(" " error :--- "+e.message );

}

Note :-In Web service "xType" is mandatory and of string type.

Our web service is tested and it's working fine.

I am sure It's calling the web service but issue is with parameter passing and type of method I have used(GET).

O/p-- Nothing from ERP,  and response status=415(Means Unsupported media type).

Please help where I am wrong or any example to make the POST call to web service.I can construct SOAP Envelop only issue is how to pass it through XSJS.

Please help If any one already tried.

Thanks in advance.

Thanks,

Sudhir.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Nov 07, 2013 at 01:31 AM

    Hi, did you have any luck on this? Looking to do the same thing.

    Add comment
    10|10000 characters needed characters exceeded