Web Services and session management

Hello,
I am building an application using tomcat and axis2 for ws support. Is there any (standard, preferably) way to maintain session information accross multiple soap invocations? Or maybe even manage the sessions by myself "logically" and send something like a header identifying the session key with each request?
Any comments would be appreciated,
Thx

Hi
Axis2 offers two ways of doing session management. The first way uses a cookie. You need to specify scope="transportsession" in your services.xml, and ensure that cookies are enabled.
The second way is not dependent on HTTP cookies, but uses WS-Addressing headers instead. It is scope="soapsession". If you use the Axis2 client then you can do this very simply use setManageSession(true) on your ServiceClient.
e.g. stub._getServiceClient.setManageSession(true);
If you use another client, you will need to get the header from the response message and add it to future requests yourself.
Can I suggest you move this discussion to [email protected] where all the axis2 experts hang out?
Paul

Similar Messages

  • Plugin based Web Service with session management

    I am trying to make a web service in java with jax-ws that should support extensions to the service without rebuilding the project. I thought it might be possible to make a standard web service and the let each plugin create their own service, making the client side plugin point to both the standard service and the plugin specific one. This way I could have user management and such in the standard service and the more plugin specific one in an other service. The problem is though, how do I make a common session for all the services? All services are running at the same server and on the same domain name.
    I checked the HTTP headers and found out that the JSESSIONID was changing when I created a new port on the client side. I was trying to implement a SOAPHandler to edit the cookie in the HTTP header, hoping that this will lead to the same session across the services. But found it hard. It was no problem reading the "Set-cookie" header, setting the cookie on the new requests was harder, as the CookieJar object seems to be internal [1]. And the MessageContext.HTTP_REQUEST_HEADERS wasn't created at the time my handlers run. Is there an easy solution to this?
    I am not sure if my idea is a good solution to the main problem, and all other ideas are more than welcome. I hope it is possible to extend the features of my server without rebuilding the project. If anything is unclear, feel free to ask :)
    [1] com.sun.xml.internal.ws.client.http.CookieJar

    Adhir_Mehta wrote:
    Could you explain plug in scenario with one example?Ok. We have not chosen exactly how to do this, but the idea is that someone may be able to extend the functionality of our server without rebuilding the project. We thought of something like a jar file with a implementation of some abstract classes. It should at least only be necessary to redeploy the project into the web container. The problem is; how do we let the plugins extend our web interface? One solution we thought of was to let each plugin have it's own service and dynamicly link to the plugin services from the main service that we provide as standard in our server. This way we may have some kind of plugin support on the clients as well, making the client side plugins know what kind of service it needs on the server side and thus extending the functionality all together.
    Hope that explains our scenario. Feel free to comment and add new ideas :)
    Regarding session management, its not advisable to manage the session in web services since that way it will become non interoperable.The documentation we found regarding sessions and jax-ws was all doing sessions with HTTPSessions, and to let the web container handle that.
    On the server side
        @Resource
        private WebServiceContext wsContext;
        private HttpSession getSession() {
            MessageContext mc = wsContext.getMessageContext();
            return ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST)).getSession();
        HttpSession session = getSession();
        session.setAttribute("User", user);On the client side
    ((BindingProvider)port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,true);Do you have other standard options for us on how to do session management? All ideas are more than welcome

  • Web service authentication/session management using Axis2

    I'm creating a web service using Axis2 where the client will need to login to the service and maintain a session. I'm trying to figure out a good way to do this. I've read the article on the following link:
    http://www.developer.com/services/article.php/3620661/Axis2-Session-Management.htm
    and it describes 4 main ways of doing this: Request Session Scope, Soap session scope, Transport session scope, and Application scope. However, it doesn't give much detail in actually implementing this. It says to add a parameter to services.xml like this:
    <service name="foo" scope=" transportsession">
    </service>
    but what about the actual code that goes in the server and client to actually handle the login process and verify the username/password in an SQL database on the server? I'm having a lot of trouble finding a good tuturial on this. Can anyone point me in the right direction? I'm also open to other ideas that don't necessarily directly involve Axis2.

    Session management for a web service and already answered. Locking.

  • Web services and sessions

    how to maintain a session with coldfusion web service?

    Many sites handle this by generating a transaction key on the
    intial web service contact and then forcing the client to echo the
    transaction key back for every web service method called. You could
    then store your CF variables in a database using the transaction
    key as the way to store/retrieve them. Easiest way would be to
    serialize a CF structure using <cfwddx>. Given, you wouldn't
    be using your typical coldfusion session variables (which I don't
    think you could use anyway via webservice as there is no way to id
    the session) - but it should work about the same. You would just
    need to schedule a task to go through and remove old data on a
    regular basis, as the "session" data would eventually fill your
    DB.

  • What is the difference between Session timeout and Short Session timeout Under Excel Service Application -- session management?

    Under Excel Service Application --> session management; what is the difference between Session timeout and Short Session timeout?

    Any call made from the API will automatically be set to the “Session Timeout” period, no matter
    what. Calls made from EWA (Excel Web Access) will get the “Short Session Timeout” period assigned to it initially.
    Short Session Timeout and Session Timeout in Excel Services
    Short Session Timeout and Session Timeout in Excel Services - Part 2
    Sessions and session time-outs in Excel Services
    above links are from old version but still applies to all.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Web services and EJB3 @resource annotation

    This block of code works fine when NetworkViewBean is left as a @Stateless session bean.
    Once I have JDeveloper 10.1.3 production expose it as a web service, I can no longer call the Entity Manager @Resource.
    I always get a java.lang.NullPointerException returned.
    Any ideas?? thanks for your help!
    @WebService(name = "NetworkViewWS", serviceName = "NetworkViewWS")
    public class NetworkViewBean {
    @Resource
    private EntityManager em;
    public NetworkViewBean() { }
    public String getDeviceVendorModel(String name) {
    if (name == null || name.length()== 0) return "Null Input Parameter Specified";
    NetDevice N= null;
    try {
    N= (NetDevice)em.createNamedQuery("findByDeviceName").setParameter(0, name).getSingleResult();
    catch(Exception E) { E.printStackTrace();  return null; }
    return "Vendor= "+ N.getVendor()+ ", Model= "+ N.getModelNumber();

    Hi Joshua,
    The problem is that you are using a regular Java web service and in 10.1.3.0.0 we do not have support for dependency injection in the container in the web container i.e. you cannot use annotations such as EJB, Resource in any classes in the web container.
    You have two options:
    1. Lookup an EJB from regular Java web service (JSR-181)
    or
    2. Make your Web service as a EJB 3.0 web service
    Here what you can do to create an EJB 3.0 web service from JDev
    1. Create an EJB 3.0 Session bean with remote interface
    2. Change your remote interface to a web service end-point change @Remote to @WebService (import javax.jws.WebService)
    3. You do not have to use @WebMethod, we automatically expose all methods in the end-point interface in the web service
    4. You can inject EJB using @EJB
    5. Create a deployment profile for the EJB-jar and deploy the ejb-jar and the EJB will be exposed as a web service. The context-uri for the web service will be /ejb-jarName
    Hope this helps!
    -Debu Panda
    OC4J Product Management
    blog: http://debupanda.com
    -Debu

  • How to call a web service that is managed by web services manager from omni

    Ok gurus... here is an interesting one for you.
    We have a set of web services that are deployed to our server. We have Oracle Web Services Manager deployed to another server and is acting as a gateway to our web services.
    We would like to call our web service and pass it the username and password that were specified in the omniportlet connection information screen. How do we go about doing this?
    PS. We are using the latest version of portal (10.1.4).
    Thanks for your help.
    Cheers,
    Cory

    Just a follow up. What I would like to do is to have omni portlet add standard header information for security such as the following:
    <soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:Username>theusername</wsse:Username>
    <wsse:Password>thepassword</wsse:Password>
    </wsse:UsernameToken>
    </wsse:Security>
    </soap:Header>
    Any ideas on how to get omniportlet do this? Any ideas on where to look for the answer? Oracle dudes: Any plans to add this to future releases?
    Thanks again folks :-)
    Cory

  • Web service and servlets in the same project...web.xml?

    Hello, I have a problem with my web service.
    I have a server, which displays a web service. I programmed this service with JAXRPC.
    I have a client, in another directory. I succeded in compiling, deploying and running the web service.
    The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
    These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
    But of course, it's not working by itself. I know there's something to do with the web.xml files.
    The thing is that I created a web.xml file for the service, and another for the servlets.
    I was thinking of joining both of them in one xml file, but everything crashes then...
    Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
    Thanks for any help
    Philippe

    Hello, I have a problem with my web service.
    I have a server, which displays a web service. I programmed this service with JAXRPC.
    I have a client, in another directory. I succeded in compiling, deploying and running the web service.
    The problem is that after I tried to integrate this service in an existing project. This project contains servlets. In these servlets, I'm using sessions.
    These servlets are on the same side as the server of the web service. Because of the implementation of my code, I'd like to use in the class that represents the server of the service, the same session as the one I'm using in the servlets.
    But of course, it's not working by itself. I know there's something to do with the web.xml files.
    The thing is that I created a web.xml file for the service, and another for the servlets.
    I was thinking of joining both of them in one xml file, but everything crashes then...
    Could someone tell me how to create a project with a web service and servlets, and mostly how to configure the xml file??
    Thanks for any help
    Philippe

  • Last Chance to Weigh In On Web Services and SOA

    <p>
    IDC is conducting a worldwide survey to get a developer's perspective on Web Services and Service-Oriented Architecture (SOA) in collaboration with several large IT vendors, including SAP.  Originally the survey was scheduled to close on January 22; however the deadline for participating has been extended until January 31, 2007.
    </p>
    <p>
    We invite members of the SDN community to participate in this survey regardless of what role you may play in the software development life cycle, and whether you are an individual contributor or a manager. 
    </p>
    <p>
    The results of this survey will be made available in a variety of forms to information technology vendors.  Please be assured that the information you provide is intended to be used only in aggregation with the answers of other respondents.
    </p>
    If you complete the survey and provide your email address, the following incentives will be made available to you:
    <p>
    <UL type="sqaure">
    <li>Access later to a pre-selected IDC publication</li>
    <li>Access to a selected subset of this survey's results when they become available</li>
    <li>20 contribution points on SDN</li>
    </UL>
    </p>
    <p>
    The survey is Web-based, and should take approximately 30 minutes to complete. 
    </p>
    <p>
    Click <a href=http://www.idcswdc.com/cgi-bin/survey?id=306cft target="_blank">"here"</a> to take the survey.
    </p>
    Thank you for your participation.

    hi user572206
    If you don't get an answer here, there is also a "BPEL" forum:
    BPEL
    (tip : You can use "Your Control Panel" to make your name visible in forum posts.)
    success
    Jan Vervecken

  • Weigh In On Web Services and SOA

    IDC, an independent world-wide market research company, is conducting a worldwide survey to get a developer's perspective on Web Services and Service-Oriented Architecture (SOA) in collaboration with several large IT vendors, including SAP. 
    We are inviting members of the SDN community to participate in this survey regardless of what role you may play in the software development life cycle, and whether you are an individual contributor or a manager. 
    The results of this survey will be made available in a variety of forms to information technology vendors.  Please be assured that the information you provide is intended to be used only in aggregation with the answers of other respondents.
    If you complete the survey and provide your email address you will be awarded 20 contribution points on SDN, in addition to the incentives that IDC is offering as outlined in the survey introduction.
    The survey, which is open until January 22, is Web-based and should take approximately 30 minutes to complete.
    Click <a href="http://www.idcswdc.com/cgi-bin/survey?id=306cft">here</a> to take the survey.

    hi user572206
    If you don't get an answer here, there is also a "BPEL" forum:
    BPEL
    (tip : You can use "Your Control Panel" to make your name visible in forum posts.)
    success
    Jan Vervecken

  • Java app with web service and servlets

    Hi. I intend to make a java application which exposes some methods as a web service and as jsp/servlets. It's core functionality is not really web centric, but its more a java app with a web tier. I am not sure about how the architecture of such a system would look like using the java platform. I currently see three options:
    1. Run everything in a servlet container like tomcat. I hesitate to do this because i would be putting a lot of functionality which isn't about the web into a servlet container. Also, I have a lot of application scope data that is maintained and shared by all servlets/web services. However, it would be really easy just to put everything into tomcat and use ServletContext to maintain some global objects.
    2. Use a Java EE to seperate application/business logic and data access into session beans and entity beans. I hesitate to this because it seem a bit overkill because the system isn't very big or complex right now. It also means that I would have to learn to use EJB's instead of just using some POJOs.
    3. Run the web tier in a servlet container and the main app in a separate JVM, and then connect the tier by sending serialized objects over TCP sockets. I don't like writing network code but at least there is some separation of the tiers.
    What would you do? Maybe I have overlooked a much better solution to the problem?
    Let me just say that the system is the product of a student project spanning one semester, so it's important to choose the RIGHT solution (architectural-wise) instead of the something quick and dirty that is hard to defend.

    jschell wrote:
    Run everything in a servlet container like tomcatTomcat is a JEE container.Now I am confused. Maybe you mean Glassfish? Tomcat is definitely a web container(?).
    Let me just say that the system is the product of a student project spanning one semester, so it's important to choose the RIGHT solution (architectural-wise) That pretty much makes it impossible then.
    1. A "Right" solution is generally only proven by time.
    2. It requires a great deal of knowledge about the business domain.Yeah, you are right. Let be try to rephrase it. What solution (pattern) would be considered the most common or appropriate when you have a Java App and want to expose a few methods as a website and web service?
    I hesitate to do this because i would be putting a lot of functionality which isn't about the web into a servlet container. Also, I have a lot of application scope data that is maintained and shared by all servlets/web servicesHuh? Do you already have an exposed web service? If you already have a server which other clients communicate then where does this functionality that you don't want to be tomcat running now? Or where do you think that you want to run it? And if you are or do run it somewhere else then tomcat could access it the same way any other client accesses that server.Sorry, that sentence was written badly. I don't have anything right now. What I meant to write was that I will have a lot of application scope data, objects that are kept in memory as long as the server is running, shared by multiple servlet instances.

  • Does WL70 Web Service Support Sessions?

    Does anybody know how to make WL70 Web Service support sessions?
    The "javax.xml.rpc.session.maintain" property on Stub does not seem to work.
    Without session support, it is almost no use for us because we have to authenticate
    the user each time.
    Thanks in advance.
    - Hao

    It is just not working for me. I am using static stub.
    After tracking the HTTP traffic, I found that the WL70 server is not issuing any
    cookie. I have configured all the parameters for tracking session in the web application,
    but I still don't see any cookie in the HTTP headers from the server. I also tried
    to invoke the service using a browser, still no cookie seen. Is this a bug or
    there is some other configuration for the server?
    - Hao
    "manoj cheenath" <[email protected]> wrote:
    By default client will maintain the session. You dont have to set this
    property.
    Are you using static or dyn client?
    Also, you should use the same instance of the stub for all your invokes
    (all invokes to be in the same session).
    regards,
    -manoj
    "Hao Chen" <[email protected]> wrote in message
    news:[email protected]..
    It is not working for me.
    When I set the "javax.xml.rpc.session.maintain" property, weblogicthrows
    "UnsupportedOperation"
    exception and be default I don't see any session information beingpassed.
    How do I configure the client side or even the server?
    Thanks.
    - Hao
    "manoj cheenath" <[email protected]> wrote:
    WL70 client does support http session. Is this not
    working for you?
    regards,
    -manoj
    "Hao Chen" <[email protected]> wrote in message
    news:3d6402ac$[email protected]..
    Does anybody know how to make WL70 Web Service support sessions?
    The "javax.xml.rpc.session.maintain" property on Stub does not seemto
    work.
    Without session support, it is almost no use for us because we haveto
    authenticate
    the user each time.
    Thanks in advance.
    - Hao

  • Siebel OnDemand Web Services and BPEL II

    We are trying to do a POC for a given client that is trying to decide between SOD and another on demand CRM product.
    Our POC is to integrate SOD using bpel and sending data to a back end system with SOD as the originator and instigator of the flow.
    We intend to take data from an integration event pull it into bpel do a transformation to add data to it and update SOD to complete the circuit.
    We are having a few issues and was wondering if you can provide some insight since we would like to put SOD at this site.
    Our issues are :)
    Issue 1
    When we import the WSDL for the Integration event the scheema's are not resolved.
    Issue 2. When we import more than one WSDL in our flow it has issues with duplicates between the 2 wsdls..
    issue 3.
    We have succesfully used the example application to do our login and faked out the endpoint but have not been able to automate this step.
    We found an example online at oracle ( http://www.oracle.com/technology/tech/fmw4apps/siebel/ofm-siebel-blog-postings.html)
    (We got that link from the other BPEL post: Siebel OnDemand Web Services and BPEL
    But when we copy the code into our embeded java object it doesn't work. I think that we may be missing some of the code to use.
    Do we have the full copy of this java object?
    here is hte error that we get from bpel
    Exception reported is: Siebel_On_Demand.bpel:33: Class bpel.p0.URL not found.
    URL wsURL = new URL(wsLocation + "?command=login");
    ^
    Siebel_On_Demand.bpel:33: Class bpel.p0.URL not found.
    URL wsURL = new URL(wsLocation + "?command=login");
    ^
    Siebel_On_Demand.bpel:34: Class bpel.p0.HttpURLConnection not found.
    HttpURLConnection wsConnection = (HttpURLConnection)wsURL.openConnection();
    ^
    Siebel_On_Demand.bpel:34: Class bpel.p0.HttpURLConnection not found.
    HttpURLConnection wsConnection = (HttpURLConnection)wsURL.openConnection();
    ^
    Siebel_On_Demand.bpel:42: Class bpel.p0.HttpURLConnection not found.
    if (wsConnection.getResponseCode() == HttpURLConnection.HTTP_OK)
    ^
    Siebel_On_Demand.bpel:42: Undefined variable or class name: HttpURLConnection
    if (wsConnection.getResponseCode() == HttpURLConnection.HTTP_OK)
    We appriciate any help that cam be provided :)
    Thanks
    Message was edited by:
    user642301

    I'm also trying to do this.
    Some info from the Siebel web services guide:-
    "The login request is an HTTPS request to instantiate a session and obtain a session ID. A client invokes login by sending an HTTP GET request to a URL like the following:
    https://secure.crmondemand.com/Services/Integration?command=login
    NOTE: The login parameter value is case sensitive.
    ■ Login input. The input to login is provided in the URL parameters and the HTTP headers, as follows:
    ■ The only URL parameter to be set is command. This parameter value is login.
    Two HTTP headers, UserName and Password, must be set with the appropriate values for your system. For example:
    ❏ UserName: [email protected]
    ❏ Password: mypass
    ■ Login output. The login command returns the following items:
    ■ A session cookie, jsessionid. The client must use this cookie when submitting subsequent requests, including logoff requests.
    ■ A status code of 200, if the session does not encounter any errors. This indicates that the request succeeded.
    Then to get data out ....
    Integration request input. The jsessionid returned to the client during login must be included with the request. The request must contain the jsessionid either as a cookie or as a URL parameter, as follows:
    https://secure.crmondemand.com/Services/Integration/object;jsessionid=xyZ12489w3482413
    Does anyone have any ideas on how we might do this using the Oracle BPEL PM?
    Thanks in advance.

  • Web Services spawning sessions

    Hi All,
    I am facing a problem right now, exactly what is happening I am working in a project where we are using around 14 Web Services and they frequently interact with each other, Whenever this interation happens, a new Session is created, and if the con current users are more than say 40, there are many Live Sessions on the App Server, Now I want to know how to invalidate these Sessions, The Session Time Out setting is set to 60 minutes, thats the Business requirement. I can't lower it down. Kindly suggest from where else I can invalidate these Live Sessions as they are taking costly resources of the Server, and after 20-25 minutes the sites performance so too poor to work on.
    Thanx in Advance

    More details would help someoen narrow down this problem, what app server are you using? When you say they interact with each other, does this mean all the Web Service calls are intra-app server? What libraries are you using to run the WS interfaces and client calls?

  • Diff b/w Web service and window service

    What is the difference between web service and window service, whether the both are same or not, Give some explain about that each one and give some examples also.

    An XML Web service is a component that implements program
    logic and provides functionality for diseparate
    applications. These applications use standard protocols,
    such as HTTP, XML, and SOAP, to access the functionality.
    XML Web services use XML-based messaging to send and
    receive data, which enables heterogeneous applications to
    interoperate with each other. You can use XML Web services
    to integrate applications that are written in different
    programming languages and deployed on different platforms.
    In addition, you can deploy XML Web services within an
    intranet as well as on the Internet. While the Internet
    brings users closer to organizations, XML Web services
    allow organizations to integrate their applications.
    A Windows service starts much before any user logs in to
    the system (if it has been setup to start at boot up
    process). A Windows service can also be setup in such a way
    that it requires a user to start it manually ? the ultimate
    customization!
    Windows services run as background processes. These
    applications do not have a user interface, which makes them
    ideal for tasks that do not require any user interaction.
    You can install a Windows service on any server or computer
    that is running Windows 2000, Windows XP, or Windows NT.
    You can also specify a Windows service to run in the
    security context of a specific user account that is
    different from the logged on user account or the default
    computer account. For example, you can create a Windows
    service to monitor performance counter data and react to
    threshold values in a database.

Maybe you are looking for