Outbound SOAP message - variable substitution and scripting.

Jamsta1912
Tera Guru

Hello all,

I'm writing a business rule to generate an outbound SOAP message to a third party.

I've generated a SOAP message function using the WSDL provided by the third party.

I want to use setStringParameter() to set the value of variables, but I can see that a number of variable names have been used multiple times at different places in the envelope (between different XML tags). My knowledge of XML is limited. How do I ascertain the full reference for these variables to use in my business rule? Similarly, how do I reference these variables to set SOAP Message Parameters (related list on SOAP message function) for testing?

Thank you

Jamie.

1 ACCEPTED SOLUTION

tony_barratt
ServiceNow Employee
ServiceNow Employee

Hi Jamie,



I think you can find out by hitting auto-generate variables and then Preview Script Usage


Screen Shot 2016-04-23 at 3.40.54 PM.JPG


try {


var s = new sn_ws.SOAPMessageV2('Amazon', 'AWSECommerceServiceBinding.CartModify');



//override authentication profile


//authentication type ='basic'


//r.setAuthentication(authentication type,profile name);



s.setStringParameter('CartModify.Validate', '');


s.setStringParameter('Request.CartId', '');


s.setStringParameter('CartModify.MarketplaceDomain', '');


s.setStringParameter('Shared.MergeCart', '');


s.setStringParameter('Request.HMAC', '');


s.setStringParameter('Shared.CartId', '');


..



Best Regards



Tony


View solution in original post

3 REPLIES 3

tony_barratt
ServiceNow Employee
ServiceNow Employee

Hi Jamie,



I think you can find out by hitting auto-generate variables and then Preview Script Usage


Screen Shot 2016-04-23 at 3.40.54 PM.JPG


try {


var s = new sn_ws.SOAPMessageV2('Amazon', 'AWSECommerceServiceBinding.CartModify');



//override authentication profile


//authentication type ='basic'


//r.setAuthentication(authentication type,profile name);



s.setStringParameter('CartModify.Validate', '');


s.setStringParameter('Request.CartId', '');


s.setStringParameter('CartModify.MarketplaceDomain', '');


s.setStringParameter('Shared.MergeCart', '');


s.setStringParameter('Request.HMAC', '');


s.setStringParameter('Shared.CartId', '');


..



Best Regards



Tony


Hi Tony,



Thanks for this. I didn't mention we're still on Eureka, which doesn't have 'auto-generate variables'. But fortunately I've upgraded one of our sub production instances to Geneva, so I was able to cheekily copy my SOAP message function there just to generate the list of variables.



Jamie.


Hi Jamie,



Good you have the solution you need.


Convenient you had a Geneva version to cheekily snarf the variables.


Otherwise you could have used a Personal Developer Instance, which would be even cheekier!



Best Regards



Tony