Solved

Where do I put a cfc file that describes a complex structure for a web service?

Posted on 2011-03-25
5
620 Views
Last Modified: 2012-05-11
Hi!

I'm trying to create a web service in ColdFusion 9 that returns a complex structure or has a complex argument.  I am placing the .cfc file that describes the structure in the same directory as the .cfc that is using the structure.  RIght now I'm just trying to get a wsdl.

I currently have two functions in my .cfc,  The first one returns a string.  The second one ideally returns an array of strings.  Saying returntype="string[]"  gives an error that ColdFusion could not parse string

So I tried making a defined type with the individual element being a string:

<cfcomponent>
    <cfproperty name="InfoSource" type="string">
<cfcomponent>

------------------------------------
My code that uses this cfc is:

<cfcomponent>
    <cffunction name="getzips" access="remote" returntype="string">
       <cfset #resultsCommaDelimtedZips# = "this is the result">
      <cfreturn CommaDelimitedZips>
    </cffunction>

    <cffunction name="getInfoSources" access="remote" returntype="InfoSources[]">
    </cffunction>
</cfcomponent>

The error that I get is:

AXIS error

Sorry, something seems to have gone wrong... here are the details:

Fault - Error attempting to create Java skeleton for CFC web service.; nested exception is:
      coldfusion.xml.rpc.CFCInvocationException: [coldfusion.compiler.ParseException : Invalid CFML construct found on line 3 at column 1.ColdFusion was looking at the following text:<p>&lt;</p><p>The CFML compiler was processing:<ul>&lt; marks the beginning of a ColdFusion tag.Did you mean LT or LTE?</ul>]

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode:
 faultString: Error attempting to create Java skeleton for CFC web service.; nested exception is:
      coldfusion.xml.rpc.CFCInvocationException: [coldfusion.compiler.ParseException : Invalid CFML construct found on line 3 at column 1.ColdFusion was looking at the following text:<p>&lt;</p><p>The CFML compiler was processing:<ul>&lt; marks the beginning of a ColdFusion tag.Did you mean LT or LTE?</ul>]
 faultActor:
 faultNode:
 faultDetail:
      {http://xml.apache.org/axis/}hostname:ntc15

----------------------------
I have a similar problem if I use cfproperty:

<cfcomponent>
    <cfproperty name="approved" type="string">
    <cfproperty name="total_charged" type="string">
    <cfproperty name="charge_error" type="string">
    <cfproperty name="renewed_until" type="string">
    <cfproperty name="reason" type="string">
<cfcomponent>

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=webservices_20.html says
Note: If the component files are not in a directory under your web root, you must create a web server mapping to the directory that contains them. You cannot use ColdFusion mappings to access web services.

So I tried putting the .cfc file in a directory beneath my wwwroot folder rather than in it.  That didn't help.

Any suggestions?  I feel like I've done exactly what all the documentation I can find tells me to do!

Thanks!

-- Mabel :-)
mliang@datacollaborative.com
0
Comment
Question by:DataCollab
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
Hammo777 earned 500 total points
ID: 35220120
I think the return type has to be "array" or the name of a component (or the dot delimeted path to it).  It doesn't like the brackets.  I think you can also just use returntype="any"
0
 

Author Comment

by:DataCollab
ID: 35220151
We're working with another company that is doing the front end and using the web service, so I have to have the wsdl show the actual data type, not just "any". But I'll try that just to see if I can get a better result.   I had a similar problem when I tried the name of the component, InfoSources.  I'll try the array - but how do I tell it an array of _strings_ specifically?

Thanks!
0
 
LVL 4

Assisted Solution

by:Hammo777
Hammo777 earned 500 total points
ID: 35220334
I am not sure.  See if this helps.  This guy is an excellent resource for all things CF where webservices are concerned:
http://tjordahl.blogspot.com/2008/04/array-types-in-coldfusion-web-services.html
0
 

Author Comment

by:DataCollab
ID: 35220378
Hammo777,

Thanks!  I had already found that post.  I've finally gotten something to work by making my file names and component names be all lower case.  It makes no sense to me, but I do finally have a WSDL.

FWIW, my files are all in the same directory.

Thanks for your help!

0
 

Author Closing Comment

by:DataCollab
ID: 35220395
I still don't know how to specify an array of strings, and the answer provided didn't tell me  where to put the other .cfc file.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question