# Soap wsdl envelope

**URL:** <https://www.ruby-forum.com/t/soap-wsdl-envelope/123836>\
**Category:** Ruby\
**Created:** [December 21, 2007, 3:55am UTC](https://www.ruby-forum.com/t/soap-wsdl-envelope/123836 "2007-12-21T03:55:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaredmoody](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/76d3ee/32.png) [@jaredmoody](https://www.ruby-forum.com/u/jaredmoody)\
**Post date:** [December 21, 2007, 3:55am UTC](https://www.ruby-forum.com/t/soap-wsdl-envelope/123836/1 "2007-12-21T03:55:03Z")

</div>

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](http://www.w3.org/2001/XMLSchema-instance)”  
xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:soap=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”\>  
soap:Body  
\<Subscriber.AddWithCustomFields  
xmlns=“[http://api.createsend.com/api/](http://api.createsend.com/api/)”\>  
string  
string  
string  
string  
  
  
comments  
Hello World  
  
  
\</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](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
\<n1:Subscriber.AddWithCustomFields  
xmlns:n1=“[http://api.createsend.com/api/](http://api.createsend.com/api/)”\>  
n1:ApiKeystring\</n1:ApiKey\>  
n1:ListIDstring\</n1:ListID\>  
n1:Emailstring\</n1:Email\>  
n1:Namestring\</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 = “commentshello  
world”  
#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.
