Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

sending a xml response using cfhttp on coldfusion server 4.5

Posted on 2006-07-10
8
Medium Priority
?
574 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:Judy Deo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 10

Assisted Solution

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

Assisted Solution

by:mmc98dl1
mmc98dl1 earned 1800 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:Judy Deo
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:Judy Deo
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
 

Author Comment

by:Judy Deo
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 1800 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:Judy Deo
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:Judy Deo
ID: 17154528
mmc98dl1, sorry forgot about your previous post saying i missing a method.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
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…

604 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