Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 372929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:15:30+00:00 2026-05-12T14:15:30+00:00

I am very new to web service stuff so please be kind. I have

  • 0

I am very new to web service stuff so please be kind.

I have written a simple POJO class, and deployed it on an axis2 server:

public class Database {

    private Project project;

    public void login(){
        project = new Project();
        project.setDescription("Hello there");
        project.setName("To me");
    }

    public Project getProject(){
        return project;
    }

}

I call the service from a c# client:

localhost.Database db = new WindowsFormsApplication1.localhost.Database();
db.login();

localhost.getProjectResponse pr = new WindowsFormsApplication1.localhost.getProjectResponse();

pr = db.getProject();

When I debug the response is null.
At the java end, when I call getProject, the project object is null.

What’s happening?
How do I preserve the state of project between service calls?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:15:31+00:00Added an answer on May 12, 2026 at 2:15 pm

    For most toolkits, web services are stateless by default. I think axis is no different.

    If you want to maintain state between calls then you will need to enable sessions. An example on how to maintain sessions in axis can be found at:

    http://kickjava.com/src/test/session/TestSimpleSession.java.htm

    On the .NET side you will need to assign a CookieContainer to your request to store the session identifier. See HOW TO: Use CookieContainer to Maintain a State in Web Services for more information.

    I think your code would look something like this:

    localhost.Database db = new WindowsFormsApplication1.localhost.Database();
    // Assign the CookieContainer to the proxy class.  
    db.CookieContainer = new System.Net.CookieContainer();
    
    db.login();
    
    localhost.getProjectResponse pr = new WindowsFormsApplication1.localhost.getProjectResponse();
    pr.CookieContainer = db.CookieContainer;
    
    pr = db.getProject();
    

    I think that should let you do what you want — but I wouldn’t recommend it.

    Designing service interfaces is a bit different than designing object oriented interfaces. Service interfaces typically eschew the use of state and instead require the consumer to provide all of the relevant information in the request.

    From Service-Oriented Architecture:

    Services should be independent,
    self-contained requests, which do not
    require information or state from one
    request to another when implemented.

    I would definitely recommend reading that article and perhaps revisiting your design.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an idea for a web service, but am very new to web
I am very new to Java. There is a Model Server web service, now
I'm very new to Web server matters, and relatively a naive student of C++.
I'm very new to Android & WCF web service. I fail to send two
Am very new on WSDL (SOAP) web service on GAE python, i read some
I am very new to the world of web services so please bear with
In developing a new web service I haven't been able to find very much
I have a simple Web App that receives data via a web service and
I am very new to creating WCF web service. I want to create a
I am very new to C#, I am trying to do some web service

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.