Solved

sending a xml response using cfhttp on coldfusion server 4.5

Posted on 2006-07-10
8
532 Views
Last Modified: 2013-12-24
can i use the below for sending back a xml reponse? we are on cold fusion server 4.5.
another server is sending us xml and is asking us to send back the xml response i put in the 'value' variable below.

<cfhttp url="http://www.somewebsite.com/webservice" method="post">
     <cfhttpparam name="response" type="xml" value="<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>">
</cfhttp>

i found this code in another posting as below. not sure if this meant for use on our version of cold fusion or what i would need to put in for 'xmlSoapRequest'.

<cfhttp url="http://www.somewebsite.com/webservice" method="post">
     <cfhttpparam type="xml" value="xmlSoapRequest">
</cfhttp>
0
Comment
Question by:sagardeo
  • 5
  • 2
8 Comments
 
LVL 10

Assisted Solution

by:rob_lorentz
rob_lorentz earned 50 total points
ID: 17076919
you first example should work fine.
0
 
LVL 12

Assisted Solution

by:mmc98dl1
mmc98dl1 earned 450 total points
ID: 17078064
In your first example the recipient will recieve an XML string in the variable named 'response'.

There should be no problem with this as long as it is well formed so the recipient has no issues with it.  

Does the webservice not require you to put in a method to post the response to?
0
 

Author Comment

by:sagardeo
ID: 17100851
the people hosting the other server sent me the following php code for receving the xml they are sending (stored in the 'xmltoPass' variable) and sending a respone back. my webhosting site shows that it supports php, but not sure if that is for our server since we are on colfusion 4.5 server. is there a way to write this in coldfusion?


<?php
  $xmlString = $_REQUEST['xmlToPass'];

  $dom = new DOMDocument('1.0', 'iso-8859-1');
  $element = $dom->appendChild(new DOMElement('status'));

  if ($xmlString != null) {
      $element->appendChild(new DOMElement('result', 'success'));
  }
  else {
      $element->appendChild(new DOMElement('result', 'failure'));
  }

  echo $dom->saveXML();
?>
0
 

Author Comment

by:sagardeo
ID: 17100863
oh when i used the below code i mentioned in my posting, the people hosting the other server said they were getting a response but it was blank.

<cfhttp url="http://www.somewebsite.com/webservice" method="post">
     <cfhttpparam name="response" type="xml" value="<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>">
</cfhttp>
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:sagardeo
ID: 17100877
and by "Does the webservice not require you to put in a method to post the response to?" you mean instead of just posting to a URL, calling a specific method that is on that page?
0
 
LVL 12

Accepted Solution

by:
mmc98dl1 earned 450 total points
ID: 17104082
correct I mean a specific method in the service.

See 4.5 isnt webservice aware, so they will get a HTTP header from the server to say the transfer was ok, but they wont get a SOAP webservice packet because CF doesnt know how to do that.

I am guessing that you are putting in this cfhttp after you have processed the XML? In which case you are pushing at the right time but I think you are missing a method.

That PHP code could be written on CF 6+ using cfxml but not in 4.5.
0
 

Author Comment

by:sagardeo
ID: 17154502
but the below cfhttp tag could not be subsituted for that php code i mentioned? i mean from that code it pretty much seems they want a response of:

<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>

stored in a variable called result....

the people managing the other server said they were receiving a response but it was blank. but i had the 'name' field before set to "response", where it looks
like they are looking for that variable to be named "result". does this make sense, or am i misunderstanding xml.

<cfhttp url="http://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#" method="post">
     <cfhttpparam name="result" type="FORMFIELD" value="<?xml version='1.0' encoding='iso-8859-1'?><status><result>success</result></status>">
</cfhttp>
0
 

Author Comment

by:sagardeo
ID: 17154528
mmc98dl1, sorry forgot about your previous post saying i missing a method.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now