Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

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

$
0
0

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.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>