Workflow soap call via JS doesn't work through campaign but same works from SOAP UI | Community
Skip to main content
March 17, 2020
Solved

Workflow soap call via JS doesn't work through campaign but same works from SOAP UI

  • March 17, 2020
  • 2 replies
  • 3343 views

Sample JS file added below which is causing the error. Could someone help to fix this issue?

This SOAP request get success while trying from a SOAP UI


xtk.workflow.Cleanup(instance.id);
var req = new HttpClientRequest("https://xxxxx/test/ws");
logInfo("Connection establish..");
req.header["Content-Type"] = "text/xml; charset=utf-8";
req.header["SOAPAction"] = "";
req.header["Host"] = "xxxxx";
req.method = "POST";
logInfo("All parameters set");
req.body = '<soapenv:Envelope xmlns:sms="/sms" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">'+
' <soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:UsernameToken wsu:Id="UsernameToken-xxxx"><wsse:Username>UserWs</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">xxxx=</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">xxxx==</wsse:Nonce><wsu:Created>2020-03-13T10:30:36.407Z</wsu:Created></wsse:UsernameToken></wsse:Security></soapenv:Header>'+
'<soapenv:Body>'+
'<sms:sendSmsRequest>'+
'<sms:fieldsTemplate>'+
'<sms:id>lang</sms:id>'+
'<sms:value>nl_NL</sms:value>'+
'</sms:fieldsTemplate>'+
'</sms:sendSmsRequest>'+
'</soapenv:Body>'+
'</soapenv:Envelope>';
logInfo(req.body);
req.execute();
logInfo("Req executed")
var resp = req.response;
var xmlRes = new XML(String(resp.body).replace("<?xml version='1.0'?>",""));
logInfo(xmlRes)
//cnx.dispose();

 

 

Audit log

 

03/17/2020 8:43:35 AM Workflow finished
03/17/2020 8:43:35 AM js tion is org.apache.wss4j.common.ext.WSSecurityException: The message has expired</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
03/17/2020 8:43:35 AM js <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Client</faultcode> <faultstring xml:lang="en">The message has expired; nested excep
03/17/2020 8:43:35 AM js Req executed
03/17/2020 8:43:35 AM js INT-150012 The HTTP query returned a '' type error (500)

 

I already added the entry under in serverconf.xml

 

</urlPermission>

<url dnsSuffix="xxxx" urlRegEx="https://.*" />
</urlPermission>

 

Does the timezone difference in our server and the req.header["Host"] = "xxxxx"; server makes this kind of problem ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Darren_Bowers

The 500 error is coming from your destination system. It looks like your request is working but the system you are requesting data from is throwing a 500 error. The hints will be in the nested exception details.

Issues like this during auth can occur when system clocks are out by too much, etc

I would contact the admin for the SMS system you are trying to send messages through and debug from there

2 replies

ANEESHUNAuthor
March 17, 2020
Does the timezone difference in our server and the req.header["Host"] = "xxxxx"; server makes this kind of problem ?
Darren_Bowers
Darren_BowersAccepted solution
Level 9
March 17, 2020

The 500 error is coming from your destination system. It looks like your request is working but the system you are requesting data from is throwing a 500 error. The hints will be in the nested exception details.

Issues like this during auth can occur when system clocks are out by too much, etc

I would contact the admin for the SMS system you are trying to send messages through and debug from there

ANEESHUNAuthor
March 18, 2020

Hi Darren,

 

But this same request works fine from the SOAP UI that confuses me. 

"System clocks are out by too much" by this do you mean my campaign on-premise server timezone and the SMS system server timezone might be different..

 

Regards

Aneesh