Skip to main content
January 14, 2011
Question

Problem with Coldfusion generated wsdl file

  • January 14, 2011
  • 2 replies
  • 951 views

Hi all!

We have created a web service with ColdFusion8. One of the functions (GetDeviceAlarms) returns an array of cfobjects.

The result from the function might be an empty result, therefore I need to set minOccurs="0" for the element "GetDeviceAlarmsReturn".
If this attribute is not set the validation against the schema fails on empty results.

Is there any way to tell ColdFusion to set minOccurs="0" for the element GetDeviceAlarmsReturn?

# Code

<cffunction name="GetDeviceAlarms" access="remote" returntype="alarmstatus_type[]"
            description="desc"
            hint="hint">

<cfobject component="alarmstatus_type" name="alarmStruct">


# WSDL

<wsdl:operation name="GetDeviceAlarms">
  <wsdl:input message="impl:GetDeviceAlarmsRequest" name="GetDeviceAlarmsRequest"/>
  <wsdl:output message="impl:GetDeviceAlarmsResponse" name="GetDeviceAlarmsResponse"/>
    <wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException"/>
</wsdl:operation>


// Generated wsdl
<element name="GetDeviceAlarmsResponse">
    <complexType>
      <sequence>
        <element maxOccurs="unbounded" name="GetDeviceAlarmsReturn" type="impl:Alarmstatus_type"/>
      </sequence>
    </complexType>
</element>


// What I would like to accomplish
<element name="GetDeviceAlarmsResponse">
    <complexType>
      <sequence>
        <element minOccurs="0" maxOccurs="unbounded" name="GetDeviceAlarmsReturn" type="impl:Alarmstatus_type"/>
      </sequence>
    </complexType>
</element>


// Best Regards Kalle

This topic has been closed for replies.

2 replies

Participating Frequently
June 1, 2011

WARNING: if Coldfusion 8, and have OnRequest() in application.cfc, this will not work --it is a  known cf8 bug.  For a workaround, see
http://www.coldfusionjedi.com/index.cfm/2008/3/19/Ask-a-Jedi-Ajaxbound-requests-and-onRequest

Inspiring
January 18, 2011

In thiscase you may need to add it manually. To do this you could use

the cfcomponent tag's wsdlfile attribute. Basically, copy the

dynamically generated WSDL, add the minOccurs as needed, then point

the wsdlfile attribute of the component to the saved, static WSDL.

--Nathan

January 19, 2011

Ok, thanks for your reply!