sending a xml response using cfhttp on coldfusion server 4.5

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>
Judy DeoAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
mmc98dl1Connect With a Mentor Commented:
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
 
rob_lorentzConnect With a Mentor Commented:
you first example should work fine.
0
 
mmc98dl1Connect With a Mentor Commented:
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
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
Judy DeoAuthor Commented:
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
 
Judy DeoAuthor Commented:
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
 
Judy DeoAuthor Commented:
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
 
Judy DeoAuthor Commented:
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
 
Judy DeoAuthor Commented:
mmc98dl1, sorry forgot about your previous post saying i missing a method.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.