Subscriber .Add problem

I have the following code working on another site...except for I have changed all references from "campaignmonitor" to "c/send"


' add subscriber to Campaign Monitor

If Request.Form("newsletter_subscribe") = "Yes" Then

dim apikey, listid, name, email, postdata, response

apikey = "xxxxxx" 'Your api key
listid = xxxxxx    'your list id

name = Request.Form("full_name")
email = Request.Form("email_address")

postdata = ""
postdata = postdata & "<soap:Envelope xmlns:xsi="""" xmlns:xsd="""" xmlns:soap="""">"
postdata = postdata & "<soap:Body>"
postdata = postdata & "    <Subscriber.Add xmlns="""">"
postdata = postdata & "        <ApiKey>" & apikey & "</ApiKey>"
postdata = postdata & "        <ListID>" & listid & "</ListID>"
postdata = postdata & "        <Email>" & email & "</Email>"
postdata = postdata & "        <Name>" & name & "</Name>"
postdata = postdata & "    </Subscriber.Add>"
postdata = postdata & "</soap:Body>"
postdata = postdata & "</soap:Envelope>"

Dim xmlhttp
Set xmlhttp=Server.CreateObject("Microsoft.XMLHTTP") "POST","" ,false

xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlhttp.setRequestHeader "SOAPAction", """"""

xmlhttp.send postdata

response = xmlhttp.responseText

End If

I'm getting the following error message.

soap:ClientSystem.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

What is going wrong?



davidh, 8 years ago

Hi Brett,

In your code I think all the references to app.createsend should be api.createsend instead. I am not 100% sure that is the problem but there is a good chance. If you try that and it still doesn't work let us know either here or by emailing support.

baatkin65, 8 years ago


I changed the app.createsend to api.createsend and it worked fine once I changed the API key to my account API and not the client API.

I don't understand that.  Why do I have to use my account API Key and not the client API Key?

Brett Atkin

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free