2015-01-02 65 views
0

SoapUI。我有一個很老的版本了SoapUI的(2.0.2版本)Soapui閱讀肥皂對用戶輸入對話框的響應

我們知道soapUI的,我們可以提出警告,並輸入對話框..

這工作的偉大..

我有以下SOAP Response並希望將該問題閱讀爲對話框。

<?xml version='1.0' encoding='utf-8'?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Body> 
    <ns1:Response xmlns:ns1="http://some.name.space.com"> 
      <ns1:payload> 
       <ns1:Question> 
        <ns1:questionText>How much is that doggie in the window?</ns1:questionText> 
       </ns1:Question> 
      </ns1:payload> 
    </ns1:Response> 
    </soapenv:Body> 
</soapenv:Envelope> 

我想讀或呈現「questionText」到測試儀..

def ui = com.eviware.soapui.support.UISupport; 
ui.showInfoMessage("Hello World"); 

但是,而不是閱讀問題(這些問題做改變),並是這樣的:

def ui = com.eviware.soapui.support.UISupport; 
ui.showInfoMessage("testStep.xmlResponse.questionText"); 

然後還要在測試器可以輸入自己的答案..

def ui = com.eviware.soapui.support.UISupport; 
ui.prompt("Input Answer","Answer"); 

感謝您的信息 - Can I pause for console input in a SOAPUI groovy script?

以下是我已經能夠迄今在此找到(不工作在這一點上):

// pulled information from: 
// http://www.soapui.org/Developers-Corner/extending-soapui.html 
import com.eviware.soapui.support.XmlHolder; 
def ui = com.eviware.soapui.support.UISupport; 
def holder = new XmlHolder (messageExchangeContentAsXml) 
holder.namespaces["ns1"] = "http://some.name.space.com" 
def node = holder.getDomName ("//ns1:Response[1]/ns1:payload[1]/ns1:Question[1]/ns1:questionText[1]") 
ui.showInfoMessage(node.questionText); 

,我在正的錯誤這一點是:

org.codehaus.groovy.runtime.metaclass.MissingPropertyExceptionNoStack: No such property: messageExchangeContentAsXml for class: Script12 

而且我認爲我應該能夠相當容易地「通過」到下一個請求。

謝謝。

回答

0

我已經想通了這一點..

從性能閱讀,我們需要如下:

​​

從SOAPUI中的響應中讀取,我們需要執行以下操作:

def ui = com.eviware.soapui.support.UISupport; 
groovyUtils = new com.eviware.soapui.support.GroovyUtils(context); 
holder = groovyUtils.getXmlHolder("TestRequest#Response"); 
holder.namespaces["ns1"] = "http://some.namespace"; 
def responseId = holder.getNodeValue("//ns1:userName"); 
ui.showInfoMessage(responseId);