Forum Discussion

RaMup29's avatar
RaMup29
Occasional Contributor
7 years ago

how to define variables in SOAPUI request

I have a requirement for adding a variable to the SOAP request.

Below is the sample request.

IMSI123445 is the variable in the below request. how can i add the variable to SOAPUI?

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:siemens:names:prov:gw:SPML:2:0">
<soapenv:Body>
<spml:deleteRequest
xsi:schemaLocation="urn:siemens:names:prov:gw:SPML:2:0 prov-gw-spml-2.0.xsd"
xmlns:spml="urn:siemens:names:prov:gw:SPML:2:0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<version>SUBSCRIBER_v51</version>
<objectclass>Subscriber</objectclass>
<identifier alias="imsi">IMSI123445</identifier>
</spml:deleteRequest>
</soapenv:Body>
</soapenv:Envelope>

  • You can add a test case level custom property, say ID and provide the required value.

    In the request, use property expansion as shown below:

    <identifier alias="imsi">${#TestCase#ID}</identifier>

    In case if it needs to be dynamically generated, use groovy script and store the value at test case level.

  • nmrao's avatar
    nmrao
    Champion Level 3
    You can add a test case level custom property, say ID and provide the required value.

    In the request, use property expansion as shown below:

    <identifier alias="imsi">${#TestCase#ID}</identifier>

    In case if it needs to be dynamically generated, use groovy script and store the value at test case level.

    • RaMup29's avatar
      RaMup29
      Occasional Contributor

      Hi Rao,

      Can you pls help me define the custom properties. (Right-click on TestSteps --> Add Step --> Properties)

       

       

      After Defining the cust properties like this, i used the string mentioned below, but it didnt work

       

      <alias name="imsi" value="${#DEFINE_1#IMSI}"/>

    • RaMup29's avatar
      RaMup29
      Occasional Contributor

      It worked Rao. Many Thanks for the help