SOAP / REST Web Service Calls

code
activities

#1

I’m trying to call a web service from UiPath and unable to get it working. The Web Service has a header and a body that get exposed to UiPath when you use the SOAP object in your script. Can anyone provide some guidance or an example of how to call a web service using either SOAP or REST that includes formatting and passing a HEADER and BODY in the call?


#2

Have you checked out the videos on https://www.uipath.com/tutorials ? Sorry if that doesn’t cover the particular question you have.


#3

@richarddenton SOAP does not support changing the request header or body and it is not easy to implement.
Right now, the only workaround is to create your own custom activities on top of that web service… Or, maybe, @Lavinia or @Alex_Vasile have other idea.


#4

Even though it is quite hard, you can follow this example. Make a POST HTTP request to http://www.holidaywebservice.com/Holidays/US/USHolidayService.asmx and include in the body a SOAP Envelope as raw text/xml:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
<GetHolidaysAvailable xmlns="http://www.27seconds.com/Holidays/US/" />
  </soap12:Body>
</soap12:Envelope>

This way you can get the same response. You can try to modify this as per your needs, maybe it works.


#5

Thanks for the response. Do you have a sample script or code example that I can use to see how this is done?


#6

Yes, the videos are out-dated and don’t address headers and XML-based arguments. Only simple string arguments.


#7

@ddeneau, @richarddenton

We analyzed and the feature is not simple to implement. We’ll see what we can do for Q4 this year. Right now is under consideration.

However, during the research we came to an convenient solution of generating custom activities on top of a web service.


#8

Alex, can you please provide some more guidance on how to include a SOAP envelope in the body of a HTTP request? I have intercepted requests between an app on my phone and a web service and would like to replicate the request via UiPath.


#9

Have you ever considered using SOAP UI?


#10

Hi @Alex_Vasile
I am trying to give soap envelop in http activity’s body section. I set the body format as xml and pasted soap envelop in body. But i am receiving compiler error “xdocument cannot be converted to string”. seems like it’s expecting a string in body even though we specify type as xml in body format. when i enclose xml inside double quotes, i still get error since there are alredy double quotes inside my soap envelop. i also tried to create a variable of system.xml.linq.xdocument and assign xml in a assign activity and using this variable with tostring function inside http body. But i am getting error cannot assign type system.xml.linq.xdocument to system.xml.linq.xdocument in assign activity. Can you help how to proceed with this concept.