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 Android MD <an...@gmail.com> on 2011/04/06 05:23:45 UTC

Simple Stub Methods Pls

Hi,

Basically, I want my stub's method signatures to be same as the service that
was used. Please note that I am not creating a contract first web service,
where you create the wsdl first. Instead, I am going the POJO first
approach. Where I have my neat little Java class, with it's methods
implementing business logic, and need to expose it using a web service. For
example, let's look a the following, my Web Service POJO class looks like
this,

public class StudentService
{

public Student registerNewStudent(Student student)
{

//code to persist student object to database using hibernate (or JPA) and
get the unique student id
return student;

}

}

Then I packaged this into an AAR and deployed to Axis2 war running inside
Tomcat 7.0

Using wsdl that is generated by Axis2, I generated client stub using the
Eclipse's code generator plugin. But the stub contains another level of
abstraction in the method signatures to wrap the parameters. For example,
the stub looked like this.

public class StudentServiceStub
{

public RegisterNewStudentResponse
registerNewStudent(RegisterNewStudentRequest rnreq) { ..... }

}

So when I want to use the service, the stub does not necessarily completely
mask the complexity of calling the web service. You have to know little
tidbits about Request/Response stuff, which is totally unnecessary.

Can someone please explain how we can get rid of these difficult to use
method signatures and instead generate a stub that is easy to call an Axis2
web service.

Thanks and best regards,

AndroidGuy...

Re: Simple Stub Methods Pls

Posted by Afkham Azeez <af...@gmail.com>.
Use the unwrap (-uw) option when generating the stub.


On Wed, Apr 6, 2011 at 8:53 AM, Android MD <an...@gmail.com> wrote:

> Hi,
>
> Basically, I want my stub's method signatures to be same as the service
> that was used. Please note that I am not creating a contract first web
> service, where you create the wsdl first. Instead, I am going the POJO first
> approach. Where I have my neat little Java class, with it's methods
> implementing business logic, and need to expose it using a web service. For
> example, let's look a the following, my Web Service POJO class looks like
> this,
>
> public class StudentService
> {
>
> public Student registerNewStudent(Student student)
> {
>
>  //code to persist student object to database using hibernate (or JPA) and
> get the unique student id
> return student;
>
> }
>
> }
>
> Then I packaged this into an AAR and deployed to Axis2 war running inside
> Tomcat 7.0
>
> Using wsdl that is generated by Axis2, I generated client stub using the
> Eclipse's code generator plugin. But the stub contains another level of
> abstraction in the method signatures to wrap the parameters. For example,
> the stub looked like this.
>
> public class StudentServiceStub
> {
>
> public RegisterNewStudentResponse
> registerNewStudent(RegisterNewStudentRequest rnreq) { ..... }
>
> }
>
> So when I want to use the service, the stub does not necessarily completely
> mask the complexity of calling the web service. You have to know little
> tidbits about Request/Response stuff, which is totally unnecessary.
>
> Can someone please explain how we can get rid of these difficult to use
> method signatures and instead generate a stub that is easy to call an Axis2
> web service.
>
> Thanks and best regards,
>
> AndroidGuy...
>



-- 
*Afkham Azeez*
Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com,
*
*
*Member; Apache Software Foundation;
**http://www.apache.org/*<http://www.apache.org/>
*
email: **azeez@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
*
*