0

我是 groovy wslite 的新手,我正在尝试在 wslite 中编写一个肥皂请求。

我在 xml 中的肥皂请求是-

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://WSA.francetelecom.com/types/GetSoftPhoneInfos">
   <soapenv:Header/>
   <soapenv:Body>
      <get:getClientSOFTPHONEInfo>
         <get:businessUnit>${#TestSuite#BU_FR}</get:businessUnit>
         <get:cpeType>${#TestSuite#CPETYPE}</get:cpeType>
         <get:customerId>
            <!--Optional:-->
            <get:type>${#TestSuite#ID_TYPE_NDIP}</get:type>
            <!--Optional:-->
            <get:value>${#TestSuite#NDIP_Nominal}</get:value>
         </get:customerId>
      </get:getClientSOFTPHONEInfo>
   </soapenv:Body>
</soapenv:Envelope>

我正在运行的 groovy 脚本如下 -

import wslite.soap.*
import wslite.http.auth.*
import groovy.xml.XmlUtil

def client = new SOAPClient( 'http://10.170.194.214:1080/PapyrusSAV/services/GetSoftPhoneInfos-v2?wsdl')
client.authorization = new HTTPBasicAuthorization( "papyihm", "papypapyihm" )
def response = client.send(SOAPAction:'')
body{
 getClientSOFTPHONEInfo('xmlns':'http://WSA.francetelecom.com/types/GetSoftPhoneInfos'){
      businessUnit('FR')
      cpeType('SOFTPHONE')
      customerId('xmlns':'http://WSA.francetelecom.com/types/GetSoftPhoneInfos'){
             type('NDIP')
             value('+33155886791')
      }
  }
}
println XmlUtil.serialize( response.getClientSOFTPHONEInfo)

当我执行我的 groovy 时出现错误

groovy.lang.MissingMethodException: No signature of method: wslite.soap.SOAPClient.send() is applicable for argument types: (java.util.LinkedHashMap) values: [[SOAPAction:]]
Possible solutions: send(groovy.lang.Closure), send(java.lang.String), send(java.util.Map, groovy.lang.Closure), send(java.util.Map, java.lang.String), send(wslite.soap.SOAPVersion, java.lang.String), find()

我究竟做错了什么。

PS:SoapAction 在我正在使用的 wsdl 中是“”

4

1 回答 1

0

您需要一个关闭来发送请求,如下所示:-

def response = client.send(SOAPAction:'') {
     body {
           getClientSOFTPHONEInfo('xmlns':'http://WSA.francetelecom.com/types/GetSoftPhoneInfos'){
           businessUnit('FR')
           cpeType('SOFTPHONE')
           customerId('xmlns':'http://WSA.francetelecom.com/types/GetSoftPhoneInfos') {
                type('NDIP')
                value('+33155886791')
             }
          }
       }
   }

希望它会帮助你.. :)

于 2016-06-02T12:08:51.557 回答