ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old June 23rd, 2004, 11:37 PM
rpramod rpramod is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 rpramod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unable to invoke method of COM object

I am just abt 3 days old to Cold Fusion programming and I am encountering a rather frustrating error : I am unable to invoke a method of a COM object. The code segment is :

<CFSET objContact = objBOContact.NewContact(objuser,true)>
<CFSET objContact.FirstName = #FORM.txtFirstName#>
<CFSET objContact.LastName = #FORM.txtLastName#>
<!--- ERROR OCCURS ON THE FOLLOWING LINE --->
<CFSET objAddress = objContact.GetAddressByPurpose('Address')>

Error Message : The selected method GetAddressByPurpose was not found
Details : Either there are no methods with the specified method name and argument types, or the method GetAddressByPurpose is overloaded with arguments types that ColdFusion can't decipher reliably. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity.


I am able to access attributes of teh object but not the method. Strange!! I tried passing the parameter to teh call with single quotes, double quotes, without quotes etc to no avail. The method exists and the parameter info is also correct. I verified it by developing a .net client.

Any help on this will be appreciated. I am running Cold Fusion MX 6.1 on Windows 2000 Pro, if this is of any help.

Thanks in advance
Pramod

Reply With Quote
  #2  
Old June 24th, 2004, 08:36 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 10 m 11 sec
Reputation Power: 42
Are you actually creating an instance of the object with CFOBJECT or createObject()?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old June 24th, 2004, 05:29 PM
rpramod rpramod is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 rpramod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No I am not using CFOBJECT of createObject(). If u observe the code above, i am getting a reference to the object objContact by calling the method NewContact(...) which works fine.

Reply With Quote
  #4  
Old June 24th, 2004, 08:07 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 10 m 11 sec
Reputation Power: 42
Yes, but where are you defining what "objBOContact" is? How does CF know what object you are referring to? Is this a static method?

Reply With Quote
  #5  
Old June 24th, 2004, 10:17 PM
rpramod rpramod is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 rpramod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Full code segment

Appended below is the segment of code that is using the objects. Hope this will help with suggestions, Sorry for not publishing the full segment before.

Pramod


<cftry>
<CFOBJECT
ACTION="CREATE"
CLASS="iboUserSecurity.CUser"
NAME="objUser"
TYPE="COM">

<CFSET OBJUser.DBID = "ODBC:myDSN">
<!--- <CFSET usrUser.UserID = "ibo"> --->

<CFOBJECT
ACTION="CREATE"
CLASS="iboContactManagement.CContactsBOAdmin"
NAME="objBOContact"
TYPE="COM">


<CFSET objContact = objBOContact.NewContact(objuser,true)>


<!--- <cfset errErrors = objContact.Errors>
<CFINCLUDE TEMPLATE="iBOHandleErrors.cfm">
<CFIF errMessage GT " ">
<CFEXIT>
</CFIF> --->

<CFSET objContact.Prefix = #FORM.cmbPrefix#>
<CFSET objContact.FirstName = #FORM.txtFirstName#>
<CFSET objContact.LastName = #FORM.txtLastName#>

<CFSET objContact.BirthDate = #FORM.cmbDate# & #FORM.cmbMonth# & #FORM.txtYear#>

<CFSET objContact.Gender = #FORM.cmbGender#>
<CFSET objContact.MemberType = "ENSB">
<CFSET objContact.Status = "A">
<CFSET objContact.Email = #FORM.txtEMail#>
<CFSET objContact.HomePhone = #FORM.txtHomePhone#>
<CFSET objContact.WorkPhone = #FORM.txtWorkPhone#>
<CFSET objContact.TollFreePhone = #FORM.txtMobilePhone#>
<CFSET objContact.Suffix = #FORM.optPreference#>

<!--- ERROR OCCURS ON THE FOLLOWING LINE --->
<CFSET objAddress = objContact.GetAddressByPurpose('Address')>

<CFSET objAddress.Purpose = "Address">
<CFSET objAddress.AddrLine1 = #FORM.txtAddress1#>
<CFSET objAddress.AddrLine2 = #FORM.txtAddress2#>
<CFSET objAddress.City = #FORM.txtCity#>
<CFSET objAddress.PostalCode = #FORM.txtPostCode#>
<CFSET objAddress.StateProvince = #FORM.cmbState#>
<CFSET objAddress.Country = #FORM.cmbCountry#>
all well 3
<CFSET objContact.Errors.ClearErrors()>

<CFSET objContact.SubmitChanges()>

<cfset errErrors = objContact.Errors>
<CFINCLUDE TEMPLATE="iBOHandleErrors.cfm">
<CFIF errMessage GT " ">
<CFEXIT>
</CFIF>
<cfcatch>
<CFOUTPUT>
<CFLOCATION
url = "ApplicationError.cfm?Path=adduserSubscribe&Type=#cfcatch.type#&Source=#cfcatch.Detail#&Message=#cfcatch.Message#">
</CFOUTPUT>
<!---
<CFOUTPUT><BR> Message : #cfcatch.message# <br>
Details : #cfcatch.detail#
Type : #cfcatch.type#
</CFOUTPUT>
<cfabort> --->
</cfcatch>
</cftry>
</CFIF>

Reply With Quote
  #6  
Old June 25th, 2004, 08:21 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 10 m 11 sec
Reputation Power: 42
Can you do a CFDUMP of the object once you've created it? According to the error, you are either calling a method that doesn't exist or you are passing incorrect arguments to the method. The fact that you are able to create the object without an error seems to mean that the problem is in the name of the method or the arguments.

Reply With Quote
  #7  
Old June 27th, 2004, 09:22 PM
rpramod rpramod is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 rpramod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Tried a CFDUMP

About your thought that the method name could be wrong, I have tried using the same component throught a .net client -works perfectly fine with the same method name, same parameters.

CFDUMP tells me that the object is undefined.

<CFSET objContact = objBOContact.NewContact(objuser,true)>

<CFDUMP
var = "#objContact#"
expand = "Yes"
label = "OBJCONTACT">

A CFDUMP on objBOContact gives me all the methods available in the object, so i guess the call to the NewContact method is returning nothing.

It isnt the desired output from the method, what i am wondering is if my way passing the parameters objUser and the boolean value true are correct??

Reply With Quote
  #8  
Old June 28th, 2004, 10:29 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 18 h 10 m 11 sec
Reputation Power: 42
It definitely seems then that something is not right with the arguments that you're passing. Remember that CF is typeless and (for example) has no real concept of a type, like Boolean. It does *sort of* when it comes to things like return types from CFCs, etc, but this could easily be where the problem is. This is where the JavaCast() function comes into play when calling methods on Java classes. Whether that would work for a COM object I don't know (I doubt it). Is the boolean argument required? Would it work if you omitted that argument?

Reply With Quote
  #9  
Old June 29th, 2004, 09:42 PM
rpramod rpramod is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 5 rpramod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
problem Solved

Uninstalled and reinstalled Cold Fusion MX Server and i can invoke the method without any problem. Frustrating ......... but solved the problem. Nevertheless, Thanx Kiteless.

Cheers
Pramod

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Unable to invoke method of COM object


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway