Passing object variables through a SOAP Request

soap

#1

I’m trying to access a certain web service for a robot I’m building, but the call requires an object containing a user name and password as its properties. I’ve been told it’s possible, and I tried creating a custom variable type based on the required object type, but I can’t figure out how to set its properties.

How can I make this work using UiPath?

The image below includes the new SOAP Request screen in UiPath, the XML structure of the command viewed in SoapUI, and working code for Visual Studio (C#) that successfully retrieves the data.


#2

@rpaTM,

If it is possible then you can create individual objects for username and password, then you can pass it from the UiPath.


#3

Thanks for taking the time to reply.

The SOAP service I’m trying to connect to requires an specific object that contains two strings. It doesn’t work when just passing in two strings. Of course, it’s all XML based, so I would imagine that any object matching the same format would work, but I don’t know how to do that in UiPath.


#4

@rpaTM, have you figured this out ?
I’ve the same problem …


#5

Hi all, did anyone find an answer? Thank you.


#6

I had this issue, so i used the http request instead of the SOAP request activity in studio.
Then you are able to define the body of the request.

If the two variables defined in UiPath studio you can just add them to the body of the request:

<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header/>
	<soapenv:Body>
		<!--Optional:-->
		<username>" + variableInStudio + "</username>
		<!--Optional:-->
		<password>" + variableInStudio + "</password>
		</soapenv:Body>
		</soapenv:Envelope>

Hope this helps

If the password is of type secure string, use this:

New System.Net.NetworkCredential(string.Empty, yourPassword).Password


#7

I’ve the same problem with a method of WebService that takes a complex object as Input like :

WebService : carManagement.wsdl
method : addCarModel( CarModel )
With CarModel an object :
CarModel

  • ID
  • Name
  • Constructor
  • Options
    – Option 1
    — Option Name
    — Option price
    […]

How can i call this WebService without building the complex XML payload by hand?

UIPath Studio manage to read the WSDL and i can select the method, it allow me to create a variable with “CarModel” as a type but I don’t manage to set the data into this object and if I close the project and re-open it I’ve an error saying “CarModel object not found”