I implemented a J2EE web service on Sun's Application Server 8. The web
service is set up to require BASIC authentication. I created a Java client
that passes credenttials for the authentication and all went well.
I then tried to add a web reference to a client project in .NET using VB.
My code is essentially (WSRef is the name of my added web service reference):
Dim ws As New WSRef.X_WS
Dim oper As New WSRef.myOper
Dim cred As New System.Net.NetworkCredential("username", "password")
ws.Credentials = cred
Dim resp As WSRef.myMethodResponse = myWS.myOper(oper)
When the code runs it gets back the following error:
ERROR:
System.Net.WebException: The request failed with HTTP status 401:
Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)
....
The given user name and password should work and do using a Java client.
Any idea what might be causing this?
Thanks in advance.
-Rick