Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Java to Cold fusion

Guest
Dec 30, 2008 Dec 30, 2008
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=s...


871
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 30, 2008 Dec 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 30, 2008 Dec 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 30, 2008 Dec 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 30, 2008 Dec 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=s...

The sObject class is detailed here:
http://www.salesforce.com/us/developer/docs/sforce70/wwhelp/wwhimpl/common/html/wwhelp.htm?context=s...

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=s...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 30, 2008 Dec 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 30, 2008 Dec 30, 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 31, 2008 Dec 31, 2008
Hey,
I didn't write this chunk of code, I found it online somewhere. Anyway, it's what I've been using.
Oh also, test__c is a valid object type. I created it in my Salesforce org, and downloaded the new WSDL with the defenition for it included. It is

<complexType name="Test__c">
<complexContent>
<extension base="ens:sObject">
<sequence>
<element name="ActivityHistories" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Attachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="CreatedBy" nillable="true" minOccurs="0" type="ens:User"/>
<element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="Events" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="GoogleDocs" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Histories" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="IsDeleted" nillable="true" minOccurs="0" type="xsd:boolean"/>
<element name="LastActivityDate" nillable="true" minOccurs="0" type="xsd:date"/>
<element name="LastModifiedBy" nillable="true" minOccurs="0" type="ens:User"/>
<element name="LastModifiedById" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="LastModifiedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="Name" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="Notes" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="NotesAndAttachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="OpenActivities" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Owner" nillable="true" minOccurs="0" type="ens:Name"/>
<element name="OwnerId" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="ProcessInstances" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="ProcessSteps" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="SystemModstamp" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="Tasks" nillable="true" minOccurs="0" type="tns:QueryResult"/>
</sequence>
</extension>
</complexContent>
</complexType>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 31, 2008 Dec 31, 2008
When you got this component from the web, did you get the sfobject component as well? that's what this line is doing:
<cfobject component="sfobject" name="theObj">
Do you have all your mappings setup right?

Where'd you get this code? Maybe you should post a question to the person that originally wrote it, see if they have any ideas...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 31, 2008 Dec 31, 2008
Hey,
The thread where i found this code is like 2 years old, so that would probably be a dead end. Actually it doesn't really matter anymore. I've decided just to do it all through SOAP. It seems that Web services are just not going to work for me, and based on the luck I've had with them in the past, are not ready for prime time. Maybe the next version of the Axis engine will work better. I dunno. Either way, SOAP seems pretty reliable for now, so I'm just gonna go that way. Thanks for the help guys.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 31, 2008 Dec 31, 2008
kenji776 wrote:
> I've decided just to do it all through SOAP. It seems that Web services are just not going to work
> for me


I'm a bit confused? I thought SOAP was one form of Web Services?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 01, 2009 Jan 01, 2009
LATEST
I suppose technically it is.
In this case I meant that instead of trying to consume and use their WSDL and call the resulting functions, I would just send actual SOAP requests to their listener service. I am not super strong on web services and such, but to me there are just different ways of accomplishing the same thing.

You can either use their generated WSDL, have your code "consume" it, and use the functions and methods that are found in the WSDL (this was my first method).

Or you can just construct actual SOAP messages (XML data basically) and send that to some page that is listening for SOAP and can process the data contained in your messages. This is the approach I have opted for, as I simple could not get the syntax or whatever right for using the WSDL method.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources