You need to sign in to do that
Don't have an account?
URGENT: New Error while making a Login call using C#
We are trying to integrate one of our Commerce Application with our Salesforce Instance and during the login call we receive the following error using C#/.NET. However the login works through console application however but throws the error through the .dll (compiled with the same code) which is called by our Commerce Application.
A few days back we recieved the below error
Exception : System.Web.Services.Protocols.SoapHeaderException: Required field/property SforceService.LoginScopeHeaderValue of SOAP header LoginScopeHeader was not set by the client prior to making the call.
at System.Web.Services.Protocols.SoapHeaderHandling.GetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client)
at System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRequest request, String methodName, Object[] parameters)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Mercury_SFAdapter.Sforce.SforceService.login(String username, String password)
at Mercury_SFAdapter.Mercury_SFAdapterSvc.login()
which got resolved by declaring the LoginScopeHeader as below.
binding.LoginScopeHeaderValue = new Mercury_SFAdapter.Sforce.LoginScopeHeader();
Thanks to some quick help from SimonF
Yesterday we created a new field in ourSandbox Instance and downloaded and updated the new .wsdl file.
(Sandbox now showing Spring 08)
We started recieving the below exception message for AssignmentRuleHeader
ERROR: System.Web.Services.Protocols.SoapHeaderException: Required field/property SforceService.AssignmentRuleHeaderValue of SOAP header AssignmentRuleHeader was not set by the client prior to making the call.
at System.Web.Services.Protocols.SoapHeaderHandling.GetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client)
at System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRequest request, String methodName, Object[] parameters)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
On creating a AssignmentRuleHeaderValue insatance as done above for LoginScopeHeaderValue
leads to message for DebuggingHeaderValue , EmailHeaderValue ,MruHeaderValue and so on.
private bool login()
{
binding = new Mercury_SFAdapter.Sforce.SforceService();
try
{
//execute the login placing the results
//in a LoginResult object
binding.LoginScopeHeaderValue = new Mercury_SFAdapter.Sforce.LoginScopeHeader();
Mercury_SFAdapter.Sforce.LoginResult loginResult = binding.login("username", "password");
if (!loginResult.passwordExpired)
{
binding.Url = loginResult.serverUrl;
//set the session id header for subsequent calls
binding.SessionHeaderValue = new Mercury_SFAdapter.Sforce.SessionHeader();
binding.SessionHeaderValue.sessionId = loginResult.sessionId;
return true;
}
else
{
QLogWrapper.m_staticLogger.logComment("Password is Expired");
}
}
catch (Exception ex)
{
QLogWrapper.m_staticLogger.logComment("Exception : " + ex);
}
//Login failed, report message then return false
//--------Console.WriteLine("Login failed with message: " + ex.Message);
return false;
}
Request some immediate assistance on this.
Thank you,
Manish K Dhupar
Hello Simon,
We are using .Net 1.1 and are using the inbuilt tool "Add web Referance" from .NET
Thanks
manish
We have narrowed down the problem.
To be more precise the exact error/exception occurs during the below Create Account call.
Mercury_SFAdapter.Sforce.SaveResult[] saveResults = binding.create(records);
We receive SOAP header exceptions:
1. ERROR: System.Web.Services.Protocols.SoapHeaderException: Required field/property SforceService.AssignmentRuleHeaderValue of SOAP header AssignmentRuleHeader was not set by the client prior to making the call. at System.Web.Services.Protocols.SoapHeaderHandling.GetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client) at System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRequest request, String methodName, Object[] parameters) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
Action:
When we define the SOAP Header value (AssignmentRuleHeaderValue) as below then we receive next exception
binding.AssignmentRuleHeaderValue = new Mercury_SFAdapter.Sforce.AssignmentRuleHeader();
binding.AssignmentRuleHeaderValue.useDefaultRule=true;
2. ERROR: System.Web.Services.Protocols.SoapHeaderException: Required field/property SforceService.EmailHeaderValue of SOAP header EmailHeader was not set by the client prior to making the call. at System.Web.Services.Protocols.SoapHeaderHandling.GetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client) at System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRequest request, String methodName, Object[] parameters) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
Action:
binding.EmailHeaderValue = new Mercury_SFAdapter.Sforce.EmailHeader();
3. On making above changes we get similar SOAPHeaderExceptions for MruHeaderValue, UserTerritoryDeleteHeaderValue, LocaleOptionsValue and DebuggingInfoValue(Please see below exception)
4. ERROR: System.Web.Services.Protocols.SoapHeaderException: Client did not find required DebuggingInfo SOAP header in the message. at System.Web.Services.Protocols.SoapHeaderHandling.SetHeaderMembers(SoapHeaderCollection headers, Object target, SoapHeaderMapping[] mappings, SoapHeaderDirection direction, Boolean client) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
Finally, we are stuck at this exception even after setting the header value as shown below.
binding.DebuggingInfoValue = new Mercury_SFAdapter.Sforce.DebuggingInfo();
Kindly suggest what all SOAPHeaderValues need to be set and let us know if any other setting/values are required to be done in Salesforce UI to get rid of these exception.
We are using Create and Update calls for Accounts, Contacts and one Custom object (Serial number).
Please Note that the same code works fine through a console application but throws these exceptions when a .dll (using similar code) is called through our commerce application
Some URGENT assistance would be highly appreciated.
Thank you,
Manish
Mercury_SFAdapter.Sforce.SaveResult[] saveResults = binding.create(records);
Regards,
Manish