Getting 403: error attempting to access a webservice

J

JerryK

Hi,

I have an app that needs to access a java webservice to validate a piece of
data. This webservice is found on a server that requires a SSL certificate
to authorize use.

I created a webreference with the provided WSDL file. However, when I call
the function I get a 403: Forbidden error when called in an ASP.net page.
The code that calls the service is shown below and does not generate the
error when I called from a C# or VB winforms app.

PublicFunction MemValidate( num as string) as boolean

dim ValService as new webserv.ValService

System.Net.ServicePointManager.CertificatePolicy = new NetPolicy
ValService.ClientCertificates.Add(X509Certificate.CreatefromCertFile("c:\root.cer"))
ValService.ClientCertificates.Add(X509Certificate.CreatefromCertFile("c:\int.cer"))
ValService.ClientCertificates.Add(X509Certificate.CreatefromCertFile("c:\client.cer"))

return ValService.Validate( num ) ' exception occurs here

End function

Public Class NetPolicy
implements ICertificatePolicy

public shared DefaultValidation as boolean = false

public function CheckValidationResult (...) as boolean

return true

end function

End class

Without adding the client certificates I generated the 403:forbidden error
even from the Winforms clients. I am run with the impersination set to me
and my account has admininistrator privledges on the system.

Any thoughts?

Thanks,

Jerry
 
G

giri

Hi Jerry

I have a java webservice and i need to access it in C#. when i selected the wsdl path in "add web reference" option. The methods are displayed but i am not able to "add reference" button is not enabled.i am getting the following error

The HTML document does not contain Web service discovery information.

Can you please tell me how you accessed java webservice wsdl. Is any modification has to be done in wsdl to access in C#.
 
J

JerryK

giri,

In my case they sent me the .WSDL file in a separate email message. I then
put this .WSDL in project directory and created the reference from there.
However, I believe the message means the WSDL file you have is incomplete.
I believe that is a DiscoveryExceptionDictionary message. You might try
looking that up in MSDN. My guess is that the URI to the web service how
messed up. How does it look if you open up the WSDL file in IE?

Sorry I am not of more help.
 
J

JerryK

Anyone have any ideas?

The code works everywhere (services, etc) except a ASP.net page. This is
getting very frustrating.
 
D

Deepak

Hi
You have to give the user asp.net permission to the certificate.
This can be done by either using winhttpcertcfg tool or navigate to the
following folder
C:\Document and Settings\Allusers\microsoft\crypto\RSA\machinekeys and
locate the key and give user aspnet full access to it.
You can locate the key using datetime stamp.
Let me know if this does not work
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top