require 'rubygems' # require 'ruby-debug' require 'nokogiri' require 'savon' require 'cgi' client = Savon::Client.new do wsdl.document = "https://webservice.s4.exacttarget.com/etframework.wsdl" end client.wsse.credentials "", "" client.wsse.created_at = Time.now.utc client.wsse.expires_at = (Time.now + 60).utc client.http.headers["SOAPAction"] = '"urn:example#service"' # p client.wsdl.soap_actions # 1058396 # [:create, :perform, :update, :schedule, :configure, :version_info, :execute, :extract, :get_system_status, :query, :delete, :retrieve, :describe] body = { 'wsdl:Objects' => { 'wsdl:EmailAddress' => 'wuuuuut@tester.com', 'wsdl:Attributes' => [ {"wsdl:Name" => "First Name", "wsdl:Value" => "Wuuuuut"}, {"wsdl:Name" => "Last Name", "wsdl:Value" => "Teeeester"}, {"wsdl:Name" => "Company", "wsdl:Value" => "Northern Trail Outfitters"} ], 'wsdl:Lists' => { 'wsdl:ID' => '251', 'wsdl:Status' => 'Active' }, :attributes! => { 'wsdl:Lists' => {'xsi:type' => 'wsdl:SubscriberList'} } } } header = { 'a:Action' => 'Delete', 'a:MessageID' => 'urn:uuid:99e6822c-5436-4fec-a243-3126c14924f6', 'a:ReplyTo' => { 'a:Address' => 'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous' }, 'VsDebuggerCausalityData' => 'uIDPo5GdUXRQCEBNrqnw0gOEloMAAAAAIAi4IHpPlUiMs1MZ2raBIhJnF/jqJLlAgZIny03R+tgACQAA', 'a:To' => 'https://webservice.s4.exacttarget.com/Service.asmx' } ' urn:uuid:99e6822c-5436-4fec-a243-3126c14924f6 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous uIDPo5GdUXRQCEBNrqnw0gOEloMAAAAAIAi4IHpPlUiMs1MZ2raBIhJnF/jqJLlAgZIny03R+tgACQAA https://webservice.s4.exacttarget.com/Service.asmx 2011-07-27T15:04:42.722Z 2011-07-27T15:09:42.722Z username password ' # body = ' DataFolder ID Name ParentFolder.ID ParentFolder.Name Account equals 1058484 ' body = ' List ListName ID ListName equals All Subscribers ' body = ' 1058484 List CustomerKey ID ' body = { 'RetrieveRequest' => { 'ClientIDs' => { 'ID' => '1058484' }, 'ObjectType' => 'List', 'Properties' => ['CustomerKey', 'ID'] } } body_noko = Nokogiri::XML::Builder.new do |xml| xml.retrieve_request { xml.client_ids { xml.id "1058484" } xml.object_type "List" xml.properties "CustomerKey" xml.properties "ID" } end body = ' 1058484 565 354 ' # # puts body # # puts '-============-' # # puts body_noko.text body = ' 1058484 DataFolder ID Name ParentFolder.ID ParentFolder.Name ContentType like email ' body = ' 1058484 Email ID Name Folder CategoryID Name like 120911_piter_follow_up_side ' body = ' 1058484 Email ID Name Folder CategoryID Name like 120911_piter_follow_up_side ' body = ' 1058484 1724 ' html = CGI.escapeHTML('

Way Cool Email

') # # body = ' # # # 1058484 # 354 # '+html+' # Test Subject111 # HTML # true # ' namespaces = { 'xmlns:s'=>"http://schemas.xmlsoap.org/soap/envelope/", 'xmlns:a'=>"http://schemas.xmlsoap.org/ws/2004/08/addressing", 'xmlns:u'=>"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", 'xmlns:xsi'=>"http://www.w3.org/2001/XMLSchema-instance", 'xmlns:xsd'=>"http://www.w3.org/2001/XMLSchema", 'xmlns:o'=>"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" } # response = client.request :retrieve do |soap| soap.input = ['DeleteRequest', { 'xmlns'=>"http://exacttarget.com/wsdl/partnerAPI"}] soap.header = header soap.env_namespace = :s soap.namespaces = namespaces soap.body = body end # # response = client.request :create do |soap| # soap.input = ['CreateRequest', { 'xmlns'=>"http://exacttarget.com/wsdl/partnerAPI"}] # soap.header = header # soap.env_namespace = :s # soap.namespaces = namespaces # soap.body = body # end