Jump to content

WSAPI Question


dug

Recommended Posts

hello,

 

i have the below js script that is supposed to connect to the wsapi service, but it always erros out with: Server unknown error.  does anyone here please know what i am doing wrong?

<html>
<title>Test Connect to SilverPop</title>
<head> 

<script type="text/javascript">

var serviceURL = "http://services.vtrenz.net/receiver.cfc?wsdl";
var username = "username";
var password = "password";
var XMLRequest = '\
<?xml version="1.0" encoding="UTF-8"?> \
<incoming-requests> \
	<request description="insertContact"> \
		<incoming-data> \
			<contact databaseID="e1271218-1b41-4547-be35-da0476f5f3ff" iMarketingSyncID="" syncID=""> \
				<field id="First Name">lolamain</field> \
				<field id="Last Name">Jedi</field> \
				<field id="Email">[email protected]</field> \
			</contact> \
		</incoming-data> \
	</request> \
</incoming-requests>';


// Using webservice.htc

var callID = 0;
function getWSDL()
{
myWebService.useService(serviceURL,"service");
}
function getResult()
{
output.innerText = event.result.value;
}
function handleResult(result) 
{
if(result.error)
{
	var xfaultcode = result.errorDetail.code;
	var xfaultstring = result.errorDetail.string;
	var xfaultsoap = result.errorDetail.raw;
	alert("All NOT OK: \n" + xfaultcode + '\n' + xfaultstring + '\n' + xfaultsoap);
}
else
{
	alert("All OK");
}
}
function Lookup()
{
var co = myWebService.createCallOptions();
co.async = false;
co.userName = username;
co.password = password;
co.funcName = "incomingRequest";
co.params = XMLRequest;
callID = myWebService.service.callService(co);
handleResult(callID);
}
</script>

</head>

<body onLoad="getWSDL()">

<h1>Consuming a webservice by HTML Page</h1>
<div id="myWebService" style="behavior:url(webservice.htc)" onresult="getResult()"></div>
<input Type="Button" Value="Go!" OnClick="Lookup()">
<div ID="output"></div>

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/188204-wsapi-question/
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.