Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XML

0 views
Skip to first unread message

AlwaysWannaLearn

unread,
Jul 8, 2004, 5:05:47 PM7/8/04
to
Can anyone help me? I need to use SOAP and XML with CF. I don't know how to begin. How do I setup SOAP and XML to be used with CF?

Thanks.

zz3top

unread,
Jul 8, 2004, 6:01:42 PM7/8/04
to

Start with Ben Forta's Web Application Construction Kit. Read up on building CFCs - ColdFusion Components and Web Services.

AlwaysWannaLearn

unread,
Jul 8, 2004, 8:27:20 PM7/8/04
to
Are there any websites that give/show examples? I will look at the Ben Forta book, but if there are any websites that give examples, that'd be great.


Anticlue

unread,
Jul 8, 2004, 10:51:44 PM7/8/04
to
Hi,

Let me know if this helps you out.

http://www.anticlue.net/archives/000301.htm

HTH,
Anticlue

AlwaysWannaLearn

unread,
Jul 9, 2004, 12:25:57 PM7/9/04
to
Anticlue, thanks for link. How can I use the info from the link to do what I
need? This is what I am trying to do:
Need some help in using soap and XML with a CF application. What I need to do
is create a "handshake" first. I connect to the server (via soap) and get a ID,
then when I get the ID I submit the data (in XML format). After I submit the
data, I get a response from their system and log that in my dB. But there's
another criteria before the actual data can be sent. See, first I have to
create a "handshake" with the client's system. Then I get a STATUS for their
system (if the STATUS is "valid" then I send the data over, if the status is
"invalid" or "rejected" I log the reason in my dB.)

How can I get started on this? Please any help is appreicated.

This is what I have so far:


<cfquery name="getUser" datasource="#default_ds#">
SELECT DISTINCT FA.User_ID, FA.FAns, FA.FFieldID, FA.CreateDate AS timestamp
FROM FAnw FA
WHERE FA.FormI = #FormI#
</cfquery>

<table>
<cfoutput query="getUser" group="User_ID">
<tr>
<td>#User_ID#</td>

<!--- STEP ONE: PINGING THE CLIENT --->
<!-- Sets the 'getID' value to blank and submits that. This will return
with a value -->
<cfset getTransID = "">
<!--- This portion will cretae a 'handshake'. This will execute a ping
(consisting of a zipcode) to determine coverage. Upon submission the client's
system will return values. --->
<cfsavecontent variable="determine_coverage">
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas/xmlsoap.org/soap/envelope/">
<soapenv:Body>
<APing xmlns="http://www.123abc.com/">
<ID>#getTransID#</ID>
<ZipCode>#vZip#</ZipCode>
</APing>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<!--- This portion will send the values given to the client. --->
<cfhttp url="test.services.abc.com:80" method="POST" resolveurl="Yes">
<cfhttpparam type="HEADER" name="Content-Type" value="text/xml;
charset=utf-8">
<cfhttpparam type="HEADER" name="Content-Length"
value="#len(tostring(determine_coverage))#">
<cfhttpparam type="HEADER" name="SOAPAction"
value="http://www.123abc.com/APing">
<cfhttpparam type="BODY" name="stepone"
value="#tostring(determine_coverage)#">
</cfhttp>


<!--- STEP TWO: GETTING RESULTS FROM THE PING --->
<!--- This portion will return results. --->
<cfsavecontent variable="determine_coverage_result">
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas/xmlsoap.org/soap/envelope/">
<soapenv:Body>
<APing xmlns="http://www.123abc.com/">
<Status>#getStatus#</Status>
<ID>#getTransID#</ID>
<NextRoutine>#getNextRoutine#</NextRoutine>
<Error>#getError#<Error>
</APing>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<!--- This portion will get the values from the client. --->
<cfhttp url="test.services.abc.com:80" method="GET" resolveurl="Yes">
<cfhttpparam type="HEADER" name="Content-Type" value="text/xml;
charset=utf-8">
<cfhttpparam type="HEADER" name="Content-Length"
value="#len(tostring(determine_coverage))#">
<cfhttpparam type="HEADER" name="SOAPAction"
value="http://www.1800communications.com/Apply_Ping">
<cfhttpparam type="BODY" name="steptwo"
value="#tostring(determine_coverage_result)#">
</cfhttp>

<!--- if the getTransID is not null and getStatus is 'Valid', send the lead
--->
<cfif getTransID NEQ "" and getStatus EQ "Valid">
<cfsavecontent variable="sending_leads">
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Applydetails xmlns="http://www.123abc.com/">
<ID>#getTransID#</ID>
<FirstName>#FirstName#</FirstName>
<LastName>#LastName#</LastName>
<Email>#Email#</Email>
<StreetAddress>#Address#</StreetAddress>
<City>#City#</City>
<ZipCode>#Zip#</ZipCode>
</Applydetails>
</soap:Body>
</soap:Envelope>
</cfsavecontent>

<!--- This portion will get the values from the client. --->
<cfhttp method="post" url="test.services.abc.com:80" throwonerror="No"
resolveurl="Yes">
<cfhttpparam type="HEADER" name="Content-Type" value="text/xml;
charset=utf-8">
<cfhttpparam type="HEADER" name="Content-Length"
value="#len(tostring(sending_leads))#">
<cfhttpparam type="HEADER" name="SOAPAction"
value="http://www.123abc.com/Apply">
<cfhttpparam type="BODY" name="steptwo" value="#tostring(sending_leads)#">
</cfhttp>
<cfset Status = 1>
<cfset statusdesc = "Sent">
<!--- else if the getStatus is 'Invalid' log the result --->
<cfelseif getStatus EQ "Invalid">
<cfset Status = 2>
<cfset statusdesc = #getError#>
<cfelse>
<cfset Status = 2>
<cfset statusdesc = #getError#>
</cfif>
</tr>
</cfoutput>
</table>

0 new messages