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">name@domain.com</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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.