Forum Discussion

khader_bza's avatar
khader_bza
New Contributor
16 years ago

How to capture Webservice request and response message

Hi,

I am testing two orders in one test suite.
Pushing the orders at remote server, server generates orderid,order status and sends back to soapUI Mock service window as request and response messages

Test step:1 After pushing the order

Request message appears on MOCK service window with valid order id XXXX.
Response message appears on MOCK service window with order status "completed"

If valid id:XXXX and order status"completed" are available, process second testcase, otherwise stop the execution of first testcase

Anybody help or guide me how to process this in soapui.

2 Replies

  • shbgupta_2000's avatar
    shbgupta_2000
    Occasional Contributor
    Hi,

    Use groovy script and property transfer is slove your problem.

    after first response and add the transfer properties (in source tab call namespace declare and the response xpath element and point to next test case request object in the target)

    ex:
    in the propert transfer and one variable
    source textbox
    select the source combo box as firsttestcase and property select the response
    declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
    declare namespace ns1='.....'
    //ns1:orders//ns1:orderno

    target textbox
    select the target select as secondtestcase name and property select the request
    declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
    declare namespace ns1='http://abc.com' ';
    //ns1:Cancelorders//ns1:ordernoNo


    in the grovvy script
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder("testcasename#Response")
    def orderno =holder.getNodeValue("//ns1:orders//ns1:orderNo") //we are excepting order no should be >0 number
    if(status >0)
    {
    testRunner.runTestStepByName( "endTestcase") //create the grovovy script at the end of the test steps and named as 'endtestcase'
    }

    in the 'endtestcase ' testcase step (it's groovy script)
    testRunner.cancel(properties.getPropertyValue("errorMessage"))

    Thanks
    SHBGupta
  • khader_bza's avatar
    khader_bza
    New Contributor
    Hi,

    I am pushing two orders to remote sever from soap UI one by one.Two orders (i.e test cases)in one test suite


    1) Test case No: 1
    Step: 1
    Trigger the create subscriber order xml to remote server from soap UI (http://10.65.60.13:7001/PsaGateway/services/Transaction)
    Step: 2
    There are two responses available for this order in MOCK service window.Check first response parameter responderOperation ID: XXXX .
    Step 3
    Check the order status in the second response in the MOCK services window.If “ORDER STATUS” parameter is “COMPLETED” and first response responderOperation ID: XXXX available go to 2nd test case otherwise failed the this test case


    2) Test case No: 2

    Prerequisite: Create Subscriber order should complete
    two seperate responses available in MOCK service window
    Step: 1
    Trigger the policy subscriber order xml to remote server from soap UI (http://10.65.60.13:7001/PsaGateway/services/Transaction)
    Step: 2
    Check the parameter responderOperation ID: XXXX in first received response in the MOCK services window. After this second response appear at MOCK service window
    Step 3
    Check the order status in the second response in the MOCK services window.If “ORDER STATUS” parameter is “COMPLETED” and first response responderOperation ID: XXXX available complete the test case otherwise failed the policy test case

    Anybody help or guide me how to process this in soapui.