locked
Read WS Request 1 response XML attribute value and pass to Request 2 as one of the Parameter in WebTest RRS feed

  • Question

  • Hi,

    I have a WCF service,all i have to do is to invoke a method X of the WCF service in WebTest.In order to invoke X method i need few inputs that can be retrieved by invoking Z method of the same WCF service and extract the XML response attributes value and pass it to method X as parameter.

    Can some one help he how to achieve this?

    Thanks,

    Raj


    Tuesday, February 26, 2013 6:52 AM

Answers

  • Thanks for Adrian’s help

    Hi,

    About this issue, I’m afraid that you would create a Custom Extraction Rule like this.

    Like Yutong’s suggestion in this thread “Extract data values from XML Response”.

    In the Extract function, check the nodes in e.Response.XmlDocument, and extract the value into web test context for subsequent usage.

    Hope it could help.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 27, 2013 11:15 AM

All replies

  • Raj, make the web test first visit Z. Write an extraction rule to get the data from the Z-responses and save into one or more context parameters. Then use these parameters in the invocation of X.

    Searching MSDN and the web will find lots of information about "extraction rules" and "context parameters".

    Regards

    Adrian

    Tuesday, February 26, 2013 7:48 AM
  • Sorry i was not able to find any reference related to my situation.I have a coded webtest having 2 webrequests.I need to extract some values from Request1 XML response and pass the value to Request2 as input parameter.


    request 1 response:

    i need to read "b87fcd25-0beb-42e8" value from the resonse XML and pass it to Request 2.

    <?xml version="1.0" encoding="utf-8"?>
    <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">
      <soap:Body>
        <ReadLogResponse xmlns="http://www.xxx.com/xxx/xxx">
          <ReadLogResult>
                <Logs>
                <Log FieldID="F_1" Status="enabled" ID="b87fcd25-0beb-42e8" />
              </Logs>
          </ReadLogResult>
        </ReadLogResponse>
      </soap:Body>
    </soap:Envelope>

    Tuesday, February 26, 2013 7:49 PM
  • Thanks for Adrian’s help

    Hi,

    About this issue, I’m afraid that you would create a Custom Extraction Rule like this.

    Like Yutong’s suggestion in this thread “Extract data values from XML Response”.

    In the Extract function, check the nodes in e.Response.XmlDocument, and extract the value into web test context for subsequent usage.

    Hope it could help.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 27, 2013 11:15 AM
  • Hi Jack,

    Thanks for the info.After 2 day of struggle finally it worked.I created Custom Extraction Rule and that did the magic.

    Thanks,

    Raj

    Wednesday, February 27, 2013 8:43 PM