+ Start a Discussion
David BrinkDavid Brink 

"Security requirements are not satisfied because the security header is not present in the incoming message" error

I am trying to figure out how to work with the Marketing Cloud API and am not having much luck (documentation here: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/index-api.htm).  The web service URL I used was https://webservice.test.exacttarget.com/Service.asmx.  Here is my code (mostly copied from the "starter kit" example code):
            m_Client.ClientCredentials.UserName.UserName = "david.brink@nau.edu.dv";
            m_Client.ClientCredentials.UserName.Password = "passw0rd";

            //Local variables
            APIObject[] Results;
            String requestID;
            String status;

            // Instantiate the retrieve request
            RetrieveRequest rr = new RetrieveRequest();
            rr.ObjectType = "DataExtensionObject[810f461c-231a-440a-8543-837460be6c7a]";//required

            rr.Properties = new string[] { "subscriber_key" };//required //Any Column on the Data Extension
            string a = rr.ToString();
            status = m_Client.Retrieve(rr, out requestID, out Results);
This code errors on the last line (error detail in the SOAP response below).
The "Retrieve" function in the last line sends this SOAP request:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
   <RetrieveRequest>
    <ObjectType>DataExtensionObject[810f461c-231a-440a-8543-837460be6c7a]</ObjectType>
    <Properties>subscriber_key</Properties>
   </RetrieveRequest>
  </RetrieveRequestMsg>
 </s:Body>
</s:Envelope>
and gets this response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
	<soap:Header>
		<wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</wsa:Action>
		<wsa:MessageID>urn:uuid:2a94f968-99f4-4a08-8782-d3b6fbe46860</wsa:MessageID>
		<wsa:RelatesTo>urn:uuid:4d96621b-9506-4ef0-8bdc-a05c7f12456e</wsa:RelatesTo>
		<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
		<wsse:Security>
			<wsu:Timestamp wsu:Id="Timestamp-ec9ba10a-728f-4376-9e53-d7f711177af7">
				<wsu:Created>2017-03-17T22:05:29Z</wsu:Created>
				<wsu:Expires>2017-03-17T22:10:29Z</wsu:Expires>
			</wsu:Timestamp>
		</wsse:Security>
	</soap:Header>
	<soap:Body>
		<soap:Fault>
			<faultcode xmlns:q0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">q0:Security</faultcode>
			<faultstring>Security requirements are not satisfied because the security header is not present in the incoming message.</faultstring>
			<faultactor>https://webservice.test.exacttarget.com/Service.asmx</faultactor>
		</soap:Fault>
	</soap:Body>
</soap:Envelope>
Does anyone have any suggestions on how to address this error?

Thanks,

David Brink
 
Eric Jones 14Eric Jones 14
Sorry for your troubles David. You will need to add a custom binding in your web.config or app.config depending on what type of project you are working on.

If you reference numbers 6-7 on this https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/connecting_to_the_web_service_api_using_wcf.htm I believe it will resolve your issues.

Thanks,
Eric