• Climbatize
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies

Hello,

i'm surprised to see that there is no sample client implementation based on AXis2. Has someone already  ported the login sample to axis2 ? Thank you for sharing

 

Hi,

 

I'm experiencing problems with an invent insertion in the Java api.

 

First I create a new instance of my custom object:



TestPlanScheduleC tps = TestPlanScheduleC.Factory.newInstance();

 

Calendar date = Calendar.getInstance();
date.setTime(getJXDatePicker().getDate());
tps.setDesiredDateC(date);
tps.setTestPlanC(saveResult.getId());
tps.setTestPlanR(TP);

SObject[] tab = { tps };


try
{
sfs.Insert(tab);
if(getJCheckBoxCalendar().isSelected())
{
sfs.addToCalendar(new TreeNodeNID(tps), tps.getTestPlanR().getName(), coverTreeTime(), tps.getDesiredDateC());
}
} catch (RemoteException e2)
{..........




 As you can see, mycustom object is created with a java.util.Calendar, with no problem.

But when I creat my event like this:

 

 

public void addToCalendar(final TreeNodeNID treeNodeNID, final String subject, final double d,
final Calendar startDateTime) throws RemoteException, InvalidSObjectFault, InvalidIdFault,
InvalidFieldFault, UnexpectedErrorFault
{

startDateTime.setTimeZone(null);
Event event = Event.Factory.newInstance();
event.setSubject(subject);
event.setDurationInMinutes((int) d);
event.setStartDateTime(startDateTime);
event.setWhatId(treeNodeNID.getId());

Insert(event);

}

 

 

 

 My Insert function throws an error concerning the same Calendar used in my custom object:

 

 

org.apache.axis2.AxisFault: '2009-08-27+02:00' is not a valid value for the type xsd:dateTime



org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
diva.salesforce.webservice.SforceServiceStub.create(SforceServiceStub.java:2645)
diva.Salesforce_session.Insert(Salesforce_session.java:491)
diva.Salesforce_session.Insert(Salesforce_session.java:542)
diva.Salesforce_session.addToCalendar(Salesforce_session.java:1320)
visual.TestPlanPanel$2.actionPerformed(TestPlanPanel.java:552)
javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
javax.swing.DefaultButtonModel.setPressed(Unknown Source)
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
org.jvnet.substance.utils.RolloverButtonListener.mouseReleased(RolloverButtonListener.java:111)
java.awt.Component.processMouseEvent(Unknown Source)
javax.swing.JComponent.processMouseEvent(Unknown Source)
java.awt.Component.processEvent(Unknown Source)
java.awt.Container.processEvent(Unknown Source)
java.awt.Component.dispatchEventImpl(Unknown Source)
java.awt.Container.dispatchEventImpl(Unknown Source)
java.awt.Component.dispatchEvent(Unknown Source)
java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
java.awt.Container.dispatchEventImpl(Unknown Source)
java.awt.Window.dispatchEventImpl(Unknown Source)
java.awt.Component.dispatchEvent(Unknown Source)
java.awt.EventQueue.dispatchEvent(Unknown Source)
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.run(Unknown Source)


 

Does someone see the problem here?
Hi,

I've got an exception trying to upsert on a custom object with php toolkit 13:

Code:
SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'Comment__c' on entity 'contact'. in C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php:419

Stack trace:

#0 [internal function]: SoapClient->__call('upsert', Array)

#1 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php(419): SoapClient->upsert(Object(stdClass))

#2 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceEnterpriseClient.php(93): SforceBaseClient->_upsert(Object(stdClass))

#3 C:\Dev\Workspace\CnV\post.php(34): SforceEnterpriseClient->upsert('Comment__c', Array)

#4 {main}

 
I usually use update function, but now I'd like to upsert. There is my code:

My connexion functions:
Code:
define("SOAP_CLIENT_BASEDIR", "phptoolkit-13_0/soapclient");


require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
require_once ('phptoolkit-13_0/userAuth.php');

function ConnectSession($USERNAME,$PASSWORD)
{


    try 
    {
        $mySforceConnection = new SforceEnterpriseClient();
        $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
        $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
        $_SESSION['connexion'] = $mySforceConnection;

        $_SESSION['location'] = $mySforceConnection->getLocation();
        $_SESSION['sessionId'] = $mySforceConnection->getSessionId();
        $_SESSION['wsdl'] = SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml';

    }
    catch (Exception $e)
    {
        echo $mySforceConnection->getLastRequest();
        echo $e->faultstring;
    }

}

function reconnect()
{
    $location = $_SESSION['location'];
    $sessionId = $_SESSION['sessionId'];
    $wsdl = $_SESSION['wsdl'];

    $mySforceConnection = new SforceEnterpriseClient();
    $sforceSoapClient = $mySforceConnection->createConnection($wsdl);
    $mySforceConnection->setEndpoint($location);
    $mySforceConnection->setSessionHeader($sessionId);

    $_SESSION['connexion'] = $mySforceConnection;
}

 


My upsert code on a 'Test_Case__c' custom object:

Code:
reconnect();

$sObject1 = new stdClass();
$sObject1->Comment__c = $_GET['comments'];
$sObject1->Id = $_GET['id'];


try
{

    $response = $_SESSION['connexion']->upsert('Comment__c',array ($sObject1));

}
catch(Exception $e)
{
    echo "Update FAILED";
    echo "erreur! ".str_replace("\n","<br>",$e);

}

 



and the response:


erreur! SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'Comment__c' on entity 'contact'. in C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php:419

Stack trace:

#0 [internal function]: SoapClient->__call('upsert', Array)

#1 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php(419): SoapClient->upsert(Object(stdClass))

#2 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceEnterpriseClient.php(93): SforceBaseClient->_upsert(Object(stdClass))

#3 C:\Dev\Workspace\CnV\post.php(34): SforceEnterpriseClient->upsert('Comment__c', Array)

#4 {main}


Why does uspert tries to update the contact object instead of my custom one?

My company is still using API version 6.0 and planning to upgrade to the latest one. While generating java files from Enterprise API using Apache Axis2-1.1, I notice that I'm missing com.sforce.soap.enterprise.SforceServiceLocator class. Is this file deprecated in the current API?

 

Also, does anyone have a clue where I can get EnterpriseLoginBean (om.sforce.util.login.EnterpriseLoginBean)? Thanks in advance!

 

Last question, what would be best practices in upgrading API? Do I need to redeploy the whole web app or just need to update the related /WEB-INF/classes?

Hi,

 

I'm experiencing problems with an invent insertion in the Java api.

 

First I create a new instance of my custom object:



TestPlanScheduleC tps = TestPlanScheduleC.Factory.newInstance();

 

Calendar date = Calendar.getInstance();
date.setTime(getJXDatePicker().getDate());
tps.setDesiredDateC(date);
tps.setTestPlanC(saveResult.getId());
tps.setTestPlanR(TP);

SObject[] tab = { tps };


try
{
sfs.Insert(tab);
if(getJCheckBoxCalendar().isSelected())
{
sfs.addToCalendar(new TreeNodeNID(tps), tps.getTestPlanR().getName(), coverTreeTime(), tps.getDesiredDateC());
}
} catch (RemoteException e2)
{..........




 As you can see, mycustom object is created with a java.util.Calendar, with no problem.

But when I creat my event like this:

 

 

public void addToCalendar(final TreeNodeNID treeNodeNID, final String subject, final double d,
final Calendar startDateTime) throws RemoteException, InvalidSObjectFault, InvalidIdFault,
InvalidFieldFault, UnexpectedErrorFault
{

startDateTime.setTimeZone(null);
Event event = Event.Factory.newInstance();
event.setSubject(subject);
event.setDurationInMinutes((int) d);
event.setStartDateTime(startDateTime);
event.setWhatId(treeNodeNID.getId());

Insert(event);

}

 

 

 

 My Insert function throws an error concerning the same Calendar used in my custom object:

 

 

org.apache.axis2.AxisFault: '2009-08-27+02:00' is not a valid value for the type xsd:dateTime



org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
diva.salesforce.webservice.SforceServiceStub.create(SforceServiceStub.java:2645)
diva.Salesforce_session.Insert(Salesforce_session.java:491)
diva.Salesforce_session.Insert(Salesforce_session.java:542)
diva.Salesforce_session.addToCalendar(Salesforce_session.java:1320)
visual.TestPlanPanel$2.actionPerformed(TestPlanPanel.java:552)
javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
javax.swing.DefaultButtonModel.setPressed(Unknown Source)
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
org.jvnet.substance.utils.RolloverButtonListener.mouseReleased(RolloverButtonListener.java:111)
java.awt.Component.processMouseEvent(Unknown Source)
javax.swing.JComponent.processMouseEvent(Unknown Source)
java.awt.Component.processEvent(Unknown Source)
java.awt.Container.processEvent(Unknown Source)
java.awt.Component.dispatchEventImpl(Unknown Source)
java.awt.Container.dispatchEventImpl(Unknown Source)
java.awt.Component.dispatchEvent(Unknown Source)
java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
java.awt.Container.dispatchEventImpl(Unknown Source)
java.awt.Window.dispatchEventImpl(Unknown Source)
java.awt.Component.dispatchEvent(Unknown Source)
java.awt.EventQueue.dispatchEvent(Unknown Source)
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.run(Unknown Source)


 

Does someone see the problem here?

Hello,

i'm surprised to see that there is no sample client implementation based on AXis2. Has someone already  ported the login sample to axis2 ? Thank you for sharing

 

I get this error when updating a custom object.

 

Error updating financial account: No . in address field

Any idea what this is?

  • August 18, 2009
  • Like
  • 0
Hi,

I've got an exception trying to upsert on a custom object with php toolkit 13:

Code:
SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'Comment__c' on entity 'contact'. in C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php:419

Stack trace:

#0 [internal function]: SoapClient->__call('upsert', Array)

#1 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php(419): SoapClient->upsert(Object(stdClass))

#2 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceEnterpriseClient.php(93): SforceBaseClient->_upsert(Object(stdClass))

#3 C:\Dev\Workspace\CnV\post.php(34): SforceEnterpriseClient->upsert('Comment__c', Array)

#4 {main}

 
I usually use update function, but now I'd like to upsert. There is my code:

My connexion functions:
Code:
define("SOAP_CLIENT_BASEDIR", "phptoolkit-13_0/soapclient");


require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
require_once ('phptoolkit-13_0/userAuth.php');

function ConnectSession($USERNAME,$PASSWORD)
{


    try 
    {
        $mySforceConnection = new SforceEnterpriseClient();
        $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
        $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
        $_SESSION['connexion'] = $mySforceConnection;

        $_SESSION['location'] = $mySforceConnection->getLocation();
        $_SESSION['sessionId'] = $mySforceConnection->getSessionId();
        $_SESSION['wsdl'] = SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml';

    }
    catch (Exception $e)
    {
        echo $mySforceConnection->getLastRequest();
        echo $e->faultstring;
    }

}

function reconnect()
{
    $location = $_SESSION['location'];
    $sessionId = $_SESSION['sessionId'];
    $wsdl = $_SESSION['wsdl'];

    $mySforceConnection = new SforceEnterpriseClient();
    $sforceSoapClient = $mySforceConnection->createConnection($wsdl);
    $mySforceConnection->setEndpoint($location);
    $mySforceConnection->setSessionHeader($sessionId);

    $_SESSION['connexion'] = $mySforceConnection;
}

 


My upsert code on a 'Test_Case__c' custom object:

Code:
reconnect();

$sObject1 = new stdClass();
$sObject1->Comment__c = $_GET['comments'];
$sObject1->Id = $_GET['id'];


try
{

    $response = $_SESSION['connexion']->upsert('Comment__c',array ($sObject1));

}
catch(Exception $e)
{
    echo "Update FAILED";
    echo "erreur! ".str_replace("\n","<br>",$e);

}

 



and the response:


erreur! SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'Comment__c' on entity 'contact'. in C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php:419

Stack trace:

#0 [internal function]: SoapClient->__call('upsert', Array)

#1 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceBaseClient.php(419): SoapClient->upsert(Object(stdClass))

#2 C:\Dev\Workspace\CnV\phptoolkit-13_0\soapclient\SforceEnterpriseClient.php(93): SforceBaseClient->_upsert(Object(stdClass))

#3 C:\Dev\Workspace\CnV\post.php(34): SforceEnterpriseClient->upsert('Comment__c', Array)

#4 {main}


Why does uspert tries to update the contact object instead of my custom one?
Hello guys,

I am trying to upsert a new account in to the sales force database. I have a custom wrapper function to do this in our system. Here is my code:

function sf_insertData($ArrData)
{
    global $mySforceConnection, $mySoapClient, $mylogin, $ArrErrMsgs;
    $sObject = new sObject();
    $sObject->type = 'Contact';
   
// No Need to see this code
    $ArrData['fields'] = array_combine(sf_mapSfFields(array_keys($ArrData['fields']),$ArrData['type']), array_values($ArrData['fields']));



    $sObject->fields = $ArrData['fields'];

    $result = $mySforceConnection->upsert('AccountId', array($sObject));
    return $result;
}

With all the processing, I ultimately have this Object that goes into the upsert call:

SObject Object
(
[type] => Contact
[fields] => Array
(
[FirstName] => Ankit Chbbad
[Phone] => 123456
[AccountId] => 0014000000Id67gAAB
)

)

When i run this code I get this error:


Fatal error: Uncaught SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'fields' on entity 'contact'. in /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php:396 Stack trace: #0 [internal function]: SoapClient->__call('upsert', Array) #1 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php(396): SoapClient->upsert(Object(stdClass)) #2 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceEnterpriseClient.php(93): SforceBaseClient->_upsert(Object(stdClass)) #3 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/sf_functions.php(169): SforceEnterpriseClient->upsert('AccountId', Array) #4 /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/sf_functions.php(41): sf_insertData(Array) #5 {main} thrown in /home/.trine/ibc2007/beta.illinoisbusinessconsulting.com/salesforce/soapclient/SforceBaseClient.php on line 396



what's wrong here?? I have kinda hit my head enuf on the walls :(