0

I am using SOAP UI open source. In this version we don't have the option to create xpath like in pro version so I created the xpath using different tool and tried to transfer properties in my test cases. But SOAP UI is unable to locate the properties. How can I transfer the properties using xpath in SOAP UI?

Here is my XML and the xpaths...

SOAP Request#1

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:rad="http://schemas.datacontract.org/2004/07/Radixx.ConnectPoint.Request" xmlns:rad1="http://schemas.datacontract.org/2004/07/Radixx.ConnectPoint.Security.Request">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:RetrieveSecurityToken>
         <!--Optional:-->
         <tem:RetrieveSecurityTokenRequest>
            <rad:CarrierCodes>
               <!--Zero or more repetitions:-->
               <rad:CarrierCode>
                  <rad:AccessibleCarrierCode>FZ</rad:AccessibleCarrierCode>
               </rad:CarrierCode>
            </rad:CarrierCodes>
            <rad1:LogonID>qwere</rad1:LogonID>
            <rad1:Password>123123</rad1:Password>
         </tem:RetrieveSecurityTokenRequest>
      </tem:RetrieveSecurityToken>
   </soapenv:Body>
</soapenv:Envelope>

SOAP Rsponse#1

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <RetrieveSecurityTokenResponse xmlns="http://tempuri.org/">
         <RetrieveSecurityTokenResult xmlns:a="http://schemas.datacontract.org/2004/07/Radixx.ConnectPoint.Security.Response" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:Exceptions xmlns:b="http://schemas.datacontract.org/2004/07/Radixx.ConnectPoint.Exceptions">
               <b:ExceptionInformation.Exception>
                  <b:ExceptionCode>0</b:ExceptionCode>
                  <b:ExceptionDescription>Successful Transaction</b:ExceptionDescription>
                  <b:ExceptionSource>RetrieveSecurityToken</b:ExceptionSource>
                  <b:ExceptionLevel>Success</b:ExceptionLevel>
               </b:ExceptionInformation.Exception>
            </a:Exceptions>
            <a:SecurityToken>8bbd61ca-a976-417a-ab4e-04911be12468</a:SecurityToken>
         </RetrieveSecurityTokenResult>
      </RetrieveSecurityTokenResponse>
   </s:Body>
</s:Envelope>

SOAP Request #2

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:rad="http://schemas.datacontract.org/2004/07/Radixx.ConnectPoint.Request" xmlns:rad1="http://schemas.datacontract.org/2004/07/Radixx.ConnectPoint.TravelAgents.Request">
      <soapenv:Body>
      <tem:LoginTravelAgent>
         <!--Optional:-->
         <tem:LoginTravelAgentRequest>
            <rad:SecurityGUID>ec800955-a52c-4267-bbfd-e3b473727307</rad:SecurityGUID>
            <rad:CarrierCodes>
               <!--Zero or more repetitions:-->
               <rad:CarrierCode>
                  <rad:AccessibleCarrierCode>FZ</rad:AccessibleCarrierCode>
               </rad:CarrierCode>
            </rad:CarrierCodes>
            <rad1:IATANumber>222222</rad1:IATANumber>
            <rad1:UserName>apipml</rad1:UserName>
            <rad1:Password>test</rad1:Password>
         </tem:LoginTravelAgentRequest>
      </tem:LoginTravelAgent>
   </soapenv:Body>
</soapenv:Envelope>

xpath for property transfer from SOAP RESPONSE1 to SOAP REQUEST2

property name- security.token

Xpath#1

declare namespace s = "http://schemas.xmlsoap.org/soap/envelope/" /s:Envelope/s:Body/RetrieveSecurityTokenResponse/RetrieveSecurityTokenResult/a:SecurityToken

Xpath#2

declare namespace s = declare namespace ns1= "http://schemas.xmlsoap.org/soap/envelope/" s: soapenv:Envelope/soapenv:Body/tem:LoginTravelAgent/tem:LoginTravelAgentRequest/rad:SecurityGUID

  • Can you post your XML and XPath? – Paul Muir Mar 29 '16 at 17:24
  • yes , i am uploading the xml and the xpath – Abhinav May 24 '16 at 6:20
3

Here is how I would do it.

Looks like you made a trivial mistake in the xpath.

Here is how the test case is defined with following test step names.

  1. Soap Request Test step named as Test Request
  2. Property Transfer Test step
  3. Second Soap Request Test step named as Test Request2

Here is how Property Transfer test step is defined. Added a property using by clicking on +, and named it id which you would see on the left side and also in the botton once result is evaluated which is also marked.

Source : Test Request and Property : Response - What it means is that reading first test step and I want to select the given xpath on the Response

Xpath : //*:RetrieveSecurityTokenResponse/*:RetrieveSecurityTokenResult/*:SecurityToken

Target : Test Request2 and Property : Request - It means that the evaluated xpath value should be updated from source to target xpath.

Xpath : //*:LoginTravelAgent/*:LoginTravelAgentRequest/*:SecurityGUID

Here is how it appears: enter image description here

  • thnx so much rao for such a detailed ans... – Abhinav Jul 31 '16 at 15:54
  • @Tester, appreciate if you accept it as an answer. – Rao Aug 1 '16 at 4:05
0

I do it without a namespace, like this:

    //*[local-name()='RetrieveSecurityTokenResponse']/*[local-name()='RetrieveSecurityTokenResult']/*[local-name()='SecurityToken']/text()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.