FuelSDK-CSharp
FuelSDK-CSharp copied to clipboard
[BUG] Security requirements not satisfied
Describe the bug Security requirements are not satisfied because the security header is not present in the incoming message.
To Reproduce Execute SoapClient.Retrieve()
Expected behavior Retrieve should work and retrieve data
Code snippet var myClient = new ETClient(); var r = myClient.SoapClient.Retrieve( new RetrieveRequest { ObjectType = "DataExtensionObject", Properties = new[] { "Name", "Value" }, Filter = queryFilter }, out requestID, out results);
Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (e.g. gif) is not sufficient.
Environment
- SDK Version [e.g. 1.3.0]
- .NET Framework 472
The bug has the severity
- [ ] Major: The defect affects major functionality or major data. It has a workaround but is not obvious and is difficult.or efficiency. It is merely an inconvenience.
There is a bug in SoapClient in that it does not send the authorized token when making the call. You can either add the header for the token or if your goal is to retrieve the DE rows, since you're using FuelSDK anyway, just use what functionality is already there.
https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-sdks.meta/mc-sdks/data-extension-row-retrieve.htm
Oauth2 is not broken, it just doesnt work how you might expect. This is documentation issue imho.
Works like this->
private static void TestFuel2()
{
ETClient myETClient = new ETClient();
SoapClient mySClient = myETClient.SoapClient;
using (var scope = new OperationContextScope(mySClient.InnerChannel))
{
// Add oAuth token to SOAP header.
XNamespace ns = "http://exacttarget.com";
var xmlHeader = MessageHeader.CreateHeader("fueloauth", "http://exacttarget.com", myETClient.AuthToken);
OperationContext.Current.OutgoingMessageHeaders.Add(xmlHeader);
var httpRequest = new System.ServiceModel.Channels.HttpRequestMessageProperty();
OperationContext.Current.OutgoingMessageProperties.Add(
System.ServiceModel.Channels.HttpRequestMessageProperty.Name, httpRequest);
httpRequest.Headers.Add(HttpRequestHeader.UserAgent, ETClient.SDKVersion);
Automation automation = new Automation();
automation.ObjectID = " <id goes here>";
string sStatus = "";
string sStatusMessage = "";
string sRequestId = "";
PerformResult[] pResults = mySClient.Perform(new PerformOptions(), "start", new APIObject[] { automation }, out sStatus, out sStatusMessage, out sRequestId);
Console.WriteLine("Status: " + sStatus);
Console.WriteLine("Status Message: " + sStatusMessage);
Console.WriteLine("Request ID: " + sRequestId);
foreach (PerformResult pr in pResults)
{
Console.WriteLine("StatusCode: " + pr.StatusCode);
Console.WriteLine("ErrorCode: " + pr.ErrorCode);
Console.WriteLine("StatusMessage: " + pr.StatusMessage);
}
}
return;
}