3

I am trying to apply a filter to a soap call to get some data from a data extension below is the example soap body.

<soapenv:Body>
  <par:RetrieveRequestMsg>
     <par:RetrieveRequest>
        <par:ObjectType>DataExtension</par:ObjectType>
        <par:Properties>Name</par:Properties>
        <par:Filter>
           <par:FilterPart>
               <par:Property>Name</par:Property>
               <par:SimpleOperator>equals</par:SimpleOperator>
               <par:Value>TEST</par:Value>   
            </par:FilterPart>
         </par:Filter>
     </par:RetrieveRequest>
  </par:RetrieveRequestMsg>
</soapenv:Body>

As you can see from this fragment i am trying getting the name of the data extensions where the name equals to TEST, this doesn't work i get the error message Error: Incorrect syntax near the keyword 'ORDER'.

Perhaps i have not applied the filter correctly? If so does anybody know the correct way of applying this filter onto the soap call?

I also tried the following

   <par:Filter>
               <par:Property>Name</par:Property>
               <par:SimpleOperator>equals</par:SimpleOperator>
               <par:Value>TEST</par:Value>   
         </par:Filter>

Same error. Removing the filter works and gets all the data extensions for my account.

EDIT:

Full soap envelope with suggested changes

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:par="http://exacttarget.com/wsdl/partnerAPI" 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="testuser" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:Username>username</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <par:RetrieveRequestMsg> <par:RetrieveRequest > <par:ObjectType>DataExtension</par:ObjectType> <par:Properties>Name</par:Properties> <par:Filter xsi:type="SimpleFilterPart"> <par:Property>Name</par:Property> <par:SimpleOperator>equals</par:SimpleOperator> <par:Value>TEST</par:Value>
</par:Filter> </par:RetrieveRequest> </par:RetrieveRequestMsg> </soapenv:Body> </soapenv:Envelope>

1 Answer 1

2

The filter requires a type. Try it like this. Edit: Removed the namespaces and cleaned up the full packet below. Should work now.

<Filter xsi:type="SimpleFilterPart">
    <Property>Name</par:Property>
    <SimpleOperator>equals</par:SimpleOperator> 
    <Value>CACI TEST</par:Value>
</Filter>

Be sure to include the following namespace

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

Full SOAP Envelope:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 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="testuser" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:Username>username</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </soapenv:Header>
  <soapenv:Body>
  <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
     <RetrieveRequest>
        <ObjectType>DataExtension</ObjectType>
        <Properties>Name</Properties>
        <Filter xsi:type="SimpleFilterPart">
               <Property>Name</Property>
               <SimpleOperator>equals</SimpleOperator>
               <Value>TEST</Value>
         </Filter>
     </RetrieveRequest>
  </RetrieveRequestMsg>
</soapenv:Body>
</soapenv:Envelope>
3
  • changed it and added the namespace, but now getting a different error Server was unable to read request. ---> There is an error in the XML document. ---> The specified type was not recognized: name='SimpleFilterPart', namespace='', at &lt;Filter xmlns='http://exacttarget.com/wsdl/partnerAPI'>. any idea why this would be?
    – JCS
    Commented Aug 19, 2014 at 12:53
  • Can you post the full packet to your question? Commented Aug 19, 2014 at 12:54
  • added the full soap envelope request to my original post
    – JCS
    Commented Aug 19, 2014 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .