2 Replies Latest reply on Oct 2, 2008 5:47 AM by TWPMDan

    CFC Webservice returnType="struct"

      Hi All,

      I have a problem that is slowly killing me.

      I have a simple webservice with all functions set to remote. 3 functions, each returning a different data type and I am consuming this in other languages.

      Function 1 : Returns Array
      Function 2 : Resturns Query
      Function 3 : Returns Struct

      Using C#, I am able to consume the webservice and return the data from Function 1 (Array) and Function 2 (Query) but not Function 3.

      Looking at the SOAP, a Map and MapItem complex data type is used but in C#, the Map.item is null. In ColdFusion (Consuming using CFInvoke) the data is returned no problemo.

      Anybody got any ideas? BTW, I tried this in CF8 and Railo3 with the same results. Null for any returnType of Struct using C#.


        • 1. Re: CFC Webservice returnType="struct"
          Dan Bracuk Level 5
          try returntype = any
          • 2. Re: CFC Webservice returnType="struct"
            TWPMDan Level 1
            Hi Dan,

            Thanks for coming back with a suggestion.

            Unfortunately, it results in the same thing.

            Quick Example:

            From CFC:
            <cffunction name="StructTest" access="remote" returntype="any">
            <cfargument name="argString" required="Yes" type="string">

            <cfset var result = structNew()>

            <cfset structInsert(result,"Dan","Daniel Mackey")>
            <cfset structInsert(result,"Sam","Sam Kidd")>
            <cfset structInsert(result,"Peter","Peter Coppinger")>

            <cfreturn result>

            From C#
            LPS.WebServiceTest lps = new LPS.WebServiceTest();
            LPS.Map map;
            map = (LPS.Map)lps.StructTest("Dan");

            The same thing occurs.

            map.item is null

            If I invoke this from ColdFusion, the correct data is returned :-(

            The exact C# message is :
            "Object reference not set to an instance of an object." and if I test map.item it is in fact Null.

            Arrays, Strings, Queries are all working fine.

            This is driving me nuts out of principle in that it should be fine.
            Map contains item which is an array of mapItems, each with a Key/Value pair.

            I could work around it by using an Array of Arrays SOAP type (Convert the struct to an array which each element being a 2 element array for the key/values) but out of principle its eating away at my will to live like a SOAP/C# brain cancer ;-)