Solved

sending a xml response using cfhttp on coldfusion server 4.5

Posted on 2006-07-10
8
544 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
I starting with php 12 117
question about access to website 2 68
Optimum versions of Selenium Webdriver with Python On Windows 7 1 84
Questions about this React unit test 4 46
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…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

863 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

24 Experts available now in Live!

Get 1:1 Help Now