首页 > 解决方案 > 如何使用groovy在soapUi中的所有请求中添加自定义安全标签

问题描述

我必须在标头内的所有请求中插入安全标签。我如何实现自动化?因为对于每个请求,我都必须手动复制过去,这需要时间来完成所有请求

以下是实际请求:

   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ws="http://ws.test.sample.com/" xmlns:ws1="http://ws.test.sample.com/">         
    <soapenv:Header>
    </soapenv:Header>

添加安全标签后:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:ws="http://ws.test.sample.com/" xmlns:ws1="http://ws.test.sample.com/">  
    <soapenv:Header>
          <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://doc.test.xsd">
           <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://doc.test.xsd">
           <wsse:Username>test</wsse:Username>
           <wsse:Password Type="http://doc.test.xsd">o9j1/hA/mkFTG0ODti</wsse:Password>
          </wsse:UsernameToken>
        </wsse:Security>
    </soapenv:Header>

标签: soapgroovyautomationsoapui

解决方案


推荐阅读