Skip to main content

Hi, I need help to trim a WS Response.

We have a Web Service configured to respond strings like this:

000000000000102Incidente creado correctamenteINC000001769286

 I need to get only the part that says: INC000001769286

I tried using de task "Set a field value" with the function fn-substring:

198167_pastedImage_2.png

and this is what I get:

198088_pastedImage_1.png

Thanks!

You can't use an inline function within a Set a field value.  Use the Build a String action to get your substring and store the results in a variable.  Then use the variable withing the Set a field value. 


which column have you updated, last one?

then it looks like content of 'txt_resultado' is little different to what you have provided.

it seems to be a XML, which is quite usual web service output.

to get a (sub)string out of XML with substring function is not correct approach . you should rather use Query XML action and specify XPath expression to pick data of interest.

so, proofcheck the output you get from web service.

if you don't mind to post that output here and explain what exactly you need to get, we might help you with that.


Hi Brendan, Thanks for your answer.

I tried building a string but I get the same result. The web service response is saved in a variable called "txt_resultado". When I insert it in a notification I can see the message OK, but when I tried to get a substring it shows the message of the last column in the screen of my first post.

For example, in this notification the variable txt_resultado has the WS response, and the variable ticket has the substring built in the way you recommended me.

198191_pastedImage_2.png

198169_pastedImage_1.png


Hi Marian, The column is the last one.

I don't believe that the answer of the WS is a XML, because when I use it in a notification I can see the message OK.

198192_pastedImage_1.png

198193_pastedImage_2.png


Marian, I have been analyzing and you're right, the response of the WS is a XML.

What I need is a XPAT expression to transform that response in text.

I'm sorry but I'm not allowed to post the complete XML.

Thank you! 


do change notification message format to plain text and let it send once again.

this way XML elements are being interpreted as markups and you do not see real result.


Hi Marian, In that way I can see the real result!

Thank you!


so you will have to fight with it on your own.

as I've written use query XML action, there is as well buit-in XPath builder. it's not always 100% reliable but it could give you at least a clue how a proper XPath expression should look like.


Reply