0

.net48 console App soap login error

Received an invalid SOAP Fault message: Unbound prefix used in qualified name 'sf:INVALID_LOGIN'

Generated the web service from partner wsdl dotnet-svcutil 2.0.3 net48 console app.

login method:

var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
var endPointAddress = new EndpointAddress(new Uri("https://test.salesforce.com/services/Soap/u/55.0")
var sc = new SoapClient(binding, endPointAddress);
var lres = sc.login(null, null, username, password + token);

exception

System.ServiceModel.CommunicationException: Received an invalid SOAP Fault message ---> System.Xml.XmlException: Unbound prefix used in qualified name 'sf:INVALID_LOGIN'.
  at System.ServiceModel.XmlUtil.ParseQName (System.Xml.XmlReader reader, System.String qname, System.String& localName, System.String& ns) [0x00095] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.XmlUtil.ReadContentAsQName (System.Xml.XmlReader reader, System.String& localName, System.String& ns) [0x00007] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.Channels.MessageFault.ReadFaultCode11 (System.Xml.XmlDictionaryReader reader, System.Int32 maxBufferSize) [0x00010] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.Channels.MessageFault.CreateFault11 (System.ServiceModel.Channels.Message message, System.Int32 maxBufferSize) [0x00028] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.Channels.MessageFault.CreateFault (System.ServiceModel.Channels.Message message, System.Int32 maxBufferSize) [0x00012] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
   --- End of inner exception stack trace ---
  at System.ServiceModel.Channels.MessageFault.CreateFault (System.ServiceModel.Channels.Message message, System.Int32 maxBufferSize) [0x00032] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Boolean isAsync, System.Object[]& parameters, System.ServiceModel.OperationContext context) [0x000a7] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Boolean isAsync, System.Object[]& parameters, System.ServiceModel.OperationContext context) [0x00031] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Boolean isAsync, System.Object[]& parameters, System.ServiceModel.OperationContext context) [0x0001e] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters, System.ServiceModel.OperationContext context) [0x00002] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.ClientRealProxy.DoInvoke (System.Runtime.Remoting.Messaging.IMessage inputMessage) [0x000d5] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.ServiceModel.ClientRealProxy.Invoke (System.Runtime.Remoting.Messaging.IMessage inputMessage) [0x00000] in <9513a2bb927146ddaa343ddc8a95d9c0>:0 
  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy rp, System.Runtime.Remoting.Messaging.IMessage msg, System.Exception& exc, System.Object[]& out_args) [0x000d6] in <533173d24dae460899d2b10975534bb0>:0 
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_remoting_wrapper(intptr,intptr)
  at (wrapper remoting-invoke) ServiceReference.Soap.loginAsync(ServiceReference.loginRequest)
  at ServiceReference.SoapClient.ServiceReference.Soap.loginAsync (ServiceReference.loginRequest request) [0x00001] in /home/vagrant/bigrentz/codezone/projects/BigRentz.SalesForce/src/test/Reference.cs:24674 
  at ServiceReference.SoapClient.loginAsync (ServiceReference.LoginScopeHeader LoginScopeHeader, ServiceReference.CallOptions CallOptions, System.String username, System.String password)
6
  • Possibly this: stackoverflow.com/questions/32777656/…
    – identigral
    Commented Jul 6, 2022 at 19:26
  • Presumably you're using the Partner WSDL. If so try Enterprise WSDL
    – identigral
    Commented Jul 6, 2022 at 19:47
  • I switched to the enterprise and I get Unhandled Exception: System.ServiceModel.FaultException: No operation available for request {urn:enterprise.soap.sforce.com}login at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Boolean isAsync, System.Object[]& parameters, System.ServiceModel.OperationContext context) Commented Jul 6, 2022 at 20:09
  • Enterprise - perhaps a wrong endpoint? help.salesforce.com/s/articleView?id=000338940&type=1
    – identigral
    Commented Jul 6, 2022 at 20:16
  • Again recommend that you switch to oAuth
    – identigral
    Commented Jul 6, 2022 at 20:17

0

You must log in to answer this question.

Browse other questions tagged .