cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture multiple lines response using groovy script

Occasional Contributor

How to capture multiple lines response using groovy script

Hello All,

 

I have below xml response and want to capture/store all the data from same using groovy script.

I dont know how to store it. Can anyone please help me a bit new to coding. I want to capture each element like C14, J0 and so on.

 

<Response>ADDCAN 788 C14 J0 D2 P0 Z0 I0 R0 Y0
G0 S0 X0 B0 M2 K0 L0 V3
H9 U4 Q0 T0 W0 E0 O0 N0
TTL 34</Response>

 

Below is the response : 

 

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<eb:MessageHeader eb:version="1.0" soap-env:mustUnderstand="1" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader">
<eb:From>
<ebSmiley TongueartyId eb:type="URI">Server</ebSmiley TongueartyId>
</eb:From>
<eb:To>
<ebSmiley TongueartyId eb:type="URI">Client</ebSmiley TongueartyId>
</eb:To>
<eb:CPAId>IPCC</eb:CPAId>
<eb:ConversationId>9DB7_921682_1204548352874</eb:ConversationId>
<ebSmiley Frustratedervice>SabreCommandLLSRQ</ebSmiley Frustratedervice>
<eb:Action>SabreCommandLLSRS</eb:Action>
<eb:MessageData>
<eb:MessageId>362528217345300870</eb:MessageId>
<eb:Timestamp>2019-09-25T06:02:14</eb:Timestamp>
<eb:RefToMessageId>mid:1</eb:RefToMessageId>
</eb:MessageData>
</eb:MessageHeader>
<wsseSmiley Frustratedecurity xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">Shared/IDL:IceSess\/SessMgr:1\.0.IDL/Common/!ICESMS\/STSB!ICESMSLB\/STS.LB!-2970499087114656116!453481!0</wsse:BinarySecurityToken>
</wsseSmiley Frustratedecurity>
</soap-env:Header>
<soap-env:Body>
<SabreCommandLLSRS Version="1.0" xmlns="http://webservices.sabre.com/sabreXML/2003/07">
<Response>ADDCAN 788 C14 J0 D2 P0 Z0 I0 R0 Y0
G0 S0 X0 B0 M2 K0 L0 V3
H9 U4 Q0 T0 W0 E0 O0 N0
TTL 34</Response>
</SabreCommandLLSRS>
</soap-env:Body>
</soap-env:Envelope>

 

Thanks in advance .....

 

Dinesh

 

5 REPLIES 5
Occasional Contributor

Re: How to capture multiple lines response using groovy script

Hi All,

 

Any thoughts on my query

Community Hero

Re: How to capture multiple lines response using groovy script

what is your use case?


Regards,
Rao.
Occasional Contributor

Re: How to capture multiple lines response using groovy script

I am trying to capture all the values as stated in my query. Didn't understand what do you expect in as use case.

Could you please explain in detail.

Community Hero

Re: How to capture multiple lines response using groovy script

Occasional Contributor

Re: How to capture multiple lines response using groovy script

Hi Rao, Thanks for your support. I tried your script and able to split the multiple lines data, but how to set a particular data.

 

Below is my actual response :

  • Mon Nov 04 12:01:57 IST 2019:INFO:AM FACTS 1.SSR GSTN AM HK1/IND/22SSSSAAA0 1.1 UHVNKSK/KGRXXZ 0A1Z5/IBM/S 2.SSR GSTN AM HK1/IND/22DDDDDDDD 1.1 UHVNKSK/KGRXXZ DD1Z5/IBM/P

and I want to capture and set below data from above response :

1.SSR GSTN AM HK1/IND/22SSSSAAA0

 

then how to capture and set that.

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors