help with Web services client using SSL

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

help with Web services client using SSL

Postby DArnold » Wed May 16, 2007 10:00 am

I am trying to implement a web service client using SSL, following Bryan Hogan's old instructions at
http://groups.yahoo.com/group/vastws/message/326.
However, his email only addressed a server implementation

According to the readme, I will also have to implement something like:
config := SciSslSocketConfiguration new
sslVersion: SciSslConstants::SSLv3;
verify: SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
verifyDepth: 1;
caFile: 'certs/vast_ca.pem';
yourself.

1. Where do I tell a given web services client to use the a SSL client certificate?

2. Our application also currently implements a http servlet using SSL;
we registered the server certificates in the 'https' SstTransport configuration.
The web services client will use a different certificate. I believe by default web services also uses the 'https' transport
when the WSDL identifies https in the <soap:address location.
How do I prevent this conflict? I am assuming the solution might be to create a new transport configuration,
if so how do I configure a given web service to use the new transport configuration.

3. And finally, the web services code is very difficult to debug or step through. For the above questions I would normally
put in some breakpoints and step through the code to answer my questions. That does not work with the web services code.
Is there a magic setting somewhere that would permit easier debugging? Or any other tips?

Thanks
Dave
DArnold
 
Posts: 6
Joined: Wed Mar 28, 2007 5:36 am

Postby tc » Sat May 19, 2007 4:14 pm

The programmer's reference has a complete SSL client/server example with certificates. Here is the client workspace:
Code: Select all
SSL Client Workspace

[ | config rv anSciSocketAddress secureSocket  msg |

config := SciSslSocketConfiguration new
          certificateFilename: '<dir>/cert.pem';
          privateKeyFilename: '<dir>/key.pem';
          sslVersion: SciSslConstants::SSLv23;
          yourself.

anSciSocketAddress :=
          (SciSocketAddress fromString: '127.0.0.1') "Address of server machine"
                        family: SciSocketConstants::AFINET;
                        port: 2222.
secureSocket := SciSslSocket newStreamSocket.

(rv := secureSocket connect: anSciSocketAddress) isSciError ifTrue:
                        [ secureSocket close. self halt ].

(rv := secureSocket sslInitialize: config) isSslError
   ifTrue: [ secureSocket close. self halt ].
(rv := secureSocket sslConnect) isSslError
   ifTrue: [ secureSocket close. self halt ].

secureSocket sslVerifyCertificate.

(rv := secureSocket send: 'Hello World!' abrAsPSZ length: 12 startingAt: 1 flags: 0) isSslError ifTrue: [ self halt ].

msg := ByteArray new: 4096.
(rv := secureSocket recv: msg length: 4096 startingAt: 1 flags: 0) isSslError ifTrue: [ self halt ].
Transcript cr; nextPutAll: 'SslClient Got -> ', msg asString trimNull, ' <-  '.
secureSocket close. ] fork.


--tc
tc
Moderator
 
Posts: 304
Joined: Tue Oct 17, 2006 7:40 am
Location: Raleigh, NC


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest