soap wsdl envelope

J

Jared Moody

I'm having some trouble getting my SOAP envelope to do what I want and
need a little tip. I can't get the SubscriberCustomField nodes to be
anything but blank:

Here's what I want it to look like:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Subscriber.AddWithCustomFields
xmlns="http://api.createsend.com/api/">
<ApiKey>string</ApiKey>
<ListID>string</ListID>
<Email>string</Email>
<Name>string</Name>
<CustomFields>
<SubscriberCustomField>
<Key>comments</Key>
<Value>Hello World</Value>
</SubscriberCustomField>
</CustomFields>
</Subscriber.AddWithCustomFields>
</soap:Body>
</soap:Envelope>

Here's what I'm getting:

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<n1:Subscriber.AddWithCustomFields
xmlns:n1="http://api.createsend.com/api/">
<n1:ApiKey>string</n1:ApiKey>
<n1:ListID>string</n1:ListID>
<n1:Email>string</n1:Email>
<n1:Name>string</n1:Name>
<n1:CustomFields>
<n1:SubscriberCustomField>
</n1:SubscriberCustomField>
<n1:SubscriberCustomField>
</n1:SubscriberCustomField>
</n1:CustomFields>
</n1:Subscriber.AddWithCustomFields>
</env:Body>
</env:Envelope>

And here's my code

require 'soap/wsdlDriver'
require 'cgi'

@url = "http://#{site_name}.createsend.com/api/api.asmx?wsdl"
@service = SOAP::WSDLDriverFactory.new(@url).create_rpc_driver

str = ""

#custom_fields = "<SubscriberCustomField><Key>comments</Key><Value>hello
world</Value></SubscriberCustomField>"
#custom_fields = [{:SubscriberCustomField => {:Key => "comments", :Value
=> "hello world"}}]
#custom_fields = [{:Key => "comments", :Value => "hello world"}]
#custom_fields = [:comments => "hello world"]
custom_fields = {:SubscriberCustomField => {:Key => "comments", :Value
=> "hello world"}}

@service.wiredump_dev = str

@service.AddSubscriberWithCustomFields({:ApiKey=>@api_key,
:ListID=>list_id, :Email=>email, :Name=>name, :CustomFields =>
custom_fields})

puts str

The commented custom_fields variables are things I've tried with the
same result.

Thanks in advance for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top