Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Use Groovy to Parse a URL in Which Searching Critiria Are Embedded in the Path

 
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am completely new to the Groovy.

thanks for your time and help in advance.

I am using soapUI mock service and trying to write a Groovy script. The request query URL I receive looks like:

http://{host}:{port}/readwrapper/historicalData/medicalHistory/STR/888888_2.16.840.1.113883.3.42.10012.100001.206_h0102a3727570b14038b349136f2a5fd58e0102

and the search criteria are embedded in the above URL. The search criteria that I am trying to extract from this URL are
A. 2.16.840.1.113883.3.42.10012.100001.206 which is the communityID
B. h0102a3727570b14038b349136f2a5fd58e0102 which is the document ID

All I am able to code in Groovy is:

and I do not know how to proceed further. Please help.
 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that there is a solution but I am still unclear about the index of the "tokenize()" method.


The long string 888888_2.16.840.1.113883.3.42.10012.100001.206_h0102a3727570b14038b349136f2a5fd58e0102 that is tokenized, there are two delimiters; i.e., '_' and three parts.

I think if I want the last part, I should do:


What if I want the first part and the second part? Which indexes are they? Thank you very much.

 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that there is a solution but I am still unclear about the index of the "tokenize()" method.


The long string 888888_2.16.840.1.113883.3.42.10012.100001.206_h0102a3727570b14038b349136f2a5fd58e0102 that is tokenized, there are two delimiters; i.e., '_' and three parts.

I think if I want the last part, I should do:


What if I want the first part and the second part? Which indexes are they? Is the first part parts[0] and the middle part parts[1]? Thank you very much.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic