I'd suggest dropping the htmleditformat() call - you'll notice I don't use that in my code.
On Mar 28, 2004, at 1:53 PM, KNOTT, Brian wrote:
OK people I going to have another go at this today. I have post the form
code below that works and also the cfhttp code that does not work.
THE CODE WORKS
<body onLoad="document.xmlform.submit()">
<FORM ACTION="http://mmis010:8090/servlet/portal/admin/xmlproc" METHOD=POST
name="xmlform">
<TEXTAREA COLS=66 ROWS=20 NAME=XML>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE PORTAL SYSTEM
"http://127.0.0.1:8090/servlet/media/xml/api/request.dtd">
<PORTAL TransId="test">
<AUTH>
<LOGIN Username="admin" Password="admin"/>
</AUTH>
<QUERY RefId="getusername"> <USER ObjectKey="u310346"> <FIELD Name="Username"/> <FIELD Name="LastName"/> <FIELD Name="FirstName"/> <FIELD Name="Email"/> <!-- --> <FIELD Name="Groups"/>
</USER> </QUERY>
</PORTAL></textarea> </form>
THIS CODE DOES NOT WORK
<!--- create XML request --->
<cfset variables.XML = "<?xml version='1.0' encoding='ISO-8859-1'?><!DOCTYPE
PORTAL
SYSTEM'http://127.0.0.1:8090/servlet/media/xml/api/request.dtd'><PORTAL
TransId='test'><AUTH><LOGIN Username='admin' Password='admin'/></AUTH><QUERY
RefId='getusername'><USER ObjectKey='u310346'><FIELD Name='Username'/><FIELD
Name='LastName'/><FIELD Name='FirstName'/><FIELD Name='Email'/><FIELD
Name='Groups'/></USER></QUERY></PORTAL>">
<cfdump var="#variables.xml#">
<!--- send http request --->
<cfhttp method="post" url="http://mmis010:8090/servlet/portal/admin/xmlproc"
username="admin" password="admin" resolveurl="yes">
<cfhttpparam type="formfield" name="XML"
value='#htmleditformat(variables.XML)#'>
</cfhttp>
<cfdump var="#xmlparse(cfhttp.FileContent,'no')#">
I've done things like add the port attribute to the cfhttp tag but had no
lock. If I remove the username and login from the cfhttp tag that it fails
to authozies itself. If this because cfhttp is replicating a browser and
does not normally pass login details where as IE is a part of the OS and
thus is passing login details.
Anyway my basic problem is that I can't parse use the first value as I wont
to search the returned data. What I rally want is for cfhttp to work and
just pass back the returned XML packed as a variable.
Brian Knott
-----Original Message----- From: Sean A Corfield [SMTP:[EMAIL PROTECTED] Sent: Sunday, 28 March 2004 10:16 To: CFAussie Mailing List Subject: [cfaussie] Re: XML
On Mar 25, 2004, at 8:54 PM, KNOTT, Brian wrote:I have an done a dump of the page that is used to test portal.
Is the URL something public we can look at?
I can't seem to convert this cfhttp. I have a cfhttp tag with a cfhttpparam tag for the form field but it does not seem to send the correct information.
Here's an example that I use at work - the #payload# variable is an XML
*string* - see below for how I create it - note that I provide all of
the form fields as <cfhttpparam> values:
<cfhttp method="post"
url="#variables.targetServer#/servlets/
oracle.apps.ecx.oxta.TransportAgentServer"
throwonerror="yes">
<cfhttpparam name="TRANSPORT_PROTOCOL"
type="FormField" value="OXTA" />
<cfhttpparam name="TRANSPORT_PROTOCOL_VERSION"
type="FormField" value="1.0" />
<cfhttpparam name="REQUEST_TYPE"
type="FormField" value="SEND" /> <!--- SEND/AUTH --->
<cfhttpparam name="MESSAGE_ID" type="FormField"
value="#messageId#" />
<cfhttpparam name="MESSAGE_TYPE"
type="FormField" value="XML" />
<cfhttpparam name="MESSAGE_STANDARD"
type="FormField" value="OAG" />
<cfhttpparam name="TRANSACTION_TYPE"
type="FormField" value="INVENTORY" /> <!--- INVENTORY --->
<cfhttpparam name="TRANSACTION_SUBTYPE"
type="FormField" value="SYNC" /> <!--- SYNC --->
<cfhttpparam name="DOCUMENT_NUMBER"
type="FormField" value="#documentNumber#" />
<cfhttpparam name="PARTYID" type="FormField"
value="*****" />
<cfhttpparam name="PARTY_SITE_ID"
type="FormField" value="*****" />
<cfhttpparam name="PROTOCOL_TYPE"
type="FormField" value="SMTP" />
<!---
<cfhttpparam name="PROTOCOL_ADDRESS"
type="FormField" value="" />
--->
<cfhttpparam name="USERNAME" type="FormField"
value="******" />
<cfhttpparam name="PASSWORD" type="FormField"
value="******" />
<!---
<cfhttpparam name="ATTRIBUTE1" type="FormField"
value="" />
<cfhttpparam name="ATTRIBUTE2" type="FormField"
value="" />
<cfhttpparam name="ATTRIBUTE3" type="FormField"
value="" />
<cfhttpparam name="ATTRIBUTE4" type="FormField"
value="" />
<cfhttpparam name="ATTRIBUTE5" type="FormField"
value="" />
--->
<cfhttpparam name="PAYLOAD" type="FormField"
value="#payload#" />
<cfhttpparam name="Submit" type="FormField"
value="Send" />
</cfhttp>
And here's how I create the payload variable:
<cfsavecontent variable="payload"><cfoutput><?xml
version="1.0" encoding="utf-8" standalone="no"?>
<!--
Auto converted from #arguments.inboundPath#.
-->
<!DOCTYPE SYNC_INVENTORY_005 SYSTEM "068_sync_inventory_005.dtd">
<SYNC_INVENTORY_005>
<CNTROLAREA>
<BSR>
<VERB>SYNC</VERB>
<NOUN>INVENTORY</NOUN>
<REVISION>005</REVISION>
</BSR>
<SENDER>
<LOGICALID>INV101111</LOGICALID>
<COMPONENT>INVENTORY</COMPONENT>
<TASK>CYCLECNT</TASK>
<REFERENCEID>24325CC</REFERENCEID>
<CONFIRMATION>1</CONFIRMATION>
<LANGUAGE>ENG</LANGUAGE>
<CODEPAGE>CPXML</CODEPAGE>
<AUTHID>CHRIS</AUTHID>
</SENDER>
<DATETIME qualifier="CREATION">
<YEAR>#dateFormat(fileDateTime,"YYYY")#</YEAR>
<MONTH>#dateFormat(fileDateTime,"MM")#</MONTH>
<DAY>#dateFormat(fileDateTime,"DD")#</DAY>
<HOUR>#timeFormat(fileDateTime,"hh")#</HOUR>
<MINUTE>#timeFormat(fileDateTime,"mm")#</MINUTE>
<SECOND>#timeFormat(fileDateTime,"ss")#</SECOND>
<SUBSECOND>0000</SUBSECOND>
<TIMEZONE>-0800</TIMEZONE>
</DATETIME>
</CNTROLAREA><cfloop index="i" from="1" to="#numItems#">
<DATAAREA> <!-- REPEATED FOR EACH PART/ITEM -->
<SYNC_INVENTORY>
<INVENTORY>
<DATETIME qualifier="EFFECTIVE"> <!-- 1
-->
<YEAR>#right(arguments.lineItems[i][1],4)#</YEAR>
<MONTH>#left(arguments.lineItems[i][1],2)#</MONTH>
<DAY>#mid(arguments.lineItems[i][1],4,2)#</DAY> <HOUR>00</HOUR> <MINUTE>00</MINUTE> <SECOND>00</SECOND> <SUBSECOND>0000</SUBSECOND> <TIMEZONE>-0800</TIMEZONE> </DATETIME> <QUANTITY qualifier="ITEM">
<VALUE>#arguments.lineItems[i][4]#</VALUE>
<NUMOFDEC>0</NUMOFDEC>
<SIGN>+</SIGN>
<UOM>EACH</UOM>
</QUANTITY>
<ITEM>#arguments.lineItems[i][3]#</ITEM>
<SITELEVEL
index="1">#getCanonicalSiteName(arguments.lineItems[i][2])#</ SITELEVEL>
<SITELEVEL
index="2">#getCanonicalSiteName(arguments.lineItems[i][2])#</ SITELEVEL>
<!-- #arguments.lineItems[i][2]# -->
<SYNCIND>C</SYNCIND>
</INVENTORY>
</SYNC_INVENTORY>
</DATAAREA></cfloop>
</SYNC_INVENTORY_005>
</cfoutput></cfsavecontent>
Hope that helps!
--- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004
