Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi, I am trying to connect to my server via web services in the browser and I can't find a way. Here is a simple example:
1. Create a calcserver from examples from gSoap(here). The only change I made is in calc.h:
//gsoap ns service location:	http://localhost:11011
2. Create html in the same directory and use example(here). Make little modifications(like where is wsdl).
3. Copy WebService HTC File to the same directory.
 
The server is running, because i tested it in soapUI(generated new project from wsdl, that was generated from soapccp2 and everything worked - add, sub, div), but the javascript client can't connect and I have no idea why Frown | :(
Maybe it is becouse the service is located on http://localhost:11011 and the wsdl is in the directory where is the html. But it is only maybe.
Any suggestions please?
Here is the code of html:
<html>
<head>
<script language="JavaScript">
var iCallID;
 
function init()
{
	service.useService("calc.wsdl","MyMath");
	iCallID = service.MyMath.callService("add",5,6);
}
 
function onWSresult()
{  
    if((event.result.error)&&(iCallID==event.result.id))  
	{    
		var xfaultcode = event.result.errorDetail.code;
		var xfaultstring = event.result.errorDetail.string;    
		var xfaultsoap = event.result.errorDetail.raw;
		
		// Add code to output error information here
		alert("Error: " + xfaultcode + " " + xfaultstring + " " + xfaultsoap);
	}
	else
	{
		alert("The method returned the result : " + event.result.value);
	}
}
</script>
</head>
<body onload="init()">
<div id="service" style="behavior:url(webservice.htc)"  onresult="onWSresult()">
</div>
</body>
</html>
Posted 10-May-13 2:24am
lliame174
Edited 10-May-13 3:04am
v8
Comments
Sunasara Imdadhusen at 21-May-13 3:58am
   
What is error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 299
2 BillWoodruff 174
3 /\jmot 170
4 Suraj Sahoo | Coding Passion 150
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 10 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100