Jump to content

geniusboy0

Members
  • Posts

    2
  • Joined

  • Last visited

geniusboy0's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thanks for the reply, but... Unfortunately, that didn't help at all with my problem and I still get the same non-results. I've tried taking out and putting in the \r\n stuff, but I haven't hand any luck with that either. I am worried the xmlhttp.send() command is not handled the same way as the POST from VB6, and I would have to somehow bundle the XML all at once with the URL.
  2. I have a functional XML POST from VB6 (provided by the developer of the server-side parser) that I am trying to adapt into an HTML based POST (javascript or anything I can use by just dropping a file into the webroot is ok). Here's the VB6: strCmd = "<?xml version=""1.0"" encoding=""us-ascii"" ?>"strCmd = strCmd + " <Program.XML RPC=""" + Combo1.Text + """>"strCmd = strCmd + " <Authentication>"strCmd = strCmd + " <UserName>" + Text3.Text + "</UserName>"strCmd = strCmd + " <Password>" + Text4.Text + "</Password>"strCmd = strCmd + " <Domain>" + Text5.Text + "</Domain>"strCmd = strCmd + " <Workstation>" + Text6.Text + "</Workstation>"strCmd = strCmd + " </Authentication>"strCmd = strCmd + " <Parameters>" + vbCrLfstrCmd = strCmd + " <Identity>" + Text7.Text + "</Identity>" + vbCrLfstrCmd = strCmd + " </Parameters>" + vbCrLfstrCmd = strCmd + "</Program.XML>"Inet1.Execute Text8.Text, "Post", strCmd, "Content-Type: text/xml" The problem is that I do not have access to any feedback on an incorrect POST, meaning that I could have a formatting error in my XML and never get the result. When I run the VB6 code, everything works perfectly, so all I can try to do is exactly emulate what the Inet1.Execute command is doing. What I have been pounding away on is the following that seems to load without errors, but does not give me any results (I'm hoping this is a stupid format thing I'm missing at this point): <html><head><script type="text/javascript">var xmlhttpfunction postXMLDoc(){var xmlData = '<?xml version="1.0" encoding="us-ascii" ?>' +' <Program.XML RPC="Door.MomentaryAccess">' +' <Authentication>' +' <UserName>userName</UserName>' +' <Password>password</Password>' +' <Domain>domain</Domain>' +' <Workstation>serverName</Workstation>' +' </Authentication>' +' <Parameters>\r\n' +' <Identity>8</Identity>\r\n' +' </Parameters>\r\n' +'</Program.XML>';var url = 'http://serverName'xmlhttp=null// code for Mozilla, etc.if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest() }// code for IEelse if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") }if (xmlhttp!=null) {//Content-Type: text/xml//xmlhttp.setRequestHeader("Content-Type", "text/xml") xmlhttp.onreadystatechange=state_Change xmlhttp.open("POST",url,true) xmlhttp.send(xmlData.xml) alert(xmlData) }else { alert("Your browser does not support XMLHTTP.") }}function state_Change(){// if xmlhttp shows "loaded"if (xmlhttp.readyState==4) { // if "OK" if (xmlhttp.status==200) { alert("XML data OK") } else { alert("Problem retrieving XML data:" + xmlhttp.statusText) } }}</script></head><body onLoad="postXMLDoc()"><h2>Please Work</h2></body></html> One thought I have is that it might be related to the URL I'm using being over the local network "http://serverName". Do I need to hit this through a fully web-accessable address for these XMLHttpRequest() calls to work properly? I have tried it through both IE6/7 and Firefox. Any thoughts would be great, thanks.
×
×
  • Create New...