Hi all,

This brings me to an interesting related question. We have a webservice
based upon
a wsdl by a third party. Now we would like to be able to parse / use a
parameter send
on the invoking URL bij the third party who invokes our service, without
putting that
into the wsdl over wich we have litle to no controll. For example:

http://ourserver.com/axisservices/ourservice?valueOne

Anyone know if this can be done ?

Sincere greetings,

Leo de Blaauw

----- Original Message -----
From: "Thomas Bayer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 01, 2003 2:03 PM
Subject: AW: Passing parameters to constructor


> Hi Massimo,
>
> Axis is responsible for the creation of MyClass objects. So Axis creates
an
> instance of the service implementation using the newInstance() method of
> class Class. Axis expects a default constructor. Normally the Java
compiler
> generates a default constructor, but if you write your own constructor the
> Java compiler doesn't insert a default constructor.
> So you can use two constructors one default for Axis and one if you use
the
> class somewhere else. But if you want Axis to initialize your service you
> can use the init() method of the ServiceLifecycle interface and parameters
> from the wsdd file.
>
> Thomas
>
>
> WSDD:
>
> <service name="MyService" provider="java:RPC">
>   <parameter name="className" value="MyClass"/>
>   <parameter name="a" value="1"/>
>   <parameter name="b" value="2"/>
> </service>
>
>
>
> MyClass:
>
> public class MyClass implements ServiceLifecycle {
>     private int a=0;
>     private int b=0;
>
>     public void init(Object servletEndpointContext) throws
ServiceException
> {
>
>       MessageContext msgContext = MessageContext.getCurrentContext();
>
>       System.out.println("a: " + msgContext.getProperty("a"));
>       System.out.println("b: " + msgContext.getProperty("b"));
>     }
>
>     public void destroy() {
>     }
>
>     public int callMe{
>         return a+b;
>     }
>
> }
>
> > -----Urspr�ngliche Nachricht-----
> > Von: Massimo Barabino [mailto:[EMAIL PROTECTED]
> > Gesendet: Montag, 1. September 2003 13:02
> > An: [EMAIL PROTECTED]
> > Betreff: Re: Passing parameters to constructor
> >
> >
> > vairamuthu thayapavan wrote:
> >
> > >hi
> > >i think u mean the ws classes in axis. for that 1st specify a default
> > >constructor with out any parameter. then specify ur constructor with
> > >required parameter.
> > >-
> > >thayapavan
> > >
> > >
> > Hi,
> > Thanks a lot for the replies.
> > Maybe I need to be more specific with what I mean as "the constructor of
> > the java class invoked by axis". Suppose my Service just consists of one
> > simple class as follows.
> >
> > public class MyClass{
> >     private int a=0;
> >     private int b=0;
> >
> >     public MyClass(){
> >         this.a=1;
> >         this.b=2;
> >     }
> >
> >     public int callMe{
> >         return a+b;
> >     }
> >
> > }
> >
> > If the constructor remains as I wrote, everithing goes OK. As I change
> > it as follows I get fault codes
> >
> > ...
> >
> > public MyClass(int a, int b){
> >         this.a=a;
> >         this.b=b;
> >     }
> > ...
> >
> > This is my problem. (may be Thomas' and your replies already apply to
> > this...)
> >
> > Thanks once again
> >
> > Massimo Barabino
> >
> >
>

Reply via email to