SOAP message function | HTTP 500 Error

Felipe Morais
Tera Contributor

Hello guys,

I am facing an issue with connecting SAP/SOAP services. When I test my SOAP message function i get an 500 Error the response is the following:

FelipeMorais_2-1700233430608.png

FelipeMorais_3-1700233504287.png
When I comment line 84, the HTTP status is 200, so the 500 Error comes from the Entertime variable.

From what I could get from the error message (first image), the 3rd-party expects to receive a DateTime value, but they receive a String value instead.

I suppose that it has to do with how the type of the parameter Entertime is defined. In the SOAP message, the "type" of Entertime is time, but for all other variables, its defined as string type, but I'm not sure why.
FelipeMorais_0-1700233385144.png

 

In the UI Action (button) that calls the service, some variables are defined with the "setStringParameterNoEscape" function**. 

FelipeMorais_5-1700234260089.png

So I tried to add this code snipplet (circumscribed in red) to define the Entertime as a parameter of the type DateTime/Time (as i was supossed to be) using GlideTime() and GlideDateTime() methods, but both didn't work.

** But i could not find where this "setStringParameterNoEscape" function is defined in the instance.

What am I missing here? I think maybe the setStringParameterNoEscape function forces the Entertime to be a string, but I'm not sure.

Thanks,

FLM

 

4 REPLIES 4

harshav
Tera Guru

I believe when you send the GlideDateTime() servicenow sends the date in default system format (YYYY-MM-DD HH:MM:SS), please check with your thirdparty team what is the format accepted and convert your datetime to that format.

The thing is, before I add the code snippet which includes the "GlideDateTime()" I was facing the same issue. I only shared this to show what i have tried to solve the problem, and to show it did not work. But I'll check with the 3rdparty what is the expected format. Thanks!

The expected format is the following

FelipeMorais_1-1700236854548.png

 

Prabu Velayutha
Mega Sage
Mega Sage

Hi @Felipe Morais 

 

SetString parameter is defined in the SOAP Message script include which comes OOB.  You can customize by copying this if needed and use it in your SOAP message call. Please refer the screenshot below of the OOB SOAP Message script include.

 

PrabuVelayutha_0-1700473301391.png

 

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers!