在Jmeter中使用Xpath提取器捕获响应

时间:2019-10-04 01:36:33

标签: xpath jmeter

我需要使用jmeter中的xpath提取器从下面的XML响应中提取uuid。有人可以帮我这个表情吗?

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="schemas.xmlsoap.org/soap/envelope/" xmlns:awsse="xml.test.com/2010/06/Session_v3" xmlns:sca="www.w3.org/2001/05/addressing"><soap:Header><sca:To>www.w3.org/2005/08/addressing/anonymous</sca:To><sca:From><sca:Address>nodeA1.test.webservices.test.com/1ASIRFCUCPA</sca:Address></sca:From><sca:Action>webservices.test.com/test_Shopping_18.1</sca:Action><sca:MessageID>urn:uuid:ba154abc-636c-33b4-3947-6b50651b3f5b</sca:MessageID><sca:RelatesTo RelationshipType="www.w3.org/2005/08/addressing/reply">urn:uuid:55c875fa-bda3-461e-aa06-56c28f11ad38</sca:RelatesTo>

1 个答案:

答案 0 :(得分:0)

假设您正在寻找MessageID

  1. 您可以使用XPath name()函数提取类似urn:uuid:ba154abc-636c-33b4-3947-6b50651b3f5b的值。相关表达式为:

    (//*[name() = 'sca:MessageID'])/text()
    

    enter image description here

  2. 如果只需要这ba154abc-636c-33b4-3947-6b50651b3f5b部分,请使用substring()函数,例如:

    substring((//*[name() = 'sca:MessageID'])/text(),10)
    

    enter image description here

更多信息: