2 Replies Latest reply on Oct 8, 2007 9:13 AM by jmmorgan

    Help:using  customered data type parameters for webservices

    Xinkun
      file answer.cfc
      <cfcomponent>
      <cfproperty name="person" type="name">
      <cfproperty name="answerText" type="string">
      </cfcomponent>

      file name.cfc
      <cfcomponent>
      <cfproperty name="Firstname" type="string">
      <cfproperty name="Lastname" type="string">
      </cfcomponent

      webServices file myWebServices.cfc
      <cfcomponent>
      <cffunction name="echoAnswer" returnType="string" access="remote" output="false">
      <cfargument name="input" type="answer">
      <cfset returnS="">
      <cfif arguments.input.person.FirstName eq "Xinkun">
      <cfset returnS="Xinkun answered : ">
      <cfset returnS=returnS&arguments.input.answerText>
      <cfelse>
      <cfset returnS="Xinkun did not answered">
      </cfif>
      <cfreturn returnS>
      </cffunction>
      </cfcomponent>

      webServices client file servicesClientTest.cfm
      <cftry>
      <!---<cfobject component="answer" name="respons"> --->
      <cfset respons=structNew()>

      <!--- <cfobject component="name" name="tempN"> --->
      <cfset tempN=StructNew()>
      <cfset tempN.Firstname="Xinkun">
      <cfset tempN.Lastname="Yuan">

      <cfset respons.person=tempN>
      <cfset respons.answerText="test answer">

      <cfinvoke webservice=" http://localhost/CF_Webservices/myWebServices.cfc?wsdl" method="echoAnswer" returnvariable="outputV">
      <cfinvokeargument name="input" value="#respons#">
      </cfinvoke>
      <cfoutput>
      #outputV#
      </cfoutput>
      <cfcatch>
      <cfoutput>
      #cfcatch.Message#
      </cfoutput>
      </cfcatch>
      </cftry>

      There will be an error: 'Could not perform web service invocation "echoAnswer"' when I test the servicesClientTest.cfm.
      help me please!