Goal: To create a webservice that can accept an array of structures/components.

Problem: The webservice will not accept the array of structures/components 
passed to it.

Code:
1) The following is the code that creates the array of structures/components 
and invokes the webservice. (Testws.cfm)

<cfoutput>
                
        <!--- Creat Test Game Object --->
        <cfset arrGame = ArrayNew(1)>
        <cfloop index="i" from=1 to=5>
                <cfset arrGame[i] = CreateObject("component", "gameTest")>
                <cfset arrGame[i].setGameID(ToString(i))>
                <cfset arrGame[i].setHomeSSID("OHSSTEST" & i)>
        </cfloop>
        <b>arrGame:</b><br><cfdump var="#arrGame#">
        <cfinvoke 
webservice="http://dev.schedulestar.com/Tim/webservicetest.cfc?wsdl"; 
method="complextype1" returnvariable="serviceResult" Games="#arrGame#">
        
        <br><br><b>serviceResult:</b><br><cfdump var="#serviceResult#">
</cfoutput>

2) The following is the code for the web service (webservicetest.cfc)

<cfcomponent>
        <cffunction name="complextype1" returntype="gameTest[]" access="remote">
                <cfargument name="Games" type="gameTest[]" required="yes">
                
                
                <cfset arrGame = arraynew(1)> <!--- Return Variable --->
                
                <!--- Creat Game --->
                <cfloop index="s" from=1 to="#arraylen(Games)#">
                        <cfset arrGame[s] = CreateObject("component", 
"gameTest")>
                        <cfset arrGame[s].setGameID(ToString(s))>
                        <cfset arrGame[s].setHomeSSID(Games[s].getHomeSSID)>
                </cfloop>
                
                <cfreturn arrGame>
        </cffunction>

</cfcomponent>

3) The following is the component. An array of this component is made and 
passed to the webservice. (gameTest.cfc)

<cfcomponent>
        <cfproperty name="GameID" type="string">
        <cfproperty name="HomeSSID" type="string">
        
        <!--- Initialize --->
        <cfscript>
                this.GameID = "0";
                this.HomeSSID = "";
        </cfscript>
        
        <!--- Methods --->
        <cffunction name="getGameID" access="public" returntype="string">
                <cfreturn this.GameID>
        </cffunction>
        <cffunction name="setGameID" access="public">
                <cfargument name="game" type="string" required="yes">
                <cfset this.GameID = game>
        </cffunction>
        
        <cffunction name="getHomeSSID" access="public" returntype="string">
                <cfreturn this.HomeSSID>
        </cffunction>
        <cffunction name="setHomeSSID" access="public">
                <cfargument name="ssid" type="string" required="yes">
                <cfset this.HomeSSID = ssid>
        </cffunction>
</cfcomponent>


Basically, the testWS.cfm file creates an array of the component and passes it 
to the webservice. No matter what I try to do, errors continue to be thrown. I 
believe the problem is in the code for the webservice. Thank you for your help. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292142
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to