Set the HTTP status in scripted soap

peg612
Giga Contributor

I am working on a scripted soap message and am trying to figure out how to set the HTTP status and show there is an error. I am able to do it in REST without issues but I do not see any documentation for how to do it in SOAP. Has anybody done this before?

5 REPLIES 5

vab_13
ServiceNow Employee
ServiceNow Employee

If you want to send back a custom error code in SOAP response of scripted SOAP WS: below will help:


SOAP in ServiceNow: Practice and Learn



find_real_file.png


find_real_file.png



hth


peg612
Giga Contributor

Thank you for the document. I am already sending back a custom response but I am trying to figure out how to set the http status. How do I set the http status in the response?


Hi Paul,



I don't think you can set the http status for scripted soap. you can do that for scripted rest.


RESTAPIResponse - setStatus(Number status)



Try using scripted rest to get complete control over your response



Changing soap response header in scripted webservice



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Paul,



Any update on this?


Could you mark the answer as correct, helpful and hit like if you were able to achieve the requirement. This also helps in removing the question from unanswered list. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader