- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2017 07:56 AM
Hi AJ,
Yes, I am declaring the content-type as application/json; however, the web service I'm submitting the request to is not understanding the request body as I am currently submitting to it. When I submit the same JSON via SoapUI,, it understands it. Here is the complete script:
(function executeRule(current, previous /*null when async*/) {
try{
if(current.state == 'send_outbound_request'){
var rm = new sn_ws.RESTMessageV2();
rm.setBasicAuth(current.partner.outbound_user_name, current.partner.outbound_user_password);
rm.setRequestHeader('Content-Type','application/json');
rm.setRequestHeader('charset','utf-8');
rm.setHttpTimeout(current.partner.outbound_http_timeout);
rm.setHttpMethod(current.partner.outbound_http_method);
rm.setEndpoint(current.partner.outbound_endpoint);
rm.setRequestBody(current.partner.data_in_request);
var myResponse = rm.execute();
var myResponseAsObject = JSON.parse(myResponse.getBody());
current.data_in_response = JSON.stringify(myResponseAsObject,null,'\t');
current.state = 'prepare_outbound_response';
current.update();
}
}
catch(err){
current.state = 'ignore';
current.update();
}
})(current, previous);