Link to home
Start Free TrialLog in
Avatar of mavmanau
mavmanauFlag for Australia

asked on

can anybody see anything wrong in this XML HTTP POST?

Hi,

Thank you for taking a look at my question.  I have the basic html page with a little java in it, all I want to do it post some XML data to an API.  Can anyone see where I am going wrong if anywhere?

This is the only error I can get to come up.
test.com : server does not support RFC 5746, see CVE-2009-3555

Your help is most appreciated!!


<html>
<head>
<script>

function connect(url,params)
{
var $cnct;  // The variable that makes Ajax possible!
try{// Opera 8.0+, Firefox, Safari
alert ("Firefox selected");
$cnct = new XMLHttpRequest();}
catch (e){// Internet Explorer Browsers
try{
$cnct = new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){
try{
$cnct = new ActiveXObject("Microsoft.XMLHTTP");}
catch (e){// Something went wrong
return false;}}}
$cnct.open("POST", "https://api.test.com/PRService.svc/Xml/generate",true);
$cnct.setRequestHeader("Content-type","text/xml");
//$cnct.setRequestHeader($cnct, "close");
$params = '<?xml version="1.0" encoding="utf-8"?><PDRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><MCode>T101</MCode><ACode>TGJHFGDG#%</ACode><RType>Email</RType><PtAmount>300</PaymentAmount><PReference>123456</PReference><CEmail>Yes</CEmail><CReference>No</CReference><RName>J Murphy</RecipientName><REmail>sit@big.com</REmail></PDRequest>';
alert($params);
$cnct.send($params);
alert($cnct.responseText);
alert($cnct.responseBody);
alert($cnct.responseXML);
alert($cnct.getAllResponseHeaders());
//return(connection);
}

</script>
</head>
                 
<body>
    <FORM method="POST" name="ajax" action="">                  
         <INPUT type="BUTTON" value="Submit"  ONCLICK="connect('test','test')">
         <INPUT type="text" name="dyn"  value="">
    </FORM>
 </body>
 </html>
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

try with simple http rather than https
Avatar of mavmanau

ASKER

it didn't work either...I haven't done anything wrong in the xmlhttprequest at all have I?
where do you get this error? which browser?
firefox.

All I really want to do, is upload some XML - to a REST endpoint.

Can you see anything wrong in how I am going about the connection etc?  from what I have seen it looks to be exactly how it should be in order to work.
I only see the error in the debug part of firefox.  not sure if it is a warning or an error, from what I have seen on other sites from googling, the system should still try to get through anyway
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
awesome thank you, I shall have a play with it.
Thank you for your help!! muchly appreciated.