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 Nirmit Desai <ni...@us.ibm.com> on 2006/08/01 04:55:27 UTC

[Axis2 1.0] parameters in services.xml

Hi all,

I am trying to set a parameter in my services.xml file and get it in my
service like this (all document/literal with ADB):

<parameter name="memberName" locked="false">SampleMember</parameter>

And in my service implementation class:

private MessageContext msgCtx=null;

public void init(MessageContext ctx)
{
      msgCtx=ctx;
      System.out.println("init called..context:"+ctx);
}

public  com.ibm.sobe.xsd.PingReturn ping(com.ibm.sobe.xsd.PingParam param0)
{
      PingReturn pr=new PingReturn();
      System.out.println("Param:"+msgCtx.getParameter("memberName"));
      .....
}

It throws a NullPointerException when any operation on msgCtx is attempted,
implying that msgCtx is null. I followed the advice give in this article:
http://www.developer.com/open/print.php/10930_3589126_3

Is this the best way to do this? If so, what am I doing wrong? I really
need a way to access statically set parameters in services.xml.

Thanks,

-Nirmit


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2 1.0] parameters in services.xml

Posted by Deepal Jayasinghe <de...@opensource.lk>.
If you want to get access to AxisService object you do one of the following
  *option1 *
  - add the init method (need to change your method)
     init(ServiceContext sctx){      
          this.sctx=sctx
     }
  Then using the above service context you can get the axisService and
from that you can get the parameter

 *option2
  *- add setOperationContext into service impl class
 
    setOperationContext(OperationContext opCtx){
         inmgsCtx = opctx.getMessageConetxt("in");
    }


if you want to know more about these stuff pls see Axis2 session
management article  in developer.com.

Thanks
Deepal

Nirmit Desai wrote:

>Hi all,
>
>I am trying to set a parameter in my services.xml file and get it in my
>service like this (all document/literal with ADB):
>
><parameter name="memberName" locked="false">SampleMember</parameter>
>
>And in my service implementation class:
>
>private MessageContext msgCtx=null;
>
>public void init(MessageContext ctx)
>{
>      msgCtx=ctx;
>      System.out.println("init called..context:"+ctx);
>}
>
>public  com.ibm.sobe.xsd.PingReturn ping(com.ibm.sobe.xsd.PingParam param0)
>{
>      PingReturn pr=new PingReturn();
>      System.out.println("Param:"+msgCtx.getParameter("memberName"));
>      .....
>}
>
>It throws a NullPointerException when any operation on msgCtx is attempted,
>implying that msgCtx is null. I followed the advice give in this article:
>http://www.developer.com/open/print.php/10930_3589126_3
>
>Is this the best way to do this? If so, what am I doing wrong? I really
>need a way to access statically set parameters in services.xml.
>
>Thanks,
>
>-Nirmit
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
>  
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org