Skip to main content
Participant
July 1, 2011
Question

Web Service Complex Datatypes

  • July 1, 2011
  • 1 reply
  • 530 views

Does ColdFusion support nested complex data types when building Web Services?  See example CFCs below.  I keep getting a ServiceMethodNotFoundException.  In my SubmitNoticeOfAppt.cfc, the cfargument data type is NoticeOfAppointment.CFC which references other CFCs that define complex data types. The complex types are needed to support a really complex XML document that must be NIEM (National Information Exchange Model) compliant.  Originally tried passing the NIEM XML doument as a string, but receive deserialization errors, encounter child element.  Could get around the error by wrapping the XML string in <![CDATA[ ... ]]>, but this convention is not NIEM compliant.

DocumentIssueDate.cfc

<cfcomponent displayname="DocumentIssueDate" output="false">
   <cfproperty name="Date" type="date" required="No">
</cfcomponent>


DocumentAugmentation.cfc

<cfcomponent displayname="DocumentAugmentation" output="false">
   <cfproperty name="DocumentIssueDate" type="any" required="No">
</cfcomponent>


DocumentIdentification.cfc

<cfcomponent displayname="DocumentIdentification" output="false">
   <cfproperty name="IdentificationID" type="numeric" required="Yes">
   <cfproperty name="IdentificationCategoryDescriptionText" type="string" required="No">
</cfcomponent>


NoticeOfAppointment.cfc

<cfcomponent displayname="NoticeOfAppointment" output="false">
   <cfproperty name="DocumentIdentification" type="any" required="Yes">
   <cfproperty name="DocumentAugmentation" type="any" required="Yes">
</cfcomponent>


SubmitNoticeOfAppt.cfc

<cfcomponent style="document">
  <cffunction name="SubmitNoticeOfAppt" returnType="string" output="false" access="remote"> 
    <!---Arguments--->
      <cfargument name="NoticeOfApptXml" type="NoticeOfAppointment" required="Yes">
      <cfreturn "Notice of Appointment successfully received">
  </cffunction>
</cfcomponent>


Sample NoticeOfAppointment.xml       (Stripped down, actual message contains almost 200 elements with 20+ complex datatypes)

<NoticeOfAppointment>
  <DocumentIdentification>
    <IdentificationID>000021199</IdentificationID>
    <IdentificationCategoryDescriptionText/>
  </DocumentIdentification>
  <DocumentAugmentation>
    <DocumentIssueDate>
      <Date>2011-04-07</Date>
    </DocumentIssueDate>
  </DocumentAugmentation>
</NoticeOfAppointment>

    This topic has been closed for replies.

    1 reply

    Inspiring
    July 14, 2011

    Coldfusion should be able to nest complex data types in your web service (after all, that's what the cfproperty tag was designed for).  Unfortunately, I have more experience consuming complex web services than designing them in CF. My Recommendation - inspect your web service WSDL using a tool that will generate the sample SOAP XML that will be needed to consume your web service.  You should be able to tell from that XML what the issue is - could be a missing namespace in your XML or strange nesting, etc.

    We use SOAPSonar from Crosscheck networks - they have a feww personal version that will allow you to inspect your web service interface and it will even generate the sample XML needed to call it via SOAP.

    Hope that helps.