• salam
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I am facing a weird issue. I can successfully create a user using the WebService API in SalesForce but I am unable to login to SalesForce from web through the user created by the API. Here is what I am doing to create the user in java.

               
Code:
SObject[] sObj = new User[1];

com.sforce.soap.enterprise.sobject.User sfUser = new com.sforce.soap.enterprise.sobject.User();    
sfUser.setFirstName("firstname");
sfUser.setAlias("alias");
sfUser.setLastName("lastname");
sfUser.setEmail("someEmail@domain.com");
sfUser.setUsername("username");
sfUser.setProfileId(binding.getUserInfo().getProfileId());
sfUser.setUserRoleId(binding.getUserInfo().getRoleId());
sfUser.setTimeZoneSidKey("America/Los_Angeles");
sfUser.setLanguageLocaleKey("French");
sfUser.setLocaleSidKey("en_US");
sfUser.setEmailEncodingKey("ISO-8859-1");
sfUser.setLanguageLocaleKey("en_US");
       
sfUser.setUserPermissionsCallCenterAutoLogin(false);
sfUser.setUserPermissionsMarketingUser(false);
sfUser.setUserPermissionsOfflineUser(false);

sObj[0] = sfUser;

SaveResult[] saveResults = binding.create(sObj);

for (int i = 0; i < saveResults.length; i++)
{
 if (saveResults[i].isSuccess())
 {
  binding.setPassword(saveResults[i].getId(), "somepassword");
 }
}

 Few days back the same code will work fine as in the created user would be able to login to SalesForce website. But now although there isn't any error in the code and everything succeeds but the user can not login to SalesForce website.

Any idea what might be wrong.

  • March 12, 2008
  • Like
  • 0
Hi,
I'm relatively new to SalesForce so bear with me if this seems very stupid.:mansad:

I am trying to run the Sample java code with SalesForce web service. I get a NullPointerException when i try to log in. I have a developers account whose login/password combination i am using.

The following statement executes fine.
Code:
binding = (SoapBindingStub)new SforceServiceLocator().getSoap();

However when i try to login using this binding i get the exception at this line
Code:
binding.login(userName, password);
Here userName and password are my developer account's user name and password in String.
The stack trace hints that the initial error is occuring at com.sforce.soap.enterprise.SoapBindingStub.login(SoapBindingStub.java:1781)

Any idea what should I do to resolve this?


  • June 07, 2006
  • Like
  • 0
How can I turn the debug output off?  I have so much output printed to the console that I can't see my println statements so I'm forced to just step through the code in debug mode to see what's going on....here's a small sample:
[DEBUG] - Enter: SOAPPart::getAsSOAPEnvelope()
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(currForm)
[DEBUG] - current form is FORM_SOAPENVELOPE
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(register00)
[DEBUG] - register 'soapenv' - 'http://schemas.xmlsoap.org/soap/envelope/'
[DEBUG] - NSPush (32)
[DEBUG] - NSPush (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(register00)
[DEBUG] - register 'soapenv' - 'http://schemas.xmlsoap.org/soap/envelope/'
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(register00)
[DEBUG] - register 'xsd' - 'http://www.w3.org/2001/XMLSchema'
[DEBUG] - NSPush (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(register00)
[DEBUG] - register 'xsi' - 'http://www.w3.org/2001/XMLSchema-instance'
[DEBUG] - NSPush (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(startElem00)
[DEBUG] - Start element [http://schemas.xmlsoap.org/soap/envelope/]:Envelope
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(headers00)
[DEBUG] - 1 headers
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(startElem00)
[DEBUG] - Start element [http://schemas.xmlsoap.org/soap/envelope/]:Header
[DEBUG] - NSPush (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(startElem00)
[DEBUG] - Start element [urn:partner.soap.sforce.com]:SessionHeader
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(register00)
[DEBUG] - register 'ns1' - 'urn:partner.soap.sforce.com'
[DEBUG] - NSPush (32)
[DEBUG] - NSPush (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(startElem00)
[DEBUG] - Start element [urn:partner.soap.sforce.com]:sessionId
[DEBUG] - NSPush (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(endElem00)
[DEBUG] - End element ns1:sessionId
[DEBUG] - NSPop (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(endElem00)
[DEBUG] - End element ns1:SessionHeader
[DEBUG] - NSPop (32)
[DEBUG] - org.apache.axis.i18n.resource::handleGetObject(endElem00)
[DEBUG] - End element soapenv:Header
[DEBUG] - NSPop (32)