You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Jean-Michel PATER (JIRA)" <ji...@apache.org> on 2006/09/15 16:37:22 UTC

[jira] Created: (AXIS2-1171) Access service context attributes

Access service context attributes
---------------------------------

                 Key: AXIS2-1171
                 URL: http://issues.apache.org/jira/browse/AXIS2-1171
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Task
          Components: transports
    Affects Versions: 1.0
         Environment: Linux
            Reporter: Jean-Michel PATER


Hi all,

How can I get servlet context attributes from a Web Service ?

Should I get an instance of AxisServlet or to MessageContext ? 

If so, how can I initialize them ?

Thanks. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Resolved: (AXIS2-1171) Access service context attributes

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-1171?page=all ]

Deepal Jayasinghe resolved AXIS2-1171.
--------------------------------------

    Resolution: Fixed

Seems it fixed in current SVN.

> Access service context attributes
> ---------------------------------
>
>                 Key: AXIS2-1171
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1171
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Task
>          Components: transports
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Jean-Michel PATER
>         Assigned To: Deepal Jayasinghe
>
> Hi all,
> How can I get servlet context attributes from a Web Service ?
> Should I get an instance of AxisServlet or to MessageContext ? 
> If so, how can I initialize them ?
> Thanks. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (AXIS2-1171) Access service context attributes

Posted by "Jean-Michel PATER (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1171?page=comments#action_12435482 ] 
            
Jean-Michel PATER commented on AXIS2-1171:
------------------------------------------

Hi,

I may have missed something. I have implemented the setOperationContext method in my service implementation class (in the skeleton class). I have then a method like that in my skeleton :

>         public void setOperationContext(OperationContext opContext){
>             log.info("Entering setOperationContext");
>             ServiceContext serviceCtx = opContext.getServiceContext();
>             ConfigurationContext configCtx = serviceCtx.getConfigurationContext();
>             if(configCtx == null) {
>                 log.error("setOperationContext --> configuration context not initialized");
>                 return;
>             }                        servletCtx = (ServletContext)configCtx.getProperty("transport.http.servletContext");
>                            if(servletCtx == null) {
>                 log.error("setOperationContext --> servlet context not initialized");
>                 return;
>             }
>                                        CarsDB carsDB = (CarsDB)servletCtx.getAttribute("carsCB");                                      }


But I always have " servlet context not initialized " in my log file.

The receiver class is the receiver generated from the WSDL2Java command line which extends org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver

> Access service context attributes
> ---------------------------------
>
>                 Key: AXIS2-1171
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1171
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Task
>          Components: transports
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Jean-Michel PATER
>         Assigned To: Deepal Jayasinghe
>
> Hi all,
> How can I get servlet context attributes from a Web Service ?
> Should I get an instance of AxisServlet or to MessageContext ? 
> If so, how can I initialize them ?
> Thanks. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Assigned: (AXIS2-1171) Access service context attributes

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-1171?page=all ]

Deepal Jayasinghe reassigned AXIS2-1171:
----------------------------------------

    Assignee: Deepal Jayasinghe

> Access service context attributes
> ---------------------------------
>
>                 Key: AXIS2-1171
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1171
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Task
>          Components: transports
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Jean-Michel PATER
>         Assigned To: Deepal Jayasinghe
>
> Hi all,
> How can I get servlet context attributes from a Web Service ?
> Should I get an instance of AxisServlet or to MessageContext ? 
> If so, how can I initialize them ?
> Thanks. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (AXIS2-1171) Access service context attributes

Posted by "Jean-Michel PATER (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1171?page=comments#action_12443734 ] 
            
Jean-Michel PATER commented on AXIS2-1171:
------------------------------------------

Hi Deepal,

I'm sorry I didn't say that my problem was resolved. For this I used the 
following code :
    public void setOperationContext(OperationContext opContext) throws 
Exception {
       ServletContext servletCtx = null;
        ServiceContext serviceCtx = opContext.getServiceContext();
        ConfigurationContext configCtx = 
serviceCtx.getConfigurationContext();     

        if (configCtx == null)
            throw new Exception("Configuration context not initialized");
       

        try {
            MessageContext msgCtx = 
opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
            if (msgCtx == null)
                throw new Exception("Message context not initialized");
           
            servletCtx = (ServletContext) 
msgCtx.getProperty(Constants.SERVLET_CONTEXT);

            if (servletCtx == null)
                throw new Exception("Servlet context not initialized");
           
            CarsDB carsDB = (CarsDB)servletCtx.getAttribute("carsCB");
        } catch (AxisFault e) {
            e.printStackTrace();
        }
    }

Thanks.


-- 
Jean-Michel PATER <pa...@cogenit.fr>
Cogenit                                  Tél : +33 (0) 1 40 20 08 43
53 rue Sainte Anne                       Fax : +33 (0) 1 40 20 08 45
75002 Paris                              <URL:http://www.cogenit.fr>



> Access service context attributes
> ---------------------------------
>
>                 Key: AXIS2-1171
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1171
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Task
>          Components: transports
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Jean-Michel PATER
>         Assigned To: Deepal Jayasinghe
>
> Hi all,
> How can I get servlet context attributes from a Web Service ?
> Should I get an instance of AxisServlet or to MessageContext ? 
> If so, how can I initialize them ?
> Thanks. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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


[jira] Commented: (AXIS2-1171) Access service context attributes

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-1171?page=comments#action_12443700 ] 
            
Deepal Jayasinghe commented on AXIS2-1171:
------------------------------------------

I tested in the current SVN and seems it working :)
To get servletContext I used the following code;

ServletContext servletContext = (ServletContext)operationCtx.getProperty("transport.http.servletContext");

Can you please try that with current SVN and see whether it works for you.



> Access service context attributes
> ---------------------------------
>
>                 Key: AXIS2-1171
>                 URL: http://issues.apache.org/jira/browse/AXIS2-1171
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Task
>          Components: transports
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Jean-Michel PATER
>         Assigned To: Deepal Jayasinghe
>
> Hi all,
> How can I get servlet context attributes from a Web Service ?
> Should I get an instance of AxisServlet or to MessageContext ? 
> If so, how can I initialize them ?
> Thanks. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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