Skip to main content
December 30, 2008
Question

Java to Cold fusion

  • December 30, 2008
  • 3 replies
  • 1024 views
Hey Guys,
I am at wits end here. I am trying to get Cold Fusion to integrate with Salesforce. They give me some sample code in Java, but I don't know Java well enough to understand what its doing or how to rewrite it into CF. Please help, I've been trying for like 6 hours now (all kinds of different approaches) and I'm just totally stuck.

This is where I got the sample code.
http://www.salesforce.com/us/developer/docs/sforce70/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sforceAPI_WWHelp&file=sforce_API_calls_concepts.html


    This topic has been closed for replies.

    3 replies

    Participating Frequently
    December 30, 2008
    This code creates 2 Account instances, populates them with some data, then stores them in an array of another class called SObject.

    This array of SObjects (which is actually storing 2 Account objects) is passed to binding.create, in the code that you didn't paste, below.

    The Account class is detailed here:
    http://www.salesforce.com/us/developer/docs/sforce70/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sforceAPI_WWHelp&file=sforce_API_objects_Account.html#wp1725759

    The sObject class is detailed here:
    http://www.salesforce.com/us/developer/docs/sforce70/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sforceAPI_WWHelp&file=sforce_API_calls_about_sObject.html#wp3130384

    I didn't download the sample code to find out what "binding" is in the code below, but I'm assuming it's the logged-in web service connection, which is a SoapBindingStub, outlined in the full code here:
    http://www.salesforce.com/us/developer/docs/sforce70/wwhelp/wwhimpl/common/html/wwhelp.htm?context=sforceAPI_WWHelp&file=sforce_API_calls_concepts.html
    December 30, 2008
    Thanks for the info. I've made some progress, but I can't seem to create the SObject in the way that Salesforce wants it. I am using the following code

    My Demo app can be seen here
    http://www.digitalswordsmen.com/cfschedule/SFIntegration/Webservice_test.cfm

    The WSDL is here
    http://www.digitalswordsmen.com/cfschedule/SFIntegration/Enterprise.wsdl

    Let me know if you can see what I am doing wrong. I am fairly new to web services, and am probably making a dumb mistake.

    By the way, I created a custom object called Test__c, so that's what that is. It only has one field to fill in, "name". The rest of the stuff you see about it in the WSDL is just system maintained info.
    Participating Frequently
    December 31, 2008
    I'm assuming you wrote the sfcomponent? What does the getSFObject method do?
    <cfset aTest = sfcomponent.getSfObject("Test__c")>

    If aTest isn't an instance of SObject (the actual Java class), then your code isn't going to work. That's what this error means:
    Web service operation create with parameters {[[(Component=CFSchedule.SFIntegration.sfobject)]]} cannot be found.

    You are calling the create() method and passing it something it doesn't understand. You must pass it an array of SObject classes.

    You need to post the code from your component that you wrote.
    Inspiring
    December 30, 2008
    Kinda hard to translate it if you don't know what the Account() object does. The CF equivalent might be a structure. Then you didn't say what gets tried at the end.

    Can you explain in plain english what the final result is supposed to be when the java program gets run? If so, maybe you can ignore the java code and write it up from scratch in cfml.
    Inspiring
    December 30, 2008
    My first sugestion would be to just take the java code as is and then
    call it with a <cfobject...> or <cfinvoke...> or possible a
    <cfexecute...> tag.

    There are several ways that ColdFusion can directly call Java code and
    that can be a great way to extend ColdFusion's basic funtionality.

    Other then that, you are probably going to need help from somebody who
    knows more about Salesforce then just it's name - which is not me.
    December 30, 2008
    I would, except... I HATE java. I cannot even put into words how much I would like to watch it burn. mostly because of classpaths and how they never work. I don't understand them at all.