Skip to main content
Participant
September 11, 2006
Question

consuming webservice with input type of enum

  • September 11, 2006
  • 3 replies
  • 2686 views
When trying to consume a webservice (temporarily located on a server within my intranet) I get this Cold Fusion Error:

Web service operation "getIndustries" with parameters {CareerStart} could not be found.

This is what is in the wdsl file for the function I am trying to access:

- <s:element name="getIndustries">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="getIndustriesRequest" type="tns:CareerTrack" />
</s:sequence>
</s:complexType>
</s:element>
- <s:simpleType name="CareerTrack">
- <s:restriction base="s:string">
<s:enumeration value="CareerStart" />
<s:enumeration value="ContinuingEd" />
</s:restriction>
</s:simpleType>
- <s:element name="getIndustriesResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="getIndustriesResult" type="tns:ArrayOfKeyValuePair" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="ArrayOfKeyValuePair">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="KeyValuePair" nillable="true" type="s1:KeyValuePair" />
</s:sequence>
</s:complexType>
- <s:complexType name="KeyValuePair">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Key" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Value" type="s:string" />
</s:sequence>
</s:complexType>

I am attempting to use this function with cold fusion like so:

<CFPARAM name="CareerTrack" default="CareerStart" type="string">
<CFOBJECT webservice="#webservice#"
name="regExchange">

<cfset aArrayOfKeyValuePair = regExchange.getIndustries(#CareerTrack#)>

Is there something about passing in values to a type of enum that is special?

I think I should have visibility to the webservice based on the evidence that when I set the wdsl url in Dreamweaver, it shows me the service function definitions and I can drag and drop them into my code.
This topic has been closed for replies.

3 replies

OneLove
Participant
August 29, 2014

Try setting wsversion = 1.

<cfscript>
  args = { refreshWSDL=true, wsversion=1 };
  ws = createObject("webservice", "http://mysite/test.asmx?wsdl", args);
  result = ws.getAccountLinksByUser("test@somewhere.com", "All");
  writeDump(result);
</cfscript>


Issue using .net web service from ColdFusion - Stack Overflow

Inspiring
December 26, 2006
I've had problems using Coldfusion to consume web services using non-simple parameters (especially .NET web services). The enumeration type seems to be one of these. Check out this thread for a possible work-around:

http://www.houseoffusion.com/groups/CF-Talk/thread.cfm/threadid:30232
Participant
December 27, 2006
Hi,

Thanks a lot for the response, as I had no hopes of anybody reading my message.
Well, I had read this post earlier, but I believe the person has implemented a java class that can return a enum datatype to the consuming program. I am not sure if this works out. Also I am not sure, how to write a java class that can wrap data and return enumerations.
Also I had yet another method of sending enum datatype to the webservice method, which is as below.
<cfscript>
ps = CreateObject("java", "java.util.Properties");
ps.setProperty("0", "Orange");
ps.setProperty("1", "Mango");
keys = ps.keys();
while (keys.hasMoreElements()){
k = keys.nextElement();
v = ps.getProperty(k);
}
</cfscript>

If you loop and output, you will get the key value pair. But I am not sure if this is an enumerations type.
However, can you let me know if you had a workaround for the enum problem ?

--Prashant
Participant
December 26, 2006
Hi,

Have you had any luck consuming enumerations in the web service? I too have the same problem.

-Prashant