SOAP Request - Issue with the output format returned by the web service

I am trying to invoke a web service (XXXXXX.svc?wsdl) using SOAP Request activity. The web service accepts input and returns output as an object (custom data type, i.e. XML format).

I tried setting the following in the SOAP request activity.
End point:
Contract Name:
Method:
Parameters: I have defined a variable of type ‘Object’ and assigned the input values (i.e.XML tags) to the input parameter
Output: Defined a variable of Type String

When the XAML file is executed, the SOAP request is invoked and the output returned is just the namespace. The actual XML output is not appearing.

Please note that when the same SOAP request is tested using SOAP UI, it returns the output in XML format as expected.

When changing the Output variable type as Object, compilation error pops up. I believe SOAP request in UiPath stores the output only as String. But it does not store the entire XML output as string, and that is the problem.

Can you please suggest how to overcome the problem stated above ?

I have submitted a ticket for this issue as well.

I have been trying to figure out a work around or something, but no luck.

Has anyone been able to get SOAP Request to work correctly?

WSDL: http://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl
method: CheckPhoneNumber
params: PhoneNumber: 7575449510
LicenseKey: F01d89fd-5155-5455-5585-e84ab8de8591

UiPath returns: ws.cdyne.com.PhoneVerify.query.PhoneReturn

SOAPUI returns:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
  <CheckPhoneNumberResponse xmlns="http://ws.cdyne.com/PhoneVerify/query">
     <CheckPhoneNumberResult>
        <Company>Please Purchase a license key or email us for a test key.</Company>
        <Valid>false</Valid>
        <OriginalNumber>7575449510</OriginalNumber>
        <CleanNumber>7575449510</CleanNumber>
        <Wireless>false</Wireless>
     </CheckPhoneNumberResult>
  </CheckPhoneNumberResponse>
   </soap:Body>
</soap:Envelope>

Also the LicenseKey is optional, so leaving it blank in UiPAth results in an error:

“Exception has been thrown by the target of an invocation.”

leaving in blank in SOAPUI results in:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CheckPhoneNumberResponse xmlns="http://ws.cdyne.com/PhoneVerify/query">
         <CheckPhoneNumberResult>
            <Company>LEVEL 3 COMMUNICATIONS. LLC -</Company>
            <Valid>true</Valid>
            <Use>Assigned to a code holder for normal use.</Use>
            <State>VA</State>
            <RC>PARKSLEY</RC>
            <OCN>8825</OCN>
            <OriginalNumber>7575449510</OriginalNumber>
            <CleanNumber>7575449510</CleanNumber>
            <SwitchName>NORFOLK</SwitchName>
            <SwitchType/>
            <Country>United States</Country>
            <CLLI>CHSKVAAYDS0</CLLI>
            <PrefixType>CLEC - (Competitive Local Exchange Carrier)</PrefixType>
            <LATA>252</LATA>
            <sms>CLEC - (Competitive Local Exchange Carrier)</sms>
            <Email/>
            <AssignDate>23/10/2005</AssignDate>
            <TelecomCity>Chesapeake</TelecomCity>
            <TelecomCounty/>
            <TelecomState>VA</TelecomState>
            <TelecomZip>23324</TelecomZip>
            <TimeZone>EST</TimeZone>
            <Lat/>
            <Long/>
            <Wireless>false</Wireless>
            <LRN>7576559199</LRN>
         </CheckPhoneNumberResult>
      </CheckPhoneNumberResponse>
   </soap:Body>
</soap:Envelope>

I am also having a similar issue. Provided Input via the Parameter property and created a String variable for output. When executing the SOAP request get the below error,

Yes, I have the same issue. It seems UiPath could only get the type of returned output…

Hi everyone,

SOAP activity not handling complex outputs is a known issue and will be addressed at one point (no specific ETA).

An alternative is to either use HTTP Request activity or to create a custom activity to perform the required SOAP request.

Is there any solution available now ?

1 Like

Hi @Ash

Welcome to our UiPath Forum! :slight_smile:

Yes! Well, kind of. The old activity for the SOAP request was not fixed, but a whole new functionality to consume SOAP and Swagger services was introduced.

See here for the official piece of documentation:
https://studio.uipath.com/docs/loading-web-services-in-libraries

And here for my blog with an example on how to use it with Orchestrator Community Edition:

Hi, Is The old activity for the SOAP request fixed? It will be great if UI Path reads complex output

I believe the old activity to be a bit outdated by today’s standards. The library service approach (as explained above) is the recommended one for SOAP services.

Thanks for the reply. Requesting you to share library service approach some sample where request & response has complex object

@ramskothamasu

Sure, have a look at a sample project that uses some random free SOAP demo service:
https://www.crcind.com/csp/samples/SOAP.Demo.CLS

SampleLibraryProject.zip (4.2 KB)

1 Like

Shared details are so helpful. Thank you so much. I am able to read parameters but unfortunately i am unable to read complex type (Output). I am getting error as below.

1 Like

I see.

It should work if you create an array of the type that I marked here:
image
(so not String[], but something like OSCPWSimpleService.CustIdInfo[]

I don’t think you need an array of arrays here.

If this works, you can start working on trying to cast your values to a string so that you can put it in the String Array.

It is always a bit tricky without having access to your IntelliSense hints, but the gist of it is that you will have to start with custom classes of your SOAP service and find a method in there that allows you to pull out simple strings (or other, more common types).

Could you maybe upload a bit higher resolution images? :slight_smile:

1 Like

Does it maybe give more hints as to what is going on when you click on the Details here:
image

Could it be that this need to have assigned some values with an Assign activity after it has been initialized?

I need to print java:CustID & java:CustIDType values as mentionedin SOAP Response. This is what i am facing issue. As per wsdl file these two values stores in CustIdInfo Object as mentioned below:

<xs:complexType name=“CustIdInfo”>
xs:sequence
<xs:element type=“xs:string” name=“CustID” nillable=“true” minOccurs=“1”/>
<xs:element type=“xs:string” name=“CustIdType” nillable=“true” minOccurs=“1”/>
</xs:sequence>
</xs:complexType>

I think this happens because this value is not initialized in Studio code (or is it?):
image

It can’t see the full string here, but a simple
image
only initialized the generic input object, which you then have to make more specific.

Could you try with a simple assign activity?
Something like:

input.NameOfTheProperty = x

or similar, where x is your 99999999 and it can either be a simple string or another class you will have to initialize and assign a value to.

Yes, never mind my previous reply.

So, if I got it right, it looks like you have the output and Cust variables that are not linked to each other:

(unless the assign activity that assigns the array of CustId[] from output to the Cust variable is somewhere not on the screenshot)

Ideally, you would ‘navigate’ to your array directly from the output variable. Is this not possible?

The first step would be to find out how to navigate to the array directly from your output variable

With a simple Write line, try to ‘navigate’ to your array and count its records with a .Count.ToString.

When you get a count of array elements, you should be able to use the same syntax in the For Each loop (minus the .Count.ToString part) that has the argument set to the type you are iterating
(I can explain more when needed and when we get there)

I tried a bit more with the example SOAP service, see here:

It is also possible to print all to 1 long string like so:


String.Join(", ",output.GetListByNameResult.Select(function(x) x.name.tostring))

Could you see my now edited post above for hints? :slight_smile:

What does the Output panel show for something like this?

output.return.CustId.ToString