1

When using FuelSDK with C# to create Data Extension, I am receiving System.ServiceModel.FaultException: Login Failed.

This doesn’t happen all the time, it happens randomly/unexpectedly. According to this page: https://help.marketingcloud.com/en/technical_library/web_service_guide/soap_faults/ It seems the error is related to security.

But as FuelSDK (for Java) states here, https://github.com/salesforce-marketingcloud/FuelSDK-Java/blob/master/src/main/resources/fuelsdk.properties.template that ClinetID and SecretKey is sufficient to make SOAP & REST API calls and ET_Client already figures out the correct endpoints for the application and handles refreshing of token as well.

Is there any other reason why this exception should be occurring?

My concern is that when SOAP API is used through FuelSDK, does it require username and password instead of ClientID and SecretKey?

I tried to reproduce it, but it was difficult to pin point, so I tried checking the status of our ExactTarget account (just to confirm it wasn’t under maintenance), but I received the same error by using GetSystemStatus.

Here is the code that throws the same exception:

NameValueCollection clientAttributes = new NameValueCollection();
                    clientAttributes.Add("clientId", ******);
                    clientAttributes.Add("clientSecret", ******);
ET_Client myclient = new ET_Client(clientAttributes);
SystemStatusOptions options = new SystemStatusOptions();
                string OverallStatus;
                string OverallStatusMessage;
                string RequestID;
                SystemStatusResult[] getsystemstatus = myclient.soapclient.GetSystemStatus(options, out OverallStatus, out OverallStatusMessage, out RequestID);
                Console.WriteLine("Account status: " + OverallStatus);

More detail on the exception:

SOAP Endpoint: https://webservice.s7.exacttarget.com/Service.asmx
SOAP Fault code: Security
SOAP State: Opened
SOAP Fault reason: Security requirements are not satisfied because the security header is not present in the incoming message.
Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at FuelSDK.Soap.GetSystemStatus(GetSystemStatusRequest request)
   at FuelSDK.SoapClient.FuelSDK.Soap.GetSystemStatus(GetSystemStatusRequest request) in c:\Users\ajitsutreja\Desktop\root DSI\Utilities\VVSExactTargetUtilities\FuelSDK-CSharp\ExactTargetSOAP.cs:line 30127
   at FuelSDK.SoapClient.GetSystemStatus(SystemStatusOptions Options, String& OverallStatus, String& OverallStatusMessage, String& RequestID) in c:\Users\ajitsutreja\Desktop\root DSI\Utilities\VVSExactTargetUtilities\FuelSDK-CSharp\ExactTargetSOAP.cs:line 30134
   at VVSExactTargetUtilities.Program.Main(String[] args) in c:\Users\ajitsutreja\Desktop\root DSI\Utilities\VVSExactTargetUtilities\VVSExactTargetUtilities\Program.cs:line 175
0

I'm not familiar with the Fuel SDK that you are using, but there appears to be an issue with the security header in the SOAP request envelope that is made from the SDK. Are you able to print or intercept the SOAP request so you can see what it looks like?

The SOAP API supports both OAuth and username/password authentication. If you are using OAuth, your SOAP request envelope would look something like this:

<?xml version="1.0" encoding="utf-8"?>
<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>
      <fueloauth xmlns="http://exacttarget.com">insertAccessTokenHere</fueloauth>
   </soapenv:Header>
   <soapenv:Body>
     ...
   </soapenv:Body>
</soapenv:Envelope>

If you are using username/password authentication, the header will look like this:

<?xml version="1.0" encoding="utf-8"?>
<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-32259181" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>insertUsernameHere</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">insertPasswordHere</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      ...
   </soapenv:Body>
</soapenv:Envelope>
2
  • 1
    There is an issue with FuelSDK, I tested by using the API directly and it worked.
    – Ajit
    Aug 10 '16 at 15:09
  • Getting the same error on the python sdk Feb 25 '17 at 15:48
-2

The Soap API supports OAuth and username/password, but the above code snippet uses username/password. The code supports only OAuth as if now. Since, we are supplying the client credentials clientId/clientSecret,this throws error. As it expects the username/password instead of clientId/clientSecret which is the root cause of error.

The code snippet needs to be changed to remove the error.

Using clientid/client secret is advised, with a change in code implementation

1
  • 1
    So how exactly does the code snippet need to be changed?
    – Adrian Larson
    Oct 17 '16 at 15:33

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.