Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2175

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

$
0
0

Hello Sudhir,

 

I am also trying same example for XSJS. In our case: We are trying to connect XSJS with SAP web service but it is not successful.

xsHttpDest:-

description = "Web Service";

host = "HostName";

port = Portno;

pathPrefix = "/sap/bc/srt/rfc/sap/";

proxyType = none;

proxyHost = "";

proxyPort = 0;

authType = none;

useSSL = false;

timeout = 0;

 

 

 

 

XSJS:-

 

 

dest = $.net.http.readDestination("XXX", "xshttpname");

var data ='<?xml version="1.0" encoding="utf-8"?>'+

'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:Z_TEST_IOS="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:n0="urn:sap-com:document:sap:rfc:functions" xsl:version="1.0">' +

'<soap:Body>' +

 

'</soap:Body>'+

'</soap:Envelope>';


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


var req = new $.web.WebRequest($.net.http.POST,"");  

 

req.contentType = "text/xml";
req.setBody(data);
client.request(req, dest);
var  response= client.getResponse();
var body = '';
if (response.body) {
      body = response.body.asString();
      $.response.setBody( " body---> " + body);

}

 


please suggest where it is wrong?

 

Thanks,

Pad

 




Viewing all articles
Browse latest Browse all 2175

Trending Articles



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