on 09-12-2013 9:16 AM
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.
Hi, did you have any luck on this? Looking to do the same thing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sebastian,
Please see below If this helps you but it worked for me.
var dest = $.net.http.readDestination("PKG", "XXXX");
var data='<?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/">'
+'<soap:Body>'
+'<n0:ZlhAlmNotifCreate xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">'
......................................
+'</n0:ZlhAlmNotifCreate>'
+'</soap:Body>'
+'</soap:Envelope>';
var req = new $.web.WebRequest($.net.http.POST,"");
req.contentType = "text/xml";
req.setBody(data);
client.request(req, dest);
var response= client.getResponse();
//same code as mentioned above
Please mark as correct answer If it works for you.
Thanks and Regards,
Sudhir.
For some reason, the basic auth credentials aren't getting saved in the admin tool when I click save in the destination.
I suspect it might be a security issue even though I have tested by granting all the *xs* roles to my user. The bar at the bottom says Destination Successfully saved but I can see there is a request that fails in my javascript console:
[12:15:24.895] POST http://<HOST>:80<SID>/sap/hana/xs/admin/logic/httpDestSecStore.xscfunc [HTTP/1.1 500 Internal Server Error 198ms]
Any ideas?
Also the tool is extremely slow. Just loading the page takes minutes!
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.