smiles
smiles

Reputation: 231

writing a soap request in groovywslite

I am new to groovy wslite and I ma trying to write a soap request in wslite.

My soap request in xml is-

<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>

and the groovy script I am running is as below-

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)

When I execute my groovy I get error

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()

what am I doing wrong.

PS: SoapAction is "" in the wsdl which I am using

Upvotes: 0

Views: 1354

Answers (1)

Saurabh Gaur
Saurabh Gaur

Reputation: 23825

You need a Closure to send request as below :-

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')
             }
          }
       }
   }

Hope it will help you..:)

Upvotes: 0

Related Questions