XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 26th, 2004, 03:20 AM
namotco namotco is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Madison
Posts: 404 namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 22 h 16 m 30 sec
Reputation Power: 30
Send a message via AIM to namotco
Newbie question- how to POST?

I'm normally a perl programmer. What I need to do is POST

Code:
<TransactionRequest>
**<Function ID="SOME_ID" Value="Function_Name">
****<Authorization>
******<Account>Your_Account_Name</Account>
******<Password>Your_Password<Password>
****</Authorization>
****<Data>
******<Field1>Data1</Field1>
******<Field2>Data2</Field2>
******<FieldN>DataN</FieldN>
****</Data>
**</Function>
</TransactionRequest>


to https://somedomain.com/somescriptXML.pl

I just don't understand that, I'm guessing it's very simple though...
(How exactly would I POST the XML and please give me an example). Thanks!

Reply With Quote
  #2  
Old August 26th, 2004, 04:40 PM
ChrisRC ChrisRC is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Pittsburgh, PA
Posts: 30 ChrisRC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
You say you're normally a PERL programmer, but you don't mention what sort of environment you're working in now. As an example, if you're working with classic ASP/vbscript:


Code:
dim xmlhttp 'xmlhttp request object
dim xmlRequest, xmlResponse 'variables to hold the request and response respectively
dim tst 'test variable to hold result of assigning the response to xmlResponse

'build xml request string. This is where you'd put the XML data You need to post to the server
xmlRequest="<TransactionRequest>...</TransactionRequest>"

set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")

xmlhttp.Open "POST","https://somedomain.com/somescriptXML.pl",false 
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send xmlRequest 'submit request

'Assign Response string to free threaded DOM object
	set xmlResponse = Server.CreateObject("MSXML.FreeThreadedDOMDocument")
	xmlResponse.async = false
	
tstload = xmlResponse.loadxml(xmlhttp.ResponseXML.XML)
set xmlhttp = nothing


Chris Collins
crcdesign.net

Reply With Quote
  #3  
Old August 26th, 2004, 05:03 PM
namotco namotco is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Madison
Posts: 404 namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level)namotco User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 22 h 16 m 30 sec
Reputation Power: 30
Send a message via AIM to namotco
Uh, oh. That doesn't really make sense to me. I don't know anything about ASP. I do HTML and Perl, I can read PHP. What I do is take values from a form, use perl to format the XML based on the values, and then POST that XML to http://somedomain/someXMLscript.pl

Reply With Quote
  #4  
Old August 26th, 2004, 05:13 PM
rguilbault rguilbault is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 30 rguilbault User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 15 m 18 sec
Reputation Power: 5
Quote:
Originally Posted by namotco
Uh, oh. That doesn't really make sense to me. I don't know anything about ASP. I do HTML and Perl, I can read PHP. What I do is take values from a form, use perl to format the XML based on the values, and then POST that XML to http://somedomain/someXMLscript.pl


Written another way in Javascript (taking ChrisRC's example):

PHP Code:
//build xml request string. This is where you'd put the XML data You need to post to the server
var xmlRequest = new ActiveX("Microsoft.XMLDOM");
var 
xmlText "<TransactionRequest>...</TransactionRequest>";

xmlText.loadXML(xmlText);

var 
xmlhttp = new ActiveX("Microsoft.XMLHTTP");
xmlhttp.open("POST","https://somedomain.com/somescriptXML.pl",false);
xmlhttp.setRequestHeader("Content-Type""application/x-www-form-urlencoded");

xmlhttp.send(xmlRequest);

//Assign Response string to XML DOM object
var xmlResponse = new ActiveX("Microsoft.XMLDOM");
xmlResponse.async false;
    
tstload xmlResponse.loadXML(xmlhttp.responseXML.xml


I'm not sure if that's 100% -- but I think it's close...

Reply With Quote
  #5  
Old August 27th, 2004, 09:14 AM
ChrisRC ChrisRC is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Pittsburgh, PA
Posts: 30 ChrisRC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Quote:
Originally Posted by namotco
Uh, oh. That doesn't really make sense to me. I don't know anything about ASP. I do HTML and Perl, I can read PHP. What I do is take values from a form, use perl to format the XML based on the values, and then POST that XML to http://somedomain/someXMLscript.pl


OK. There probably is a way to do it in PERL, but I haven't used PERL in 10 years so I honestly can't help you much there from experience. A quick search though, did turn up the HTTP::Request class which seems like the obvious solution.

[edit]Actully I took a longer look at my search results and found an example from Ebay's developer guide[/edit]

I'm pretty sure the typical way to do this with PHP is by using the socket functions. A quick search turned up an example at PHPBuilder

Chris Collins
crcdesign.net

Last edited by ChrisRC : August 27th, 2004 at 09:19 AM. Reason: Found more info

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Newbie question- how to POST?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT