Search code examples
rubysoapsavon

CleverElements / Sendcockpit SOAP API parameters aren't recognized


I'm trying to use the CleverElements SOAP API, but I can't get it to work. I have honestly never worked with SOAP (but a lot with XML-RPC, REST, etc.), and thought it should be straightforward.

I'm using Ruby with the savon gem. I can call any function via SOAP which doesn't need any parameters, but on functions with parameters, the SOAP service doesn't recognize the parameters.

This is my request:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="Sendcockpit/API" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="Sendcockpit/API">
  <env:Header>
    <validate>
      <userid>32027</userid>
      <apikey>**************</apikey>
      <version>1.0</version>
      <mode>live</mode>
    </validate>
  </env:Header>
  <env:Body>
    <apiGetListDetails>
      <listID>72472</listID>
    </apiGetListDetails>
  </env:Body>
</env:Envelope>

This is the WSDL file: http://api.sendcockpit.com/server.php?wsdl

Am I missing something (maybe dead simple, super obvious, basic SOAP) stuff?


Solution

  • Never mind. Apparently I need a wrapping <ctListRequest> node. I was under the impression that savon applies all things specified by the wsdl file...

    This request works:

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="Sendcockpit/API" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="Sendcockpit/API">
      <env:Header>
        <validate>
          <userid>32027</userid>
          <apikey>***********</apikey>
          <version>1.0</version>
          <mode>live</mode>
        </validate>
      </env:Header>
      <env:Body>
        <apiGetListDetails>
          <ctListRequest>
            <listID>72472</listID>
          </ctListRequest>
        </apiGetListDetails>
      </env:Body>
    </env:Envelope>