Hi All,
I have an XML file which gives correct output in Soap UI.
When I try to call it from HANA XSJS, i get the error
Response Body: --
Bad Request
Your browser sent a request that this server could not understand.
Can you please have a look at the XML and the XSJS and let me know what could be the issue? (The httpsdest file is configured correctly and added in trust store)
XML:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:rfc:functions"><soapenv:Header/> <soapenv:Body> <urn:_-SIE_-CMDF_ADDR_WS> <IH_REQUESTER>5000</IH_REQUESTER> <!--Call Melissa Global Address Direct--> <IF_ADR_DIRECT>X</IF_ADR_DIRECT> <IT_ADR_DIRECT><item><CONTROLLER><item><FIELD/><VALUE/></item></CONTROLLER><RECORD_ID>1</RECORD_ID><ORGANIZATION/><ADDRESS_LINE1>Residency Road </ADDRESS_LINE1><ADDRESS_LINE2/><DOUBLE_DEPENDENT_LOCALITY/><DEPENDENT_LOCALITY/><LOCALITY>Bangalore</LOCALITY><SUB_ADMINISTRATIVE_AREA/><ADMINISTRATIVE_AREA/><POSTAL_CODE>110034</POSTAL_CODE><SUB_NATIONAL_AREA/><COUNTRY>IN</COUNTRY><RECORD_OPTIONS/></item> </IT_ADR_DIRECT> </urn:_-SIE_-CMDF_ADDR_WS></soapenv:Body></soapenv:Envelope>
The XSJS is:
var dest = $.net.http.readDestination("pack","demoservice"); var client = new $.net.http.Client(); var req = new $.net.http.Request($.net.http.GET, "demoservice/services/ws_ADDR"); var data = '<?xml version="1.0" encoding="UTF-8"?>' + '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"' + 'xmlns:urn="urn:sap-com:document:sap:rfc:functions">' + '<soapenv:Header/>' + '<soapenv:Body>' + '<urn:_-SIE_-CMDF_ADDR_WS>' + '<IH_REQUESTER>8001</IH_REQUESTER>' + '<IF_ADR_DIRECT>X</IF_ADR_DIRECT>' + '<IT_ADR_DIRECT>' + '<item>' + '<CONTROLLER>' + '<item>' + '<FIELD/>' + '<VALUE/>' + '</item>' + '</CONTROLLER>' + '<RECORD_ID>1</RECORD_ID>' + '<ORGANIZATION/>' + '<ADDRESS_LINE1>Residency Road </ADDRESS_LINE1>' + '<ADDRESS_LINE2/>' + '<DOUBLE_DEPENDENT_LOCALITY/>' + '<DEPENDENT_LOCALITY/>' + '<LOCALITY>Bangalore</LOCALITY>' + '<SUB_ADMINISTRATIVE_AREA/>' + '<ADMINISTRATIVE_AREA/>' + '<POSTAL_CODE>110034</POSTAL_CODE>' + '<SUB_NATIONAL_AREA/>' + '<COUNTRY>IN</COUNTRY>' + '<RECORD_OPTIONS/>' + '</item>' + '</IT_ADR_DIRECT>' + '</urn:_-SIE_-CMDF_ADDR_WS>' + '</soapenv:Body>' + '</soapenv:Envelope>'; try{ req.contentType = "text/xml"; req.setBody(data); client.request(req, dest); var response = client.getResponse(); var resBody = response.body.asString(); if(response.body){ $.response.setBody("Response Body: --"+resBody); } else { $.response.setBody(JSON.stringify({ "body" : resBody })); } }catch(errObj){ $.response.setBody(errObj.message); }