jsp client for axis2 webservice

C

cod3nam3

lam trying to write a jsp client for an axis2 web service.
The web service is already up and running, so the wsdl is already
created by axis2 automatically. I still don't know how to create a jsp
client, which would just call a axis2 web service function. I would
really appreciate ur help.
 
C

Chris ( Val )

lam trying to write a jsp client for an axis2 web service.
The web service is already up and running, so the wsdl is already
created by axis2 automatically. I still don't know how to create a jsp
client, which would just call a axis2 web service function. I would
really appreciate ur help.

Are you able to call it (test it) from the command line,
to check if it is returning a result?

I am in the same boat as you otherwise :)

I have seen that a lot of people are having difficulty
with it, and I have to say that although the initial
setup is easy enough to get going (just dropping a war
file into place, and setting up the AXIS2_HOME) getting
the rest of it to gel is not a trivial thing to sort out,
at least not in my experience so far.

IMHO, the Axis project has some of the worst documentation
that I have ever come across. The documentation seems as if
though it was written in an arrogant way, oozing a sign of
vindictiveness that tends to push people away from it :)
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

cod3nam3 said:
lam trying to write a jsp client for an axis2 web service.
The web service is already up and running, so the wsdl is already
created by axis2 automatically. I still don't know how to create a jsp
client, which would just call a axis2 web service function. I would
really appreciate ur help.

The easiest way is to:
- generate stub code
- put the stub code into your web app
- call the stub code from your JSP page

Arne
 
L

Lew

Arne said:
The easiest way is to:
- generate stub code
- put the stub code into your web app
- call the stub code from your JSP page

That's the nutshell version of the answers over on clj.help for this question.
 
C

cod3nam3

Actually this is my problem. I generated the stub code and it created
two java classes: webservice2stub.java and
webservice2callbackhandler.java. If i use WTP webservice client wizard
in Eclipse i only get the webservice2stub.java so i assume i dont need
the webservice2callbackhandler.java. But what do i do with the
webservice2stub.java. Where exactly do i have to put it and more
importand how do ich call the stub code from the jsp page and what
functions do i call to do that.
I know thats a lot of stuff iam asking here, so if you know some how
to with code examples... that would help me a lot. Or if you habe the
time, could you write some short example.
 
L

Lew

cod3nam3 said:
Actually this is my problem. I generated the stub code and it created
two java [sic] classes: webservice2stub.java and

Are you sure it wasn't "WebService2Stub.java"?
webservice2callbackhandler.java. If i [sic] use WTP webservice client wizard

and "WebService2CallbackHandler.java"?
in Eclipse i [sic] only get the webservice2stub.java so i [sic] assume i [sic] dont need
the webservice2callbackhandler.java. But what do i [sic] do with the
webservice2stub.java. Where exactly do i [sic] have to put it and more
importand how do ich call the stub code from the jsp [sic] page and what
functions do i [sic] call to do that.
I know thats a lot of stuff i [sic] am asking here, so if you know some how
to with code examples... that would help me a lot. Or if you habe the
time, could you write some short example.

Please do not top-post. Use trim-and-inline posting.

Read the Java EE tutorial on the Sun web site. It talks generally about how
to call logic from a JSP.

Essentially, all the JSP does is POST an HTTP request to the application
server. A servlet on the app server receives the request, parses out the
request parameters, and passes them along to an instance of a regular Java
class, usually a Bean. That object in turn will perform some processing, say,
calling one of the stub methods that you have. This will be just a series of
regular method calls, like

Result result = invokeService( ParmType parameter, ArgType argument );

where invokeService() is one of the methods in a logic or web-service stub class.

The object that the servlet called will produce a result. Using that result
and some identifier for what JSP made the request, the servlet decides what
JSP to show next, extracts a RequestDispatcher from the request and does a
call to the RequestDispatcher forward() method to invoke the new JSP. Usually
some result from the business logic will be embedded into a request attribute
or the session for the new JSP to use.

Google or search Sun for "Model 2 architecture" and the
"model-view-controller" paradigm, also called the "front-controller pattern",
as they apply to web apps. Read the Sun Java EE tutorial. Learn how to use
JSPs to call business logic, then it will be obvious how to call the
particular variety of business logic called a "web service client stub".

Examples abound on the Web. You don't need us to break our fingers coming up
with one when a few minutes search on your part will turn up so much better
stuff. GIYF.
 
C

cod3nam3

cod3nam3 said:
Actually this is my problem. I generated the stub code and it created
two java [sic] classes: webservice2stub.java and

Are you sure it wasn't "WebService2Stub.java"?
webservice2callbackhandler.java. If i [sic] use WTP webservice client wizard

and "WebService2CallbackHandler.java"?
in Eclipse i [sic] only get the webservice2stub.java so i [sic] assume i [sic] dont need
the webservice2callbackhandler.java. But what do i [sic] do with the
webservice2stub.java. Where exactly do i [sic] have to put it and more
importand how do ich call the stub code from the jsp [sic] page and what
functions do i [sic] call to do that.
I know thats a lot of stuff i [sic] am asking here, so if you know some how
to with code examples... that would help me a lot. Or if you habe the
time, could you write some short example.

Please do not top-post. Use trim-and-inline posting.

Read the Java EE tutorial on the Sun web site. It talks generally about how
to call logic from a JSP.

Essentially, all the JSP does is POST an HTTP request to the application
server. A servlet on the app server receives the request, parses out the
request parameters, and passes them along to an instance of a regular Java
class, usually a Bean. That object in turn will perform some processing, say,
calling one of the stub methods that you have. This will be just a series of
regular method calls, like

Result result = invokeService( ParmType parameter, ArgType argument );

where invokeService() is one of the methods in a logic or web-service stub class.

The object that the servlet called will produce a result. Using that result
and some identifier for what JSP made the request, the servlet decides what
JSP to show next, extracts a RequestDispatcher from the request and does a
call to the RequestDispatcher forward() method to invoke the new JSP. Usually
some result from the business logic will be embedded into a request attribute
or the session for the new JSP to use.

Google or search Sun for "Model 2 architecture" and the
"model-view-controller" paradigm, also called the "front-controller pattern",
as they apply to web apps. Read the Sun Java EE tutorial. Learn how to use
JSPs to call business logic, then it will be obvious how to call the
particular variety of business logic called a "web service client stub".

Examples abound on the Web. You don't need us to break our fingers coming up
with one when a few minutes search on your part will turn up so much better
stuff. GIYF.

I still don't get it. I've now done all that u suggested, but i still
don't get it. And using Google i still haven't found one decent
example that is actually proper explained.
I reduced everything to that:
Webservice:

package pack;

public class Wser {
public double test(double a){

return a+a;

}
}

I have deployed it as a webservice with the name webs2.
So please can someone write a simple jsp client to that, so i finally
can get an idea how this works.
I read the Java EE Tutorial, i tried the examples and a lot of other
examples on the net. I can't get this working.
 
A

Andrew Thompson

cod3nam3 wrote:
...
I have deployed it as a webservice with the name webs2.
So please can someone write a simple jsp client to that, so i finally
can get an idea how this works.
I read the Java EE Tutorial, i tried the examples and a lot of other
examples on the net. I can't get this working.

I have not read this thread carefully, nor do know the
immediate answer. But from my scanning of the questions
and responses, I am promted to ask..

Have you considered hiring a consultant, for this?

It seems like you need specific, step-by-step help.
Usenet newsgroups are bad for that, whereas consultants
are excellent (though much more expensive).

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
 
C

cod3nam3


Solved. You need Jakarta Taglibs IO.
And the client could look something like this:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ taglib uri="/WEB-INF/taglibs-io.tld" prefix="io" %>

<%
final String urlLocalhost =
"http://localhost:8080/axis2/services/webs2";
String url = request.getParameter( "url" );
String a = request.getParameter( "a" );
url = ( null != url ) ? url.trim() : urlLocalhost;
a = ( null != a ) ? a.trim() : "64";
%>

<html>
<head> <title>webs</title> </head>
<body>
<h2>webs</h2>

<form method="post"><pre>
Enpoint-URL : <input type="text" name="url" value='<%= url %>'
size=80>
Wert : <input type="text" name="a" value='<%= a %>'
size=20>
<input type="submit" name="submit"
value="Rechnen">
</pre></form>

<h3><hr>test( <%= a %> ) --&gt;
<% out.flush(); %>
<io:soap url="<%= url %>" SOAPAction="">
<io:body>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/">
<SOAP-ENV:Body>
<m:test xmlns:m="http://pack">
<in0><%= a %></in0>
</m:test>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</io:body>
</io:soap>
<hr></h3>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top