accept an xml argument [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => randomfactor [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 4 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Consuming a CFC web service with XML parameter - Coldfusion - Advanced Techniques

Consuming a CFC web service with XML parameter - Coldfusion - Advanced Techniques

It would appear that I have stumped the panel with this question. So it goes....

Sponsored Links
  1. #1

    Default Re: Consuming a CFC web service with XML parameter

    It would appear that I have stumped the panel with this question. So it goes.
    Sponsored Links
    randomfactor Guest

  2. #2

    Default Re: Consuming a CFC web service with XML parameter

    What errors are you getting? I would suggest that you cannot return an XML
    object to .NET as it is a CFML data type, but XML is just a string anyway, so
    why are you trying to over complicate the matter?

    Stressed_Simon Guest

  3. #3

    Default Re: Consuming a CFC web service with XML parameter

    Well, no. XML is not just a string. It is character-encoded text that meets
    very specific criteria for well-formedness.

    From any web service infrastructure that is not just a toy, I expect certain
    functionality to be supplied from the framework. I expect the WSDL generated
    by the tool to be recognizable by other non-toy web service infrastructures. I
    expect that when calls are made with improper arguments (e.g: wrong type), the
    infrastructure will implement checking and error handling so that I need not
    duplicate it in my code everywhere that I use that particular type.

    ColdFusion may be an adequate tool for implementing human-facing web
    applications, but it is very disappointing for implementing industrial strength
    web services.


    randomfactor Guest

  4. #4

    Default Re: Consuming a CFC web service with XML parameter

    The error that I get when I try to reference a CFC web service from Visual
    Studio .NET is:

    Custom tool error: Unable to import WebService/Schema. Unable to import
    binding 'junk02.cfcSoapBinding' from namespace 'http://train'. Unable to import
    operation 'acceptXml'. The datatype 'Doent' is missing.

    I've attached a simplified sample CFC which exhibits the problem. I've also
    attached the WSDL generated by ColdFusion v7.0.1 (developer).







    ++++++++++++++++++++++++++++ sample CFC
    +++++++++++++++++++++++++++++++++++++++++++++


    <cfcomponent displayname="junk02" hint="accept an xml argument">

    <cfproperty name="Id" type="numeric">
    <cfset variables.Id = 6>

    <cffunction name="acceptXml" access="remote" returntype="xml" output="no">
    <cfargument name="xmlin" type="xml" required="true">
    <cfset doc = xmlP(xmlin)>
    <cfset nodeCnt = ArrayLen(doc.xmlRoot.xmlChildren)>
    <cfset countNode = xmlElemNew(doc, "Nodes")>
    <cfset countNode.xmlText = toString(nodeCnt)>
    <cfset doc.xmlRoot.xmlChildren[nodeCnt + 1] = countNode>
    <cfreturn toString(doc)>
    </cffunction>

    </cfcomponent>



    +++++++++++++++++++++++++ WSDL generated by ColdFusion
    ++++++++++++++++++++++++++++++++++


    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="http://train"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://train"
    xmlns:intf="http://train"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:tns1="http://rpc.xml.coldfusion"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <!--WSDL created by Macromedia ColdFusion MX version 7,0,1,116466-->
    <wsdl:types>
    <schema targetNamespace="http://rpc.xml.coldfusion"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://xml.apache.org/xml-soap"/>
    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
    <complexType name="CFCInvocationException">
    <sequence/>
    </complexType>

    </schema>
    </wsdl:types>

    <wsdl:message name="setIdRequest">

    <wsdl:part name="Id" type="xsd:double"/>

    </wsdl:message>

    <wsdl:message name="getIdRequest">

    </wsdl:message>

    <wsdl:message name="acceptXmlRequest">

    <wsdl:part name="xmlin" type="apachesoap:Doent"/>

    </wsdl:message>

    <wsdl:message name="setIdResponse">

    </wsdl:message>

    <wsdl:message name="CFCInvocationException">

    <wsdl:part name="fault" type="tns1:CFCInvocationException"/>

    </wsdl:message>

    <wsdl:message name="acceptXmlResponse">

    <wsdl:part name="acceptXmlReturn" type="apachesoap:Doent"/>

    </wsdl:message>

    <wsdl:message name="getIdResponse">

    <wsdl:part name="getIdReturn" type="xsd:double"/>

    </wsdl:message>

    <wsdl:portType name="junk02">

    <wsdl:operation name="getId">

    <wsdl:input message="impl:getIdRequest" name="getIdRequest"/>

    <wsdl:output message="impl:getIdResponse" name="getIdResponse"/>

    <wsdl:fault message="impl:CFCInvocationException"
    name="CFCInvocationException"/>

    </wsdl:operation>

    <wsdl:operation name="setId" parameterOrder="Id">

    <wsdl:input message="impl:setIdRequest" name="setIdRequest"/>

    <wsdl:output message="impl:setIdResponse" name="setIdResponse"/>

    </wsdl:operation>

    <wsdl:operation name="acceptXml" parameterOrder="xmlin">

    <wsdl:input message="impl:acceptXmlRequest" name="acceptXmlRequest"/>

    <wsdl:output message="impl:acceptXmlResponse"
    name="acceptXmlResponse"/>

    <wsdl:fault message="impl:CFCInvocationException"
    name="CFCInvocationException"/>

    </wsdl:operation>

    </wsdl:portType>

    <wsdl:binding name="junk02.cfcSoapBinding" type="impl:junk02">

    <wsdlsoap:binding style="rpc"
    transport="http://schemas.xmlsoap.org/soap/http"/>

    <wsdl:operation name="getId">

    <wsdlsoap:operation soapAction=""/>

    <wsdl:input name="getIdRequest">

    <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="http://train" use="encoded"/>

    </wsdl:input>

    <wsdl:output name="getIdResponse">

    <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="http://train" use="encoded"/>

    </wsdl:output>

    <wsdl:fault name="CFCInvocationException">

    <wsdlsoap:fault
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    name="CFCInvocationException" namespace="http://train" use="encoded"/>

    </wsdl:fault>

    </wsdl:operation>

    <wsdl:operation name="setId">

    <wsdlsoap:operation soapAction=""/>

    <wsdl:input name="setIdRequest">

    <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="http://train" use="encoded"/>

    </wsdl:input>

    <wsdl:output name="setIdResponse">

    <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="http://train" use="encoded"/>

    </wsdl:output>

    </wsdl:operation>

    <wsdl:operation name="acceptXml">

    <wsdlsoap:operation soapAction=""/>

    <wsdl:input name="acceptXmlRequest">

    <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="http://train" use="encoded"/>

    </wsdl:input>

    <wsdl:output name="acceptXmlResponse">

    <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="http://train" use="encoded"/>

    </wsdl:output>

    <wsdl:fault name="CFCInvocationException">

    <wsdlsoap:fault
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    name="CFCInvocationException" namespace="http://train" use="encoded"/>

    </wsdl:fault>

    </wsdl:operation>

    </wsdl:binding>

    <wsdl:service name="junk01">

    <wsdl:doentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    accept an xml argument </wsdl:doentation>

    <wsdl:port binding="impl:junk02.cfcSoapBinding" name="junk02.cfc">

    <wsdlsoap:address location="http://127.0.0.1:8500/train/junk02.cfc"/>

    </wsdl:port>

    </wsdl:service>

    </wsdl:definitions>

    randomfactor Guest

  5. #5

    Default Re: Consuming a CFC web service with XML parameter

    Originally posted by: randomfactor
    Well, no. XML is not just a string. It is character-encoded text that meets
    very specific criteria for well-formedness.

    From any web service infrastructure that is not just a toy, I expect certain
    functionality to be supplied from the framework. I expect the WSDL generated
    by the tool to be recognizable by other non-toy web service infrastructures. I
    expect that when calls are made with improper arguments (e.g: wrong type), the
    infrastructure will implement checking and error handling so that I need not
    duplicate it in my code everywhere that I use that particular type.

    ColdFusion may be an adequate tool for implementing human-facing web
    applications, but it is very disappointing for implementing industrial strength
    web services.


    Well, no. XML IS a STRING. You can generate that STRING with Perl, WebSpeed,
    CF, by hand with vi or Notepad... anything you'd like... as long it can output
    characters combined into a string, which happens to be formatted and declared
    (in your XML declaration that is) as XML.

    I would try outputting the response as String.

    We do it all the time with Progress... and you can't say it's not "industrial
    strength".

    In this case, specifying XML is not returning a simple XML string but an XML
    object for CF to use... do a CFDump on a plain XML file done by hand in vi and
    then use XMLP() and dump the result... you'll see.

    ScottyMTL Guest

  6. #6

    Default Re: Consuming a CFC web service with XML parameter

    Yes, I agree with ScottyMTL. ColdFusion is broken as far as web services are
    concerned. Anyone trying to use ColdFusion to implement a web service must
    restrict themselves to strings and other basic types. Complex types (in the
    XML Schema sense) are not supported.


    randomfactor Guest

  7. #7

    Default Re: Consuming a CFC web service with XML parameter

    You can create a bean to represent complex types creating a CFC with just properties representing the different attributes of the object.
    mrampson Guest

Similar Threads

  1. consuming web service
    By JPinto in forum ASP.NET Web Services
    Replies: 2
    Last Post: April 24th, 10:59 AM
  2. Consuming .NET Web Service
    By Bogey in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: February 21st, 07:13 PM
  3. Replies: 0
    Last Post: July 20th, 01:58 PM
  4. Consuming a web service from VB 6
    By Samantha Dixon in forum ASP.NET Web Services
    Replies: 4
    Last Post: January 15th, 03:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •