0

When I was trying to integrate Marketing cloud to salesforce for Retrieving portfolio Object. First Consume the WSDL file in Salesforce. Then invoke this method:

WsdlToApexClass.Soap soapInst = new WsdlToApexClass.Soap();

soapInst.endpoint_x = 'https://webservice.exacttarget.com/Service.asmx'; WsdlToApexClass.RetrieveRequest retrieveRequestInst = new WsdlToApexClass.RetrieveRequest(); list<WsdlToApexClass.ClientID> Lobj = new list<WsdlToApexClass.ClientID>(); WsdlToApexClass.ClientID obj = new WsdlToApexClass.ClientID(); obj.ClientID ='client Id';// from connected App
Lobj.add(obj); retrieveRequestInst.ClientIDs =Lobj; retrieveRequestInst.ObjectType ='Portfolio'; soapInst.Retrieve_x(retrieveRequestInst);

When I execute that code it will throw an error: "System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Security requirements are not satisfied because the security header is not present in the incoming message. faultcode=q0:Security faultactor=https://webservice.exacttarget.com/Service.asmx"

0

Looking at the error - the request is missing the authentication header within the SOAP package.

There is a guide about SOAP API requests within the developers page.

Here is the sample code that could help:

// 1a. Set the username/password. This is using the Username token of WS-Security 1.0
UsernameTokenProvider utp = new UsernameTokenProvider(<username>, <password>);
etForAppx.SetClientCredential<UsernameToken>(utp.GetToken());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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