Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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>

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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>
share|improve this answer
    
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 Aug 19 at 12:53
    
Can you post the full packet to your question? –  Kelly J Andrews Aug 19 at 12:54
    
added the full soap envelope request to my original post –  JCS Aug 19 at 12:59
1  
Your full soap envelope worked for me thanks. –  JCS Aug 19 at 14:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.