I generated Apex code from the ExactTarget SOAP Api:
I am trying to make webservicecallouts using apex to retrieve "SentEvent" for an specific subscriber. Using SOAPUi it works absolutely fine, however, in Apex, I don't know how to set the filter (without the filter it works fine). Any ideas how to set the filter in Apex?
Here is the SOAP envelop I am trying to reproduce in Apex:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-24440876" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>myusername</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">MyPassword</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>SentEvent</ObjectType>
<Properties>Client.ID</Properties>
<Properties>TriggeredSendDefinitionObjectID</Properties>
<Properties>SendID</Properties>
<Properties>SubscriberKey</Properties>
<Properties>EventDate</Properties>
<Properties>EventType</Properties>
<Properties>BatchID</Properties>
<Filter xsi:type="ns1:SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<Property>SubscriberKey</Property>
<SimpleOperator>equals</SimpleOperator>
<Value>003c000000bxyVeAAI</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</soapenv:Body>
</soapenv:Envelope>
Here is my code I implemented so far to generate the request in Apex (without the filter):
bemExacttargetComWsdlPartnerapi.Soap stub = new bemExacttargetComWsdlPartnerapi.Soap(username,password);
bemExacttargetComWsdlPartnerapi.RetrieveRequest request = = new bemExacttargetComWsdlPartnerapi.RetrieveRequest();
request.ObjectType = 'SentEvent';
List<String> properties = new List<String>{'SendID','SubscriberKey','EventDate','EventType'};
request.ObjectType = 'SentEvent';
request.Properties = properties;
You can use this link to generate Apex code from the Wsdl, the class generated is too big to paste it here: