creating a simple SOAP Web Service client

I am trying to create a simple demo of a SOAP Web service client using HTML/Javascript.

the invokable interface can be found here

http://72.45.130.90/cgi-bin/test1.exe/wsdl/IDemo1

there is one published call:  "helloWorld"

below you will find my html and javascript to try and call that webservice.

I have tried all sorts of URLS

SOAPClient.invoke( "http://72.45.130.90/cgi-bin/test1.exe", "helloWorld", pl, true, HelloWorld_callBack);
SOAPClient.invoke( "http://72.45.130.90/cgi-bin/test1.exe/WSDL/", "helloWorld", pl, true, HelloWorld_callBack);
SOAPClient.invoke( "http://72.45.130.90/cgi-bin/test1.exe/WSDL/IDemo1", "helloWorld", pl, true, HelloWorld_callBack);
etc.

I have successfully created a client using the same language i created the web service in, and the client connects fine.

Sorry, im new to javascript

thanks

shane
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hellow World Web Service Client Example</title>
<SCRIPT LANGUAGE="JavaScript">

function HelloWorld()
{
    var pl = new SOAPClientParameters();
    SOAPClient.invoke( "http://72.45.130.90/cgi-bin/test1.exe/wsdl/IDemo1", "helloWorld", pl, true, HelloWorld_callBack);
}
function HelloWorld_callBack(r)
{
    alert(r);
} 

</SCRIPT>
</HEAD>
</head>

<body>
<FORM NAME="myform" ACTION="" METHOD="GET"><P>
<INPUT TYPE="button" NAME="button" Value="Click" onClick="HelloWorld()">
</FORM>
</body>
</html>

Open in new window

DelphiRulezAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
Javascript don't have native soapclient function.
I Think you're using this one : http://www.guru4.net/articoli/javascript-soap-client/demo/soapclient.js
from here :
http://www.guru4.net/articoli/javascript-soap-client/demo/en.aspx
http://www.guru4.net/articoli/javascript-soap-client/

Seems the code use ajax that don't support cross domain call so you page MUST be here too : 72.45.130.90
Not only the webservice


<script language="javascript" src="http://www.guru4.net/articoli/javascript-soap-client/demo/soapclient.js"></script>

Open in new window

0
leakim971PluritechnicianCommented:
Code :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hellow World Web Service Client Example</title>
<script language="javascript" src="http://www.guru4.net/articoli/javascript-soap-client/demo/soapclient.js"></script>
<SCRIPT LANGUAGE="JavaScript">
	function HelloWorld()
	{
		var pl = new SOAPClientParameters();
		SOAPClient.invoke( "http://72.45.130.90/cgi-bin/test1.exe/wsdl/IDemo1", "helloWorld", pl, true, HelloWorld_callBack);
	}
	function HelloWorld_callBack(r)
	{
		alert(r);
	} 
</SCRIPT>
</head>
<body>
<FORM NAME="myform" ACTION="" METHOD="GET"><P>
<INPUT TYPE="button" NAME="button" Value="Click" onClick="HelloWorld()">
</FORM>
</body>
</html>

Open in new window

0
DelphiRulezAuthor Commented:
I get a null string back insted of "Hello World" which is what i expect

my source on the server side was written in Delphi (Object Pascal) and looks like this

function helloWold: String;stdcall;
begin
 result:= "Hello World";
end;

once again, this web service works cause i can invoke it with a delphi client
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

leakim971PluritechnicianCommented:
the code use ajax that don't support cross domain call
0
DelphiRulezAuthor Commented:
So do I have to place the JavaScript source
*. js on my server ( domain)?

0
leakim971PluritechnicianCommented:
>So do I have to place the JavaScript source *. js on my server ( domain)?

Not it but your page and the web service.
0
DelphiRulezAuthor Commented:
whats the difference?

So you saying i have to have my web service and and client page on that domain, thats rediculous.

Whats the point of a web service if you have to run the client from the same domain ????????

0
DelphiRulezAuthor Commented:
anyway, how can i write the client above, so i dont have to use the *.js file.

Can anyone give me the code to write a simple client that connects to a simple web service ??????
0
leakim971PluritechnicianCommented:
>Web Service URL (please note that many browsers do not allow cross-domain calls for security reasons).
Check here article of the author (Matteo Casati) : http://www.codeproject.com/KB/ajax/JavaScriptSOAPClient.aspx?fid=260173&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=76
He write : << Web Service URL (please note that many browsers do not allow cross-domain calls for security reasons). >>

>Whats the point of a web service if you have to run the client from the same domain ?
If you search you can find a lot but we're agree, generaly we use webservices from other site web.

>anyway, how can i write the client above, so i dont have to use the *.js file.
>Can anyone give me the code to write a simple client that connects to a simple web service ?

You should use your server as a proxy to download the request from the javascript client.
So you do a basci ajax call to your own domain (your server), a server page that download the content from the web service for you (should easy with Pascal) and return it to your page.
0
leakim971PluritechnicianCommented:
As you can see the web service znd the demo page are on the same domain :
Clipboard02.jpg
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DelphiRulezAuthor Commented:
>>>you can see the web service znd the demo page are on the same domain :

again, you don't explain the signisifcance of this.  Whats the point of a web service if you have to run the client from the web service on the same domain ?  Nobody writes webservices that a client from outside their domain can't reach.

Anyway, im closing this , since no one has answered my question but ou i'll give the points.
0
DelphiRulezAuthor Commented:
Whats the point of a web service if you have to run the client from the same domain ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.