Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

jsp client for axis2 webservice

Thread view: 
cod3nam3 - 29 Oct 2007 11:42 GMT
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.
Chris ( Val ) - 29 Oct 2007 13:37 GMT
> 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 :-)

--
Chris
Arne Vajhøj - 30 Oct 2007 01:55 GMT
> 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
Lew - 30 Oct 2007 13:51 GMT
> 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.

Signature

Lew

cod3nam3 - 30 Oct 2007 19:56 GMT
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.

> Arne Vajh?j wrote:
> > The easiest way is to:
[quoted text clipped - 6 lines]
> --
> Lew
Lew - 31 Oct 2007 00:22 GMT
> 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
[quoted text clipped - 4 lines]
> 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.

Signature

Lew

cod3nam3 - 10 Nov 2007 09:53 GMT
> > Actually this is my problem. I generated the stub code and it created
> > two java [sic] classes: webservice2stub.java and
[quoted text clipped - 49 lines]
> --
> Lew

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.
Andrew Thompson - 10 Nov 2007 11:38 GMT
...
>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).

Signature

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

Ed Kirwan - 10 Nov 2007 11:51 GMT
> Andrew Thompson
http://www.athompson.info/andrew/

Link's down, Andrew.

Signature

.ed

www.EdmundKirwan.com - Home of the mathematical laws of encapsulation.

cod3nam3 - 10 Nov 2007 14:36 GMT
> > Andrew Thompson
>
[quoted text clipped - 6 lines]
>
> www.EdmundKirwan.com- Home of the mathematical laws of encapsulation.

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>
cod3nam3 - 10 Nov 2007 14:38 GMT
@Andrew: no thanks, i'am just a student...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.