By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

VB.NET Client accessing Webservice at JavaServerHost

P: n/a
Hi folks

This is a challenging and interesting topic. Need HELP on
this, would be good if some tips/techniques can be given
for the topic.

Using VB.NET client to connect to JavaWebserver. Don't
know how to use the 2-way SSL to communicate and make the
SSL handshake process( at Transport level https://)
transparent. Any .NET classes to make all the 2-way SSL
communication transparent between VB.Client(Webservice
consumer) and JavaWebserver(Webservice provider)???

My VB.NET Client is able to access the web service with
HTTP protocol BUT NOT HTTPS protocol(SSL port 443)

Where to add in the clientcert(X509) into the http object
request object ? And how to get the HTTP Response back to
parse in the XML details? Any .NET classes to do all these
with ease?

Some advice or technical samples please?

Thanks in advance.!!!

This is the code snippet of what we are trying to do.
Would be great to get advise or technical solutions to
help me out.

-------------- Begin of Code
Dim Store As X509CertificateStore
Dim cert As X509Certificate
Dim lCertName As String
Dim certoken As
Microsoft.Web.Services2.Security.Tokens.X509Securi tyToken
Dim objInBW As New WebServiceWSDLLink.InboundWS
' Open and read the certificate store for
' the local machine account.

Store = X509CertificateStore.CurrentUserStore
(X509CertificateStore.MyStore)
Store.OpenRead()
' Search for all certificates and add all
' matching certificates to the certificate
collection.
Dim x As Integer = 0
For Each cert In Store.Certificates

If InStr(cert.GetName(), "UserA") Then
MsgBox("Issued To= {0}" & cert.GetName())
x = 1
Exit For
End If

Next
If x = 0 Then
MsgBox("Service is not able to encrypt the
response")
End If
objInBW.ClientCertificates.Add(cert)

objInBW.UnsafeAuthenticatedConnectionSharing = True

Dim xcertoken As New X509SecurityToken(cert)
''create a new Signature object using the
X509SecurityToken
''as a parameter for the Signature constructor
Dim signature1 As New MessageSignature(xcertoken)
''Along with the Tokens collection there is a
SoapContext.Security.Elements
''collection that will allow you to add various WS-
Security elements including
''a Signature element.
objInBW.RequestSoapContext.Security.Tokens.Add
(xcertoken)

objInBW.RequestSoapContext.Security.Elements.Add
(signature1)
'we pull the certificate from the certificate
store
'and add it to the Tokens collection. We then and
add the Signature object
'to the Elements collection.

'Finally we are calling the webservice object like
the 'following :

objretmsg = objInBW.processSingleMessage(objMsg)

------------- end of code------------------------------

Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Paul,

Did you know that there is a small however active newsgroup
Microsoft.public.dotnet.framework.webservices

I advice you to ask this question as well there.

Cor

Hi folks

This is a challenging and interesting topic. Need HELP on
this, would be good if some tips/techniques can be given
for the topic.

Using VB.NET client to connect to JavaWebserver. Don't
know how to use the 2-way SSL to communicate and make the
SSL handshake process( at Transport level https://)
transparent. Any .NET classes to make all the 2-way SSL
communication transparent between VB.Client(Webservice
consumer) and JavaWebserver(Webservice provider)???

My VB.NET Client is able to access the web service with
HTTP protocol BUT NOT HTTPS protocol(SSL port 443)

Where to add in the clientcert(X509) into the http object
request object ? And how to get the HTTP Response back to
parse in the XML details? Any .NET classes to do all these
with ease?

Some advice or technical samples please?

Thanks in advance.!!!

This is the code snippet of what we are trying to do.
Would be great to get advise or technical solutions to
help me out.

-------------- Begin of Code
Dim Store As X509CertificateStore
Dim cert As X509Certificate
Dim lCertName As String
Dim certoken As
Microsoft.Web.Services2.Security.Tokens.X509Securi tyToken
Dim objInBW As New WebServiceWSDLLink.InboundWS
' Open and read the certificate store for
' the local machine account.

Store = X509CertificateStore.CurrentUserStore
(X509CertificateStore.MyStore)
Store.OpenRead()
' Search for all certificates and add all
' matching certificates to the certificate
collection.
Dim x As Integer = 0
For Each cert In Store.Certificates

If InStr(cert.GetName(), "UserA") Then
MsgBox("Issued To= {0}" & cert.GetName())
x = 1
Exit For
End If

Next
If x = 0 Then
MsgBox("Service is not able to encrypt the
response")
End If
objInBW.ClientCertificates.Add(cert)

objInBW.UnsafeAuthenticatedConnectionSharing = True

Dim xcertoken As New X509SecurityToken(cert)
''create a new Signature object using the
X509SecurityToken
''as a parameter for the Signature constructor
Dim signature1 As New MessageSignature(xcertoken)
''Along with the Tokens collection there is a
SoapContext.Security.Elements
''collection that will allow you to add various WS-
Security elements including
''a Signature element.
objInBW.RequestSoapContext.Security.Tokens.Add
(xcertoken)

objInBW.RequestSoapContext.Security.Elements.Add
(signature1)
'we pull the certificate from the certificate
store
'and add it to the Tokens collection. We then and
add the Signature object
'to the Elements collection.

'Finally we are calling the webservice object like
the 'following :

objretmsg = objInBW.processSingleMessage(objMsg)

------------- end of code------------------------------

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.