I'm trying to clean up my soap (pun intended) for some interactions
with the ExactTarget API similar to what was shown here:
http://expertbeginner.com/2010/11/11/exacttarget-wsdl-examples/
Currently my ruby reads like this to generate the client requests.
@soap_body = {
':RetrieveRequestMsg' => {
':RetrieveRequest' => {
':ObjectType' => 'List',
':Properties' => ['ListName','ID'],
':Filter' => {
':Property' => 'ID',
':SimpleOperator' => 'equals',
':Value' => '12345',
},
:attributes! => {
':Filter' => {'xsi:type' => 'SimpleFilterPart'}
}
}
},
:attributes! => {
':RetrieveRequestMsg' => {'xmlns' => '
http://exacttarget.com/wsdl/
partnerAPI'}
}
}
#
response = client.request(:retrieve) do |soap|
soap.header = @soap_header
soap.body = @soap_body
@method = soap.body
end
This yields the following body:
<env:Body>
<Retrieve>
<RetrieveRequestMsg xmlns="
http://exacttarget.com/wsdl/
partnerAPI">
<RetrieveRequest>
<ObjectType>List</ObjectType>
<Properties>ListName</Properties>
<Properties>ID</Properties>
<Filter xsi:type="SimpleFilterPart">
<Property>ID</Property>
<SimpleOperator>equals</SimpleOperator>
<Value>12345</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</Retrieve>
</env:Body>
The vendor however needs the <Retrieve> and </Retrieve> removed to
not return the error. The body should look like this:
<env:Body>
<RetrieveRequestMsg xmlns="
http://exacttarget.com/wsdl/
partnerAPI">
<RetrieveRequest>
<ObjectType>List</ObjectType>
<Properties>ListName</Properties>
<Properties>ID</Properties>
<Filter xsi:type="SimpleFilterPart">
<Property>ID</Property>
<SimpleOperator>equals</SimpleOperator>
<Value>12345</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</env:Body>
I note in the documention here:
http://savonrb.com/#executing_soap_requests
"The argument(s) passed to the #request method will affect the SOAP
input tag inside the SOAP request.
To make sure you know what this means, here’s an example for a simple
request:"
I'm trying to find a method to eliminate the input tag in my request
from happening.
I can't see where you can explicitly declare to not have that in there
without resorting to handcoding the whole XML request so I'm down to
monkey patching the gem locally so that I can eliminate this
behavior. I'm looking at the XML file:
https://github.com/rubiii/savon/blob/master/lib/savon/soap/xml.rb
I'm wondering:
1) If I want to eliminate that input is there a declaration to do it?
2) What would be the best place to fix this at?
thanks in advance
Brian
"