header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
September 06, 2008, 07:12:37 pm
Username: Password:
Login with username, password and session length

Forgot your password?
 
Latest posts of: Adam White
Welcome, Guest. Please login or register.
September 06, 2008, 07:12:37 pm
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

  Show Posts
Pages: [1]
1  soapUI / soapUI / Re: Help getting node value with groovy script on: May 17, 2008, 11:57:46 pm
Awesome, that worked.  A lot better than my hacked way below of getting it.

def requestString = request.toString()
def length = requestString.size()
def iStart = requestString.indexOf('ServiceProviderEnrolmentReference')
iStart = iStart + 34
def iEnd = requestString.lastIndexOf('ServiceProviderEnrolmentReference')
iEnd = iEnd - 2
def enrolmentId = requestString.substring(iStart, iEnd)

Thanks.
2  soapUI / soapUI / Help getting node value with groovy script on: May 17, 2008, 12:54:48 am
Hi,

I'm having trouble accessing a node value, I keep getting null returned.  I'm using the free version of SoapUI to prove what we need to do can be done, but I'm having trouble getting it to work.

The groovy script below is for a Mockservice.  I'm trying to access a value from the request and send back a response based on a node value.

The XML Request is:
<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" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <soap:Header>
      <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext" soap:mustUnderstand="0">
         <wsse:UsernameToken>
            <wsse:Username>ccmsUser</wsse:Username>
            <wsse:Password Type="wsse:passwordText">ccmsPassword</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
      <ProcessingInstructions xmlns="http://website.com/interfaces">
         <IncludeEmptyElements>Y</IncludeEmptyElements>
      </ProcessingInstructions>
   </soap:Header>
   <soap:Body>
      <FaCSIAEnrolmentInterface_QueryEnrolments_Input xmlns="http://website.com/interfaces">
         <EndDateEmpty xsi:nil="1"/>
         <ServiceProviderEnrolmentReference>2</ServiceProviderEnrolmentReference>
         <PageNumber>1</PageNumber>
         <Status xsi:nil="1"/>
         <StartDateFrom xsi:nil="1"/>
         <EndDateFrom xsi:nil="1"/>
         <PageSize>10</PageSize>
         <SourceSystemCode>1-I6TS</SourceSystemCode>
         <Type xsi:nil="1"/>
         <CCBApprovalId>232432</CCBApprovalId>
         <StartDateTo xsi:nil="1"/>
         <EndDateTo xsi:nil="1"/>
         <FACSIAEnrolmentId xsi:nil="1"/>
         <TransactionId>27E1460B-A5B9-4082-9968-235AAE728C22</TransactionId>
         <UpdatedSince xsi:nil="1"/>
      </FaCSIAEnrolmentInterface_QueryEnrolments_Input>
   </soap:Body>
</soap:Envelope>

My groovy script is:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )

//return holder.getNodeValue( "//wsse:Username" )
return holder.getNodeValue( "//ServiceProviderEnrolmentReference" )
def sper = holder.getNodeValue( "//ServiceProviderEnrolmentReference" )


if (sper == "1")
   return "Response 1"
else if (sper == "2")
   return "Response 2"
else
return "Response 1"

The line return holder.getNodeValue( "//wsse:Username" ) works and returns a response.  But holder.getNodeValue( "//ServiceProviderEnrolmentReference" ) returns null.  If I change the node to anything contained within the <soap:body> tags I get null.

Can you tell me what I'm doing wrong?

Thanks,
Adam
Pages: [1]


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header