You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Alexandru Simion <al...@sec.co.ro> on 2003/06/02 15:15:20 UTC
Calling a web service from a browser
Hi ,
Can, anyone, tell me if it is possible to invoke an axis web service
from a browser ?
And, if yes, what is the procedure to do that ?
Thanks
Sam.
Re: Calling a web service from a browser
Posted by Ingrid Falk <in...@loria.fr>.
>>>>> "Alexandru" == Alexandru Simion <al...@sec.co.ro> writes:
Alexandru> Hi , Can, anyone, tell me if it is possible to invoke
Alexandru> an axis web service from a browser ? And, if yes, what
Alexandru> is the procedure to do that ?
Yes, it should be possible. You either can write a cgi script in perl
and build the SOAP message using SOAP::Lite or use the Servlet Java
class: you get the query string in the servlet's doGet method, do
whatever you like with it - make the soap call - get the response etc.
However to do the latter you have to have a servlet container running
and it has to be properly configured.
Ingrid
Re: Calling a web service from a browser
Posted by Tom Myers <to...@dreamscape.com>.
Alexandru Simion wrote:
> Hi ,
>
> Can, anyone, tell me if it is possible to invoke an axis web service
> from a browser ?
> And, if yes, what is the procedure to do that ?
If you have a recent browser (Moz or IE 6, anyway) supporting XMLHTTP calls,
then there's no problem doing it in Javascript. You get your uri, soapAction,
and envelope (as a string), say for an amazon keyword search request you'd have
"http://soap.amazon.com/onca/soap",
"KeywordSearchRequest",
doAmazonKeywordSearchEnvelope(token,keyword)
where "token" is your Amazon token and "keyword" is what you're searching for;
then you go like so:
var inIE = document.all != null;
var xmlhttp=null;
if(inIE) xmlhttp=new ActiveXObject('MSXML2.XMLHTTP');
else xmlhttp=new XMLHttpRequest();
if(!xmlhttp)
return alert("can't initialize xmlhttp object");
if(!inIE)
netscape.security.PrivilegeManager.
enablePrivilege("UniversalBrowserRead");
xmlhttp.open('POST',uri,false);
xmlhttp.setRequestHeader("SOAPAction", soapAction)
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8")
xmlhttp.send(envelope);
var result=xmlhttp.responseXML;
and there you've got it. Mozilla also lets you work at a higher level, but
this code does work on both, and an axis service should be no problem as
long as you can figure out the envelope. (If necessary, use a Java client
and then use tcpmon or whatever to see what's actually being passed, then
imitate in Javascript. Crude, but you end up with a light-weight client.)
(Comments appreciated)
Tom Myers
RE: Calling a web service from a browser
Posted by Dennis Sherman <de...@endinfosys.com>.
http://<host>:<port>/axis/services/Version?method=getVersion
for example, with a standard installation of axis, will return an
XML document to your browser (which IE, at least, displays fairly
nicely). For a more complex web service, add parameters using
standard URL formation rules.
-----Original Message-----
From: Alexandru Simion [mailto:alexandru.simion@sec.co.ro]
Sent: Monday, June 02, 2003 8:15 AM
To: axis-user@ws.apache.org
Subject: Calling a web service from a browser
Hi ,
Can, anyone, tell me if it is possible to invoke an axis web service
from a browser ?
And, if yes, what is the procedure to do that ?
Thanks
Sam.