jsp client for axis2 webservice

Discussion in 'Java' started by cod3nam3, Oct 29, 2007.

  1. cod3nam3

    cod3nam3 Guest

    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.
    cod3nam3, Oct 29, 2007
    #1
    1. Advertising

  2. On Oct 29, 9:42 pm, cod3nam3 <> wrote:
    > 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
    Chris ( Val ), Oct 29, 2007
    #2
    1. Advertising

  3. cod3nam3 wrote:
    > 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
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Oct 30, 2007
    #3
  4. cod3nam3

    Lew Guest

    Arne Vajhøj wrote:
    > 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.

    --
    Lew
    Lew, Oct 30, 2007
    #4
  5. cod3nam3

    cod3nam3 Guest

    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.

    On 30 Okt., 13:51, Lew <> wrote:
    > Arne Vajhøj wrote:
    > > 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.
    >
    > --
    > Lew
    cod3nam3, Oct 30, 2007
    #5
  6. cod3nam3

    Lew Guest

    cod3nam3 wrote:
    > 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.

    --
    Lew
    Lew, Oct 30, 2007
    #6
  7. cod3nam3

    cod3nam3 Guest

    On 31 Okt., 00:22, Lew <> wrote:
    > cod3nam3 wrote:
    > > 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.
    >
    > --
    > 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.
    cod3nam3, Nov 10, 2007
    #7
  8. 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
    Andrew Thompson, Nov 10, 2007
    #8
  9. cod3nam3

    Ed Kirwan Guest

    Ed Kirwan, Nov 10, 2007
    #9
  10. cod3nam3

    cod3nam3 Guest

    On 10 Nov., 12:51, Ed Kirwan <> wrote:
    > Andrew Thompson wrote:
    > > Andrew Thompson

    >
    > http://www.athompson.info/andrew/
    >
    > Link's down, Andrew.
    >
    > --
    > .ed
    >
    > 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, Nov 10, 2007
    #10
  11. cod3nam3

    cod3nam3 Guest

    @Andrew: no thanks, i'am just a student...
    cod3nam3, Nov 10, 2007
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Thompson

    Re: jsp client for axis2 webservice

    Andrew Thompson, Oct 29, 2007, in forum: Java
    Replies:
    0
    Views:
    413
    Andrew Thompson
    Oct 29, 2007
  2. MC
    Replies:
    0
    Views:
    963
  3. carmelo
    Replies:
    0
    Views:
    1,276
    carmelo
    Oct 20, 2008
  4. Michael Post
    Replies:
    5
    Views:
    1,119
    Arne Vajhøj
    Aug 22, 2009
  5. Replies:
    1
    Views:
    399
    John Saunders
    Nov 14, 2006
Loading...

Share This Page