Friday September 05, 2008
keychain: Tips for running salesforce.com solution
The Salesforce.com solution shows how to use SPML Gateway to manage provisioning information related to users in Salesforce.com. Using this solution we can add, modify and look up users in salesforce.com.
Since the Salesforce.com solution is built on OpenESB platform, first we have to download and install OpenESB build.
The Salesforce.com solution is a Netbeans solution project which can be downloaded from downloads option of project keychain. The solution will have a bpel module and a composite application module as shown in the below image.
This solution has to be configured with respect to a Salesforce.com developer account in order to run the composite application test cases shown in the above image.
If you are not already a member of the salesforce.com developer community, go to http://www.salesforce.com/signup/dev_signup.jsp and follow the instructions for signing up for a Developer Edition account. Once account is created go to the setup->Personal Setup->My Personal Information->Reset My Security Token and click on the reset security token button. The security token will be sent to the email id given during salesforce.com account creation. Please take a note of username, password and security token of your salesforce.com developer account.
Steps to configure the UserAdd, UserLookup and UserModify bpel processes in the SPMLGatewaySalesforceBpelModule :
Click on the UserAdd.bpel and Assign1 basic activity which will take you to the below image. Please edit these fields and fill your username, password and security token. Follow the same procedure for UserLookup.bpel and UserModify.bpel.
After configuring all the bpel processes, the solution is ready for deployment. Before deploying you may want to configure the HTTP BC logging to finest level, in order to track the errors. Go to Services tab->GlassFishV2->JBI->Binding Components->sun-http-binding and right click and set the sun-http-binding loggers property to FINEST. Now clean and build the "SPMLGatewaySalesforceCompositeApp" and deploy to Glassfish app server. Please ignore any warnings during build process of the composite application.
Steps to run the composite application test cases :
Before running the test cases you may want to download and install Apex explorer. This handy tool lets developers browse their schema, custom objects and fields, and build and test SOQL queries. Please use your salesforce.com username and password + security token to log in. This solution works with respect to the "User" SObject. The add, modify and lookup operations are related to the "User" SObject.
Test Case User Add :
Before running the user add test case try to run the following SOQL query in apex explorer. Please take a note of your default active user's "Profile ID", "Id" values from query result.
Query : Select ProfileID,Username,FirstName,LastName,Alias,Email,EmailEncodingKey,IsActive,LanguageLocaleKey,TimeZoneSidKey,Id from User
In the user add test case data node, try to fill your "Profile ID" value and give a different "Username" and run the test case. This should add a new user (non active) in salesforce.com. If you get a failure message, try to search for the error in glassfish server log and debug it.
<urn:data>
<urn1:addRequestXSD>
<urn1:User>
<urn2:Alias>gaddison</urn2:Alias>
<urn2:Email>Gene.Addison@sunx.com</urn2:Email>
<urn2:EmailEncodingKey>ISO-8859-1</urn2:EmailEncodingKey>
<urn2:FirstName>Gene</urn2:FirstName>
<urn2:IsActive>false</urn2:IsActive>
<urn2:LanguageLocaleKey>en_US</urn2:LanguageLocaleKey>
<urn2:LastName>Addison</urn2:LastName>
<urn2:LocaleSidKey>en_US</urn2:LocaleSidKey>
<urn2:ProfileId>00e40000000ofFIAAI</urn2:ProfileId>
<urn2:TimeZoneSidKey>America/Los_Angeles</urn2:TimeZoneSidKey>
<urn2:Username>GeneRag1.Addison@sunx.com</urn2:Username>
</urn1:User>
</urn1:addRequestXSD>
</urn:data>
Test Case Lookup :
Fill the "Id" value of the user that you want to lookup and run the test case. You can get the "Id" value by running the SOQL query in apex explorer. The gateway will fetch the data related to this "Id".
Request :
<soapenv:Body>
<urn:lookupRequest requestID="?string?" executionMode="?asynchronous?" returnData="everything">
<urn:psoID ID="005400000012AOFAA2" targetID="?string?">
<!--Optional:-->
<urn:containerID/>
</urn:psoID>
</urn:lookupRequest>
</soapenv:Body>
Response:
<ns1:lookupResponse xmlns:msgns="urn:oasis:names:tc:SPML:2:0:wsdl" xmlns:ns1="urn:oasis:names:tc:SPML:2:0" status="success">
<ns1:data>
<ns4:lookupResponseXSD xmlns:ns4="urn:oasis:names:tc:XSD:2:0:core">
<ns4:User xmlns:sf="urn:sobject.enterprise.soap.sforce.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sf:User">
<sf:Id>005400000012AOFAA2</sf:Id>
<sf:Alias>gaddison</sf:Alias>
<sf:Email>gene.addison@sunx.com</sf:Email>
<sf:EmailEncodingKey>ISO-8859-1</sf:EmailEncodingKey>
<sf:FirstName>Gene</sf:FirstName>
<sf:IsActive>false</sf:IsActive>
<sf:LanguageLocaleKey>en_US</sf:LanguageLocaleKey>
<sf:LastName>Addison</sf:LastName>
<sf:LocaleSidKey>en_US</sf:LocaleSidKey>
<sf:ProfileId>00e40000000ofFlAAI</sf:ProfileId>
<sf:TimeZoneSidKey>America/Los_Angeles</sf:TimeZoneSidKey>
<sf:Username>generag.addison@sunx.com</sf:Username>
</ns4:User>
</ns4:lookupResponseXSD>
</ns1:data>
</ns1:lookupResponse>
Test Case User Modify :
In the test case data node try to set the "Profile ID", "Id" of the user you want to update and give a different username and try to run the test case. The username should get updated in salesforce.com
<urn:data>
<urn1:modificationXSD>
<urn1:User>
<urn2:Id>005400000012AOFAA2</urn2:Id>
<urn2:Alias>gautry</urn2:Alias>
<urn2:Email>Gene.Autry@sunx.com</urn2:Email>
<urn2:EmailEncodingKey>ISO-8859-1</urn2:EmailEncodingKey>
<urn2:FirstName>Joe</urn2:FirstName>
<urn2:IsActive>false</urn2:IsActive>
<urn2:LanguageLocaleKey>en_US</urn2:LanguageLocaleKey>
<urn2:LastName>Autry</urn2:LastName>
<urn2:LocaleSidKey>en_US</urn2:LocaleSidKey>
<urn2:ProfileId>00e40000000ofFlAAI</urn2:ProfileId>
<urn2:TimeZoneSidKey>America/Los_Angeles</urn2:TimeZoneSidKey>
<urn2:Username>Geneupdated.Autry@sunx.com</urn2:Username>
</urn1:User>
</urn1:modificationXSD>
</urn:data>
Posted at 09:44PM Sep 05, 2008 by Raghu Kolar in Sun | Comments[0]