Skip to main content
Participant
July 12, 2008
Question

Publish ColdFusion Web Service with Complex Return Type

  • July 12, 2008
  • 2 replies
  • 373 views
Hi,

I am working on a project to publish couple ColdFusion webservices. The cosumer of those webservices is a Java application.

One of my webservice need return an object. Here are demo codes:

The returned ojbect is AddressRespond

AddressRespond.cfc:
<cfcomponent>
<cfproperty name="addresses" type="Address[]" />
<cfproperty name="myLearnException" type="MyException" />
</cfcomponent>

Address.cfc:
<cfcomponent>
<cfproperty name="city" type="string" />
<cfproperty name="state" type="string" />
</cfcomponent>

MyException.cfc:
<cfcomponent>
<cfproperty name="code" type="string" />
<cfproperty name="reason" type="string" />
</cfcomponent>

If the webservice "cosumer" is a ColdFusion application, there is no any problems. But the Java application doesn't understand the type of addresses in the WSDL file which is gernerated by ColdFusion:

<complexType name="Address">
<sequence>
<element name="city" nillable="true" type="xsd:string"/>
<element name="state" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="MyException">
<sequence>
<element name="code" nillable="true" type="xsd:string"/>
<element name="reason" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="AddressRespond">
<sequence>
<element name="addresses" nillable="true" type="tns1:ArrayOf_xsd_anyType"/>
<element name="MyException" nillable="true" type="impl:MyException"/>
</sequence>
</complexType>

Could anybody give me any idea on how to resolve this problem?

Thanks!
This topic has been closed for replies.

2 replies

Participant
March 5, 2009
Did you ever solve this? I am having the same problem with VB .net
Inspiring
July 13, 2008
The web service is actually the function, not the cfc and you didn't show a function.

My own opinion is that since webservices by definition should be available to any calling app (cold fusion, .net, flash, etc), whatever gets returned from the method should be as universally recognizable as possible. This generally means text, numbers, boolean, or xml.
toniu27Author
Participant
July 15, 2008
The function is:

<cffuction name="test" access="remote" output="no" returnType="addressRespond">
......
<cfreturn addressRespond />
</cffunction>

The Java client expects to receive "addresses" as an array of "Address". But in WSDL, the type of "addresses" is "any".

Any advise?

Thanks!