• ganeshj
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 6
    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
It is possible to set the field-level security depending on the role instead of the profile?
Hi, all

When trying to execute

Code:
      loginResult = binding.login(loginSFDC, passwordSFDC);

i have got the Exception :

CODE

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace: java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:396)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:395)
    at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:246)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
    at org.apache.axis.client.Call.invoke(Call.java:2553)
    at org.apache.axis.client.Call.invoke(Call.java:2248)
    at org.apache.axis.client.Call.invoke(Call.java:2171)
    at org.apache.axis.client.Call.invoke(Call.java:1691)
    at com.sforce.soap.enterprise.SoapBindingStub.login(SoapBindingStub.java:1754)
    at com.lapeyre.sfdc.LoadData.doLogin(LoadData.java:97)
    at com.lapeyre.sfdc.LoadData.&lt;init&gt;(LoadData.java:38)
    at com.lapeyre.sfdc.LoadData.main(LoadData.java:129)


java.lang.NullPointerException
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:129)
    at org.apache.axis.client.Call.invoke(Call.java:2251)
    at org.apache.axis.client.Call.invoke(Call.java:2171)
    at org.apache.axis.client.Call.invoke(Call.java:1691)
    at com.sforce.soap.enterprise.SoapBindingStub.login(SoapBindingStub.java:1754)
    at com.lapeyre.sfdc.LoadData.doLogin(LoadData.java:97)
    at com.lapeyre.sfdc.LoadData.<init>(LoadData.java:38)
    at com.lapeyre.sfdc.LoadData.main(LoadData.java:129)
Caused by: java.lang.NullPointerException
    at java.util.Hashtable.put(Hashtable.java:396)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:395)
    at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:246)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
    at org.apache.axis.client.Call.invoke(Call.java:2553)
    at org.apache.axis.client.Call.invoke(Call.java:2248)
    ... 6 more

 Did someone Can help me ?




I've downloaded this plug-in as referenced elsewhere and run it on my ent.wsdl file so I can call to SF from a Java app. The problem is that I seem to be missing SOAPBindingStub? Where is this generated? Am I just missing an option?

Thanks!
Hi All,
I am writing a Java program which will fetch records from SFDC and insert them to Oracle database tables.My query fetches about 20,000 records.But while processing the records i am able to process only the first 2000 records.
I have not set any batchzize(the default batch size being 2000).So to process the remaing records in batches of 2000 ,i have used the queryMore call.But still my program fails to process from the 2001th record onwards.
 
The folowing is the code segment.
try

{

//Get all the Accounts

qr = bindingIM.query("Select Id,Name from Account where RecordTypeId = '012200000004Tsn' or RecordTypeId ='012200000000Cyn' ");

boolean done = false;

if(qr.getSize()>0)

{

System.out.println("Fetched records:"+qr.getSize());

int iCount=0;

while(!done)

{

record_counter=0;

for(record_counter=0;record_counter<qr.getRecords().length;record_counter++)

{

iCount++;

System.out.println("Current record:"+iCount);

Account acct = (Account) qr.getRecords(record_counter);

ID cust_sf_no = null;

cust_sf_no = acct.getId();

String cust_name = acct.getName();

st.addBatch("INSERT INTO SFDC_CHANGE_CUSTOMER(CUST_SF_NO,CUST_NAME) " +

"VALUES('"+cust_sf_no+"','"+cust_name+"') ");

st.executeBatch();

con_id.commit();

}//end of for loop

if (qr.isDone())

{

done = true;

}

else

{

qr = bindingIM.queryMore(qr.getQueryLocator());

}

}//end of while done

 

} //end of if qr.getSize()>0

}//end of try

 

 

Could anyone please help me to solve this issue?....

 

Thanks in advance,

VN

  • December 28, 2007
  • Like
  • 0
Hi Guys,
I'm brand new to the salesforce web services APIs and am trying to feel my way around in Java.

What I'd like to do, is create a contact, create and account for that contact, add the contact to the account, then create and Opporunity and add the account to the Opportunity.

I'm stuck on the Account object's setContacts(QueryResult) method.
So I have to issue a query that returns the correct set of contacts that I want to be in this account then set this QueryResult into the account via setContacts()? 
Is there no way to just add a new contact to an accont from the WSDL side?

sorry if I'm missing something obvious.

Thanks!
-John

  • December 17, 2007
  • Like
  • 0