Complex DataTypes WebServices

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Complex DataTypes WebServices

    Hi, I am having problem with the complex data types in webservices. I am
    interested in r'ving 3 elements which are wsdl_key, partner_id and array of
    FName Main CFComponent: Main.cfc <cfcomponent displayname='AffiliatesBatch'
    hint='Batch API'> <cffunction access='remote' name='BatchReminders'
    returntype='string'> <cfargument name='wsdl_key' required='true'
    type='string'> <cfargument name='partner_id' required='true' type='numeric'>
    <cfargument name='BatchArray' required='true' type='ThisBatch'> </cffuntion>
    </cfcomponent> Sub CFComponent: ThisBatch.cfc <cfcomponent> <cfproperty
    name='FName' type='string'> </cfcomponent> The above code is accepting only 1
    FName, I am interested to send more number of Fname. Can you please suggest me
    what changes I have to make for the above code to accept more Fname What is
    the datatype of BatchArray: Is it of Array or structure type ( to extract the
    data). Did't find any example for the array types. Looking for your help.
    Thanks in advance -Raaga

    Raaga Guest

  2. Similar Questions and Discussions

    1. Converting Datatypes
      Hi, I need to change a varchar field in my DB to a small date/time field. The problem is I don't want to lose the data, as I have quite a lot of...
    2. Complex DataTypes
      Ok, I created a Web Service using PHP5 SOAP extension. I created the WSDL and I can serve and consume that service in PHP. Now I am trying to...
    3. sql=access=datatypes?
      What would be the corresponding data types for the following existing Access data types: Autonumber = (UniqueIdentifier?) Number =...
    4. complex datatypes and methods
      Hi, I created a custom container class in order to return values from web method calls and this works fine, but my problem is that I added some...
    5. Datatypes in Informix
      Hi, I am trying to obtain an extract of my Informix database into a formatted spreadsheet. The information of the fields in a table is...
  3. #2

    Default Re: Complex DataTypes WebServices

    If you need an array of 'FName''s, why not use an array of 'FNames'? Why are
    you trying to store these in a CFC? Just store your names in an array,
    serialize it using wddx and then deserialize it in the webservice.

    <cfset aFNames = ArrayNew(1)>
    <cfset aFNames[1] = "James">
    <cfset aFNames[2] = "Alex">
    <cfwddx input="#aFNames#" output="wFNames" action="cfml2wddx">
    <cfinvoke webservice="Main" method="BatchReminders" returnvariable="rv">
    <cfinvokeargument name="BatchArray" value="#wFNames#">
    </cfinvoke>

    Change the argument type for BatchArray to "string" and deserialize the array
    in your web service function using...

    <cfwddx input="#BatchArray#" output="aFNames" action="wddx2cfml">

    You now have an array named "aFNames" you can do whatever you like with

    BSterner Guest

  4. #3

    Default Re: Complex DataTypes WebServices

    Hi, Thanks for the reply. I am creating a WSDL, so that is the reason i
    stored this as CFC and offering as webservice. Other clients are going to
    access this using [url]http://XXXXXXXXXXXXXXX/AffiliatesBatch.cfc?WSDL[/url] Thanks -Raaga

    Raaga Guest

  5. #4

    Default Re: Complex DataTypes WebServices

    Ok, but what do you need your clients to pass to the webservice? A list of
    first names along with 'wsdl_key' and 'partner_id', correct? If all you need
    is a list of names, then pass it as a string. Actually, now that I think about
    it, you can just pass a comma delimited string of names. Then use the the List
    Functions to extract the values or convert it to an array (Using ListToArray())
    and loop the array. Forget about the the wddx stuff. Is there something
    obvious I'm overlooking as to why you need the 'ThisBatch.cfc' component?

    BSterner Guest

  6. #5

    Default Re: Complex DataTypes WebServices

    Definitely. if others are going to be accessing your webservice, stick to stuff
    that other languages can easily consume: strings and arrays. If I were writing
    a client to this webservice in java, I'd now need to run wsdl2java, which would
    create 5 or 6 separate classes/stubs, then i'd have to write a little more
    code, all to pass you a list of filenames. all because you're accepting a
    custom object instead of an array.

    jonnycattt Guest

  7. #6

    Default Re: Complex DataTypes WebServices

    Hi,
    In future we are going to add some more items apart of from FName. eg. LName,addr1, addr2, city, state, zipcode, phno, email etc. That is the reason i used ThisBatch.cfc

    Thanks
    -Raaga
    Raaga Guest

  8. #7

    Default Re: Complex DataTypes WebServices

    in that case, consider using an array of structures.
    jonnycattt Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139