john renfrew
john renfrew

Reputation: 413

wslite works with xml not inline

If you use the XML version of this post is works, but tearing my hair out to try and find out why the inline version does not. Its hardly a complex function!!

import wslite.soap.SOAPClient
import wslite.soap.*
import groovy.xml.Namespace

proxy = new SOAPClient("http://www.predic8.com:8080/crm/CustomerService?wsdl")

/*
// THIS WORKS
list = proxy.send(
'''<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="http://predic8.com/wsdl/crm/CRMService/1/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:get>
     <id>99</id>
    </ns:get>
 </soapenv:Body>
  </soapenv:Envelope>'''
  )
    */

   //return list.getText()

//THIS DOES NOT
list = proxy.send(SOAPAction:'http://www.predic8.com:8080/crm/CustomerService'){
body{
    get(xmlns:ns="http://predic8.com/wsdl/crm/CRMService/1/"){
        id(99)
        }
} //end body
} //end proxy

return list.getText()

Anyone able to fathom out why?

Upvotes: 1

Views: 618

Answers (1)

John Wagenleitner
John Wagenleitner

Reputation: 11035

Attributes should be passed as a Map, so the following change to your code should work.

...
'ns:get'('xmlns:ns': "http://predic8.com/wsdl/crm/CRMService/1/"){
...

or

...
get('xmlns': "http://predic8.com/wsdl/crm/CRMService/1/"){
...

Upvotes: 2

Related Questions