axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Drew Haller <DHal...@Grandcentral.com>
Subject RE: .Net Client for Axis Service
Date Wed, 12 Jun 2002 22:17:11 GMT
In Beta 1 something like this worked.  You have to throw the right code in
the AxisFault to get the 401.  This changed from Beta 1 so I'm not sure how
you do it yet but here is some code that will force the challenge:
 
.....
 
 MessageContext mc = MessageContext.getCurrentContext();
 if ( !myAuthenicateMethod ( mc.getUsername(), mc.getPassword() ) )
 {
      // add authentication challenge to response
      HttpServletResponse res = (HttpServletResponse)
                    mc.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
      res.setHeader("WWW-Authenticate", "Basic realm=\"mydomain.com\"");
      
      throw new AxisFault(......);
}
 
.....
 
 
-----Original Message-----
From: thomas.cherel@ascentialsoftware.com
[mailto:thomas.cherel@ascentialsoftware.com] 
Sent: Wednesday, June 12, 2002 3:06 PM
To: axis-user@xml.apache.org
Subject: RE: .Net Client for Axis Service



You can also try to confirm what I experienced if you do not do something
like service.PreAuthenticate = true.
Without doing the PreAuthenticate, every request from the client will first
do a request without the auth header, get a 401 and then send the request
again with the auth information. With PreAuthenticate=true, it seems that it
is doing that only for the first request sent, and after it "remembers" that
auth headers are required and it will send them directly for each subsequent
request.
At least this is the behavior that I observed, which can definitely create a
performance problem.
 
Thomas

-----Original Message-----
From: Jones, Rhys [mailto:RhysJones@SierraSystems.com]
Sent: Wednesday, June 12, 2002 10:31 AM
To: 'axis-user@xml.apache.org'
Subject: RE: .Net Client for Axis Service



Hi all, 

I have got the servlet solution to work :-).  I made a servlet that checks
if there is any auth information in the request.  If there is not it
responds with a 401 and the WWW-Authenticate header.  If there is auth
information, it forwards the response to the axis servlet.  I made this
servlet the service endpoint for the MS clients and it works great.

I tried this solution yesterday and it didn't work, but when I checked it I
had WWW_Authenticate instead of WWW-Authenticate as the header (oops).

As was discussed before the MS client sends the auth information only after
it gets the WWW-Authenticate header. 

Also it seems that you do not have to use the Credential cache it works for
me simply with this code: 

                ResourceServices service = new ResourceServices(); 
                
                NetworkCredential myCred = new
NetworkCredential("user","pass"); 
                                
                service.Credentials = myCred;   
                
                Result.Text = service.getUserResources(email,period); 

Hope this helps... 

Thanks, 

RJ 

>List:     axis-user 
>Subject:  RE: .Net Client for Axis Service 
>From:     Drew Haller <DHaller@Grandcentral.com> 
>Date:     2002-06-12 0:26:04 
> 
> 
>In .net when you set the credentials of your proxy, the client first sends 
>the request with out the auth header and will retry if challenged.  The 
>server needs to respond with a 401.  I believe you can do that by throwing 
>an AxisFault. 
> 
> 
>-----Original Message----- 
>From: Jones, Rhys [mailto:RhysJones@SierraSystems.com
<mailto:RhysJones@SierraSystems.com> ] 
>Sent: Tuesday, June 11, 2002 1:40 PM 
>To: 'axis-user@xml.apache.org' 
>Subject: RE: .Net Client for Axis Service 
> 
> 
> 
>Thanks Vidyanand, 
> 
>I can't get the method of sending the WWW-Authenticate header back to the 
>client to work.  I am curious of how you changed the GetWebRequest() method

>to send the correct headers.  It does seem like the hard way to do it, but 
>it sounds like the only way that works so far. 
> 
>I posted a message to an MS forum to see if they had any answers as to why 
>the .Net client won't send the auth headers.  I'll let you know if anything

>comes out of it. 
> 
>Thanks for your help, 
> 
>RJ 
> 
>List:     axis-user 
>Subject:  RE: .Net Client for Axis Service 
>From:     "Vidyanand Murunikkara" <Vidyanand@infravio.com> 
>Date:     2002-06-11 19:40:11 
> 
>Hi Rhys 
> 
>check this out http://marc.theaimsgroup.com/?l=axis-user
<http://marc.theaimsgroup.com/?l=axis-user>  
<http://marc.theaimsgroup.com/?l=axis-user
<http://marc.theaimsgroup.com/?l=axis-user> >  
><http://marc.theaimsgroup.com/?l=axis-user
<http://marc.theaimsgroup.com/?l=axis-user>  
<http://marc.theaimsgroup.com/?l=axis-user
<http://marc.theaimsgroup.com/?l=axis-user&m=102224516027914&w=2>
&m=102224516027914&w=2> 
&m=102224516027914&w=2> 
>&m=102224516027914&w=2  . Similar problem But there is no good solution 
>to it. 
> 
>But there is one way you can make it send the required headers. But it 
>involves changing the Client code quite a bit. Let me know if you want 
>such a solution. And I am not sure whether it will break other stuff in 
>.net. 
> 
>Vidyanand 
> 
>-----Original Message----- 
>From: Jones, Rhys [mailto:RhysJones@SierraSystems.com
<mailto:RhysJones@SierraSystems.com>  
<mailto:RhysJones@SierraSystems.com <mailto:RhysJones@SierraSystems.com> > ]

>Sent: Tuesday, June 11, 2002 9:35 AM 
>To: 'axis-user@xml.apache.org' 
>Subject: .Net Client for Axis Service 
> 
> 
> 
>Hi, 
> 
>I'm sorry if this is off topic, but here I go..... 
> 
>I am trying to get a .Net client to talk to an existing Axis service 
>which works with java clients.  Right now access to the service is 
>controlled using a handler that checks basic authentication.  At first I 
>used the following C# client code to access the service: 
> 
>               ResourceServices service = new ResourceServices(); 
>               service.PreAuthenticate = true; 
> 
>               NetworkCredential myCred = new 
>NetworkCredential("user","pass"); 
>                CredentialCache myCache = new CredentialCache(); 
>  
>                myCache.Add(new Uri(service.Url), "Basic", myCred); 
>                        
>                service.Credentials = myCache; 
>                Result.Text = service.getUserResources(email,period); 
> 
>With this code the handler throws an AxisFault since it is not getting 
>any auth information in the header.  The "PreAuthenticate" seems to do 
>nothing.  I read some earlier posts which indicated that if I got the 
>handler to return a "401" that the .net client would then send the auth 
>header. 
> 
>I then made a servlet that checks if there is any auth info in the 
>header and which forwards the request to the Axis servlet if there was 
>or returned a 401 response if there wasn't.  Again no luck.  The .net 
>client just threw an error that a 401 was returned. 
> 
>If anyone could help me out with this it would be much appreciated! 
> 
>Again, sorry if it is off topic. 
> 
>Thanks! 
> 
>RJ 


Mime
View raw message