I've been trying to figure this out for days now and my deadline is almost up. 
I need to create a complex web service that will receive multiple records from 
the consumer and create an XML file that will be copied into a directory and 
processed. Right now, we receive an XML file via email which we upload to the 
web server and upon upload completion a series of tasks processes the file and 
inserts the data into our database automatically. All I really need to do is to 
take the incoming web service data and create an XML file with it, but I don't 
even know how to reference the data when there are multiple records. I managed 
to get a single record web service created just fine just by using the 
following:

NewJobUpdates.cfc (the name of this file)

<cfcomponent>
    <cffunction name="NEWJOB" access="remote" returntype="void" output="no">
        <cfargument name="USERNAME" type="string">
        <cfargument name="PASSWORD" type="string">
        <cfargument name="JOBCOMPANYNAME" type="string">
        <cfargument name="JOBCODE" type="string">
        <cfargument name="JOBTITLE" type="string">
        <cfargument name="JOBINDUSTRIES" type="string">
        <cfargument name="JOBFUNCTIONS" type="string">
        <cfargument name="JOBLOCATION" type="string">
        <cfargument name="JOBSTATE" type="numeric">
        <cfargument name="JOBDESCRIPTION" type="string">
        <cfargument name="JOBOPPORTUNITY" type="string">
        <cfargument name="JOBCOMPENSATION" type="string">
        <cfargument name="JOBMINCOMPENSATION" type="numeric">
        <cfargument name="JOBMINEXPERIENCE" type="numeric">
        <cfargument name="JOBMAXEXPERIENCE" type="numeric">
        <cfargument name="JOBCONTACTNAME" type="string">
        <cfargument name="JOBCONTACTEMAIL" type="string">
        <cfargument name="JOBCONTACTSTATUS" type="numeric">
        <cfargument name="JOBCONTACTURL" type="string">
        <cfargument name="JOBCONTACTPHONE" type="string">
        <cfargument name="JOBCONTACTFAX" type="string">
        <cfargument name="JOBSHOWRIGHTEYES" type="numeric">
        <cfargument name="JOBRECEIVERIGHTEYES" type="numeric">
        <cfargument name="JOBIONUMBER" type="string">
        <cfargument name="JOBTYPE" type="numeric">
        <cfargument name="JOBVERIFICATION" type="numeric">

<!--- This script adds extraneous data needed for processing --->
<cfscript>
  strSixFigData="6Figs";
  strBOAData="6Figs";
  strAAAData="allen";
  strSixFigNest="6FigsNest";
  companyjobsencryptkey="6figC0m94ny";
  strSessionLockName="sixfigurejobs_#client.cfid#_#client.cftoken#";
  strLockTimeout=10;
  intRandOrd=randrange(100000, 999999);
  strAppAddToken="#URLToken#";
  strAppAddToken=strAppAddToken & iif(not(len(strAppAddToken)), DE(""), 
DE("&"));
  strAppAddToken="#strAppAddToken#" & "noCache=" & "#intRandOrd#";
  strAppAddToken = "100k=1";
  </cfscript>

<!--- This creates the XML document --->
<CFXML variable="xmlDoc">
<cfoutput>
<JOBS>
<USERNAME>#arguments.username#</USERNAME>
<PASSWORD>#arguments.password#</PASSWORD>
<JOB>
   <JOBCOMPANYNAME>#arguments.JOBCOMPANYNAME#</JOBCOMPANYNAME>
   <JOBCODE>#arguments.JOBCODE#</JOBCODE>
   <JOBTITLE><![CDATA[#arguments.JOBTITLE#]]></JOBTITLE>
   <JOBINDUSTRIES>#arguments.JOBINDUSTRIES#</JOBINDUSTRIES>
   <JOBFUNCTIONS>#arguments.JOBFUNCTIONS#</JOBFUNCTIONS>
   <JOBLOCATION><![CDATA[#arguments.JOBLOCATION#]]></JOBLOCATION>
   <JOBSTATE>#arguments.JOBSTATE#</JOBSTATE>
   <JOBDESCRIPTION><![CDATA[#arguments.JOBDESCRIPTION#]]></JOBDESCRIPTION>
   <JOBOPPORTUNITY>#arguments.JOBOPPORTUNITY#</JOBOPPORTUNITY>
   <JOBCOMPENSATION><![CDATA[#arguments.JOBCOMPENSATION#]]></JOBCOMPENSATION>
   <JOBMINCOMPENSATION>#arguments.JOBMINCOMPENSATION#</JOBMINCOMPENSATION>
   <JOBMINEXPERIENCE>#arguments.JOBMINEXPERIENCE#</JOBMINEXPERIENCE>
   <JOBMAXEXPERIENCE>#arguments.JOBMAXEXPERIENCE#</JOBMAXEXPERIENCE>
   <JOBCONTACTNAME>#arguments.JOBCONTACTNAME#</JOBCONTACTNAME>
   <JOBCONTACTEMAIL>#arguments.JOBCONTACTEMAIL#</JOBCONTACTEMAIL>
   <JOBCONTACTSTATUS>#arguments.JOBCONTACTSTATUS#</JOBCONTACTSTATUS>
   <JOBCONTACTURL><![CDATA[#arguments.JOBCONTACTURL#]]></JOBCONTACTURL>
   <JOBCONTACTPHONE>#arguments.JOBCONTACTPHONE#</JOBCONTACTPHONE>
   <JOBCONTACTFAX>#arguments.JOBCONTACTFAX#</JOBCONTACTFAX>   
   <JOBSHOWRIGHTEYES>#arguments.JOBSHOWRIGHTEYES#</JOBSHOWRIGHTEYES>
   <JOBRECEIVERIGHTEYES>#arguments.JOBRECEIVERIGHTEYES#</JOBRECEIVERIGHTEYES>
   <JOBIONUMBER>#arguments.JOBIONUMBER#</JOBIONUMBER>
   <JOBTYPE>#arguments.JOBTYPE#</JOBTYPE>
   <JOBVERIFICATION>#arguments.JOBVERIFICATION#</JOBVERIFICATION>
</JOB>
</JOBS>
</cfoutput>
</CFXML>

<!--- This writes the XML file to the web server --->
<CFFile action="WRITE" 
file="c:\webroot\6figurejobs\webservices\incoming\newjobupload.xml" 
output="#toString(xmlDoc)#">

<!--- And this runs the process against the newly created XML file --->
<cflocation url="ws_ProcessFrame.cfm">
   </cffunction>
</cfcomponent>

This runs perfectly, but how do I create one to handle multiple records 
(complex data types)? Please help, my deadline will be here in 4 days. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336593
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to