Consuming a secure webservice using x509 cert (p12)

C

charlief1975

This code works in a WinForm app. Can't get it to work in an asp.net app. I
don't have control over the service. Don't know what language it is...just
what it exposes.

I have a class. This class contains all my functions to work with the
service. In the new section for the class I have the following:
Public Sub New()

Dim Store As X509CertificateStore =
X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore)

Dim MatchingCertificates As X509CertificateCollection

Try
If Not Store.OpenRead() Then
Throw New Exception("Unable to open local machine
certificate store")
End If

'try to find our certificate

MatchingCertificates =
Store.FindCertificateBySubjectString("AllInternetNow 1-allinternetnow")

If (MatchingCertificates.Count = 0) Then
Throw New Exception("Unable to locate certificate in the
local machine store")
End If

Service = New ServiceGatewayService

'* configure the service URL
Service.Url = WEBSERVICE_URL

'* add the certificate for identification
Service.ClientCertificates.Add(MatchingCertificates(0))

Finally
Store.Dispose()
End Try

End Sub


The new section loads the cert from the maching keystore. Seems to
work...looks like is added to the service object.

Then I call a function with this code:

Dim req As New comsbciotlinequalLineQualRequest
Dim rsp As New comsbciotlinequalLineQualResponse

With req
.clientID = USERNAME
.clientPassword = PASSWORD
.workingTN = phoneNumber
.requestType = "1"
.appVersion = "1"
'.promo = PROMOCODE
End With

rsp = Service.processLineQual(req)


Return rsp

Service.processline never returns anything. I checked with the service
provider and in their log they see a 403 error. I got 403 errors before and
it was a certificate problem on my side. As I said before, it works in a
winform app, so cert is correctly installed.

I have tried impersonation, but open to anything. Any info would be great.

Thanks
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top