Unable to send SOAP message

grosch
Mega Expert

On a Calgary instance, I'm trying to send a SOAP message to my server.     I'm doing this:

var ns = 'https://ismp-testing.mydomain.com/Demo';

var action = 'bye';

var soap = new SOAPEnvelope(action, ns);

var request = new SOAPRequest('https://ismp-testing.mydomain.com/cgi-bin/hibye.pl');

request.setSoapAction(ns + '#' + action);

request.post(soap, true);

gs.print(soap.getHttpStatus());

gs.print(soap.getResponse());

When I run that, the status prints as null and the response is blank.   I've printed the XML that the envelope there generates, saved it to a file, and then made a soap call against it via the 'curl' command, and it worked just fine.   So that tells me I'm getting the XML that I expect from the SOAPEnvelope.     Any ideas why the SOAPRequest part is then failing?

1 ACCEPTED SOLUTION

Nick65
Mega Expert

See Scripting Outbound SOAP - Versions Prior to Fuji - ServiceNow Wiki


There are different   response methods to use based on how you are calling the SOAP message.


Also it seems like you should be calling the response methods from the request object , like request.getResponse() or request.getHttpStatus(); not from the soap object. May be worth a look.


View solution in original post

4 REPLIES 4

Nick65
Mega Expert

See Scripting Outbound SOAP - Versions Prior to Fuji - ServiceNow Wiki


There are different   response methods to use based on how you are calling the SOAP message.


Also it seems like you should be calling the response methods from the request object , like request.getResponse() or request.getHttpStatus(); not from the soap object. May be worth a look.


All three of these result in null being printed.



gs.print(request.getHttpStatus());


gs.print(request.getResponseDoc());


gs.print(request.getErrorMessage());


Are you going through the mid server?


I'm not, no.   My original code works perfectly, which the change you pointed out about calling request instead of soap on the responses.   The issue is the security team threw up firewalls that I wasn't aware of   Once I moved the testing to a box without the firewalls it works perfectly.