Using CM API with Zend_Soap_Client

I'm attempting to use the CM API with Zend_Soap_Client but I've run into some issues I haven't been able to resolve.

Firstly, I was getting issues attempting to use Zend_Soap_Client in WSDL mode; I would recieve the following error:

Function ("Subscriber.Add") is not a valid method for this service

when the Subscriber.Add is clearly in the WSDL itself, and I was passing all the correct arguments and method name with the __call() method.

Secondly I've switched to non-WSDL mode; and it's generating XML as expected:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
    xmlns:env="http://www.w3.org/2003/05/soap-envelope"
    xmlns:ns1="http://api.createsend.com/api/api.asmx/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
    <env:Body>
        <ns1:Subscriber.Add env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
            <param0 xsi:type="xsd:string">test@test.com</param0>
            <param1 xsi:type="xsd:string">test user</param1>
        </ns1:Subscriber.Add>
    </env:Body>
</env:Envelope>

But when this XML is sent; I recieve a HTML page!

I'm using endpoint url: http://api.createsend.com/api/api.asmx as defined in the documentation.

Can anyone see what's going wrong, or what's wrong with the XML that the Zend_Soap_Client is sending?

I have been able to add subscribers to the list using the GET method manually; but ideally I'd like to use SOAP.

Cheers

jamesau, 7 years ago

Can someone please post thier thoughts?

Cheers

jamesau, 7 years ago

Since my post I've tried also SoapClient which Zend_Soap_Client actually extends; when I attempt to call Subscriber.Add I recieve and error: "Function ("Subscriber.Add") is not a valid method for this service". It's clearly in the WSDL file; and I'm now passing in the ApiKey, ClientId, Email and Name as the method expects...

What's going on?

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098