Axis 1.2/1.3 interop .NET-CookieContainer problem.

Discussion in 'ASP .Net Web Services' started by VEJIKYUULYCY@spammotel.com, Dec 5, 2005.

  1. Guest

    Hi all,

    I'm trying to get a .Net client (C# console app) maintain
    a session with a Java-based web service (Axis), but it doesn't seem
    to work. (Of course, a Java client to the same service works fine)

    My C# code looks like this:

    > TestSvcService ts = new TestSvcService();
    > ts.CookieContainer = new CookieContainer();
    > ts.doThis();
    > ts.doThat();
    > ...


    Each call to the service results in a fresh, empty session,
    instead of maintaining the initial one.

    I'm watching the message exchange with a TCP monitor, and the
    only clue I can come up with is that .Net expects a different
    cookie name from the one set by the Java server; the initial
    HTTP response contains the following set-cookie instruction:

    > Set-Cookie: jsessionid=3029091017259021561;path=/


    But in the next request, .Net doesn't send any cookie at all.

    I searched the whole web and google and found that this problem is
    described a few times without any idea how to solve it. So is someone
    already fixed it, please send a reply!

    Thanks a lot,
    -- Carsten
     
    , Dec 5, 2005
    #1
    1. Advertising

  2. DC Guest

    I just tried this and it works for me, as advertised.

    used on server side:
    AXIS 1.3
    Sun JDK 1.5

    used on client side:
    ..NET SDK 1.1

    If you follow the guidance of designing your service "WSDL First", then you
    run WSDL2Java to build your AXIS-based service. On the WSDL2Java command
    line you need to specify "--deployScope Session" in order to generate the
    proper instructions in the deploy.wsdd file. Did you do that?

    If you are not following the "WSDL First" guidance, then do you have an
    element like this:
    <parameter name="scope" value="Session"/>

    in the deploy.wsdd, for the service in question?

    One way to troubleshoot this is to insert an http proxy in between the
    client and server. you can do this with a tool like proxytrace[1], for
    example. then on the instance of the ws proxy class in the client (your
    TestSvcService), you set the Proxy property:

    #if USE_PROXY
    System.Net.IWebProxy proxyObject = new
    System.Net.WebProxy("http://localhost:3128",false); // true == bypass proxy
    for local addresses
    ts.Proxy= proxyObject;
    #endif

    If you want to see the traffic show up in the proxytrace tool, be sure that
    the Url property on your ws proxy is set to use a non-loopback ip address.
    Maybe you checked this?

    How are you verifying that the .NET client is not sending the cookie?

    -Dino

    --
    -Dino
    D i n o . C h i e s a AT M i c r o s o f t . c o m

    [1] http://www.pocketsoap.com/tcptrace/pt.aspx

    <> wrote in message
    news:...
    > Hi all,
    >
    > I'm trying to get a .Net client (C# console app) maintain
    > a session with a Java-based web service (Axis), but it doesn't seem
    > to work. (Of course, a Java client to the same service works fine)
    >
    > My C# code looks like this:
    >
    >> TestSvcService ts = new TestSvcService();
    >> ts.CookieContainer = new CookieContainer();
    >> ts.doThis();
    >> ts.doThat();
    >> ...

    >
    > Each call to the service results in a fresh, empty session,
    > instead of maintaining the initial one.
    >
    > I'm watching the message exchange with a TCP monitor, and the
    > only clue I can come up with is that .Net expects a different
    > cookie name from the one set by the Java server; the initial
    > HTTP response contains the following set-cookie instruction:
    >
    >> Set-Cookie: jsessionid=3029091017259021561;path=/

    >
    > But in the next request, .Net doesn't send any cookie at all.
    >
    > I searched the whole web and google and found that this problem is
    > described a few times without any idea how to solve it. So is someone
    > already fixed it, please send a reply!
    >
    > Thanks a lot,
    > -- Carsten
    >
     
    DC, Dec 13, 2005
    #2
    1. Advertising

  3. Guest

    Hi.

    Thank you for the answer.

    I tried and tried and did not get it to work. But then I switched to
    the RPC-provider and then the cookie magically worked.

    So the problem seems to be caused by the provider="java:EJB". If I use
    a standard java bean with the rpc provider="java:RPC", the problem
    disappears....

    Best regards
    Carsten
     
    , Dec 21, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Kuba

    CookieContainer with WebClient

    Martin Kuba, Aug 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    642
    Martin Kuba
    Aug 5, 2003
  2. Martin Madreza
    Replies:
    0
    Views:
    1,197
    Martin Madreza
    Nov 17, 2003
  3. Replies:
    0
    Views:
    952
  4. Arne Garvander

    Cookiecontainer problem with HTTPS

    Arne Garvander, Dec 26, 2007, in forum: ASP .Net Security
    Replies:
    0
    Views:
    148
    Arne Garvander
    Dec 26, 2007
  5. RT
    Replies:
    0
    Views:
    167
Loading...

Share This Page