Executing different SOAP request's based on input field value

Hello,

I have to design a pipe line which is based on SOAP request. I have the wsdl. This is my first SOAP pipeline I have few queries.
The SOAP Execute snap has three fields

  1. Service Name 2) Endpoint . 3) Operation. What values I have to give here, I checked the document but its not clear to me.

The wsdl file I have has ‘ExecuteApplication’ endpoint or method. I need to execute this with request payload when the input filed $Action equal to “directory”.

I designed a pipe line like this

Here Json parser takes the input and Mapper will prepare the payload for SOAP executor. But this pipeline throwing error.
“message”: “HTTP Code: 400 Status: POST to pipeline that does not have an unlinked input view Errors: None”

Pls suggest how to execute this SOAP request .
thanks
arun

@arunnp

To achieve that, you will need two pipelines(parent/child):

1.The parent pipeline will receive the message(exposed as an API), prepare the SOAP request, and will call the child pipeline, sending the $Action as a pipeline parameter to the child pipeline.

2.The child pipeline will have the SOAP Snap inside and will receive the message from the parent pipeline. Based on the pipeline parameter($Action) sent from the parent pipeline, will decide what method to execute.

In the SOAP Snap fields you can write expressions and access pipeline parameters.

Or do you want to execute the SOAP request only if the $Action = “directory”(if the action is different than “directory” skip the calling of the SOAP request)?

Regards,
Spiro Taleski

Thanks @Spiro_Taleski for the reply.

I am planning to design the pipeline like this

JSON Parser → Router (it will check the $Action filed value) → Route to specific SOAP Execution → SOAP Response

Ex: Request → $Action is “directory” → Route to → Mapper (to prepare the SOAP Req)-> SOAP Execute snap1
Request → $Action is “file” → Route to → Mapper (to prepare the SOAP Req) → SOAP Execute snap2

The SOAP Execute snap has three fields My question is
Service Name 2) Endpoint . 3) Operation. What values I have to give here. I have “wsdl” set.

The wsdl file I have has ‘ExecuteApplication’ endpoint or method. I need to execute this with request payload when the input filed $Action equal to “directory”.

Here Json parser takes the input and Mapper will prepare the payload for SOAP executor. But this pipeline throwing error.
“message”: “HTTP Code: 400 Status: POST to pipeline that does not have an unlinked input view Errors: None”
I hope I clarified my requirement.
thanks
arun

@arunnp

Ok. You can route based on the incoming action field(using Router Snap).

So, you will have separate branches for each action.
In the SOAP Execute Snap, once you have the WSDL defined, then by clicking on the fields(screen below), the Snap will load ServiceName/Endpoints/Operation etc, based on the WSDL file.

Regarding the error message, please ensure that the pipeline has unlinked input view, or this error can happen if you have an errors in other Snaps(like Mapper or SOAP Execute).

Regards,
Spiro Taleski

1 Like

@Spiro_Taleski
Thanks for the reply. Now I am able to execute the SOAP request. But now not able to extract the particular field in the response.

[
{
“s:Body”: {
@xmlns:s”: “http://schemas.xmlsoap.org/soap/envelope/”,
“ExecuteApplicationResponse”: {
@xmlns”: “http://apd.etst.com/”,
“ExecuteApplicationResult”:"{“Return”:true,“Hint”:“Success”,“Directories”:[{“DirectoryID”:“Windows”,“DirectoryName”:“Demo }]}”
}
},
“original”: {
“language”: "en-US
}
}
]

Here I need to extract the “ExecuteApplicationResult”. I tried Mapper but not working.
I need to set the “ExecuteApplicationResult” to a “result” object. Can you pls suggest.

@arunnp

Can you please attach a response from SOAP as a file here?

Regards,
Spiro Taleski

@Spiro_Taleski resp.txt (977 Bytes)

@Spiro_Taleski , did you get chance to check the sample SOAP response file.

Hello @arunnp

The provided JSON in the ExecuteApplicationResult field it’s not valid json. The main issue is the double quotes after string “Windows”

You can try to remove it with regex, but that won’t guarantee that this will be working solution in the future.
Try to map it ExecuteApplicationResult to result and pass it like that.

Regards,
Pero Manchevski

2 Likes

Hi @arunnp ,
You can use this expression:

JSON.parse($['s:Body'].ExecuteApplicationResponse.ExecuteApplicationResult.replaceAll('Windows"', "Windows "))

This will parse all the data and transform it into JSON object, but I had to change the “Windows” part because is invalid. I removed the " from ‘Windows"’.

Result:

2 Likes

@j.angelevski @pmanchevski
Thanks for the reply. It worked for me after using JSON parse.