Skip to content

Instantly share code, notes, and snippets.

@colinpetruno
Created June 17, 2013 20:32
Show Gist options
  • Select an option

  • Save colinpetruno/5800097 to your computer and use it in GitHub Desktop.

Select an option

Save colinpetruno/5800097 to your computer and use it in GitHub Desktop.
Savon Soap API Example
<%
client = Savon.client( :wsdl => "https://sdk.e-dialog.com/edialog-webservices/SdkService.wsdl",
:basic_auth => ["USER_REPLACE_ME", "PASSWORD_REPLACE_ME"],
:element_form_default => :qualified,
:encoding => "UTF-8",
:namespace_identifier => 'ins16', # THIS LINE MUST BE CHANGED FOR EACH CALL (ANNOYING)
:strip_namespaces => true,
:namespaces => {
"xmlns:SOAP-ENV" => "http://schemas.xmlsoap.org/soap/envelope/",
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" ,
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xmlns:SOAP-ENC"=>"http://schemas.xmlsoap.org/soap/encoding/",
"xmlns:ns1309"=>"http://tempuri.org",
"xmlns:ins16" => "uri:realtimemessaging.ws.sdk.edialog.com"
},
:soap_header => { "tns:clientid" => 162601242,
:attributes! => { "tns:clientid" => { "soapenv:mustUnderstand" => 1,
"xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/",
"xmlns:tns"=>"uri:ws.sdk.edialog.com"
}
}
},
:env_namespace => 'SOAP-ENV')
message = { :messageName => "SIMPLETRIGGER",
:replacementAddress => '[email protected]',
:property => [{:value => '[email protected]' },{:value => 'Colin' },{:value => 'Petruno' }],
:attributes! => {'ins16:property' => {:name => ['EMAIL', 'FIRSTNAME', 'LASTNAME'] }}
}
response = client.call(:send_proof_message, :message => message)
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment