Jump to content

I have no idea what I'm doing wrong


Garethp

Recommended Posts

I'm trying to make a SOAP call using XMLHttpRequest. This is my code

 

<html>
  <head>
    <title>SOAP call sample</title>
    <script language="Javascript">
    // Variables
    var xmlHttpReq = false;
    var callname = "http://autoi.com.au/PartGroups";

    function xmlhttpPost() 
	{
	// Mozilla/Safari
	if (window.XMLHttpRequest) 
		{
		xmlHttpReq = new XMLHttpRequest();
		}

    // IE
	else if (window.ActiveXObject) 
		{
		xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}

	xmlHttpReq.open('POST', 'http://119.31.230.58/', true);

	//Set the Headers
	xmlHttpReq.setRequestHeader('Content-Type','text/xml');
	xmlHttpReq.setRequestHeader('SOAPAction',callname);

	//When the response is available, update the response text
	xmlHttpReq.onreadystatechange = function() 
		{
		if (xmlHttpReq.readyState == 4) 
			{
			//document.forms['main'].eBayXMLResponse.value = xmlHttpReq.responseText;
			alert(xmlHttpReq.responseText);
			}
		}

	//get the XML Request string
	xmlHttpReq.send
	('<?xml version="1.0" encoding="utf-8"?>'
	+ '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
	+ '<soap:Body>'
	+ '<PartGroups xmlns="http://autoi.com.au/">'
	+ '<UserId>int</UserId>'
	+ ' <AuthCode>string</AuthCode>'
	+ '</PartGroups>'
	+ '</soap:Body>'
	+ '</soap:Envelope>');

	//document.forms['main'].eBayXMLResponse.value = xmlHttpReq.responseText;
	alert('2: ' + xmlHttpReq.responseText);
	}

  </script>

</head>

<form name="main">
<table>
    <tr>
      <td> <input value="Submit to eBay => " type="button" onclick='JavaScript:xmlhttpPost()'></td>
      <td><textarea name="eBayXMLResponse" wrap="soft" rows="40" cols="50" style="overflow:scroll" ID="Textarea1"></textarea></td>
    </tr>
</table>
</form>

</html>

 

And these are the intructions I was given on how to format the SOAP

 

http://125.236.209.214/autoiaspwebservice.asmx?op=PartGroups

 

But the thing is, I don't get a response. I mean, it's blank. I don't understand. I've tried changing the destination, but I still have no idea why it's not working. Is there anybody who can help?

Link to comment
https://forums.phpfreaks.com/topic/189396-i-have-no-idea-what-im-doing-wrong/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.