Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

VisualWorks SOAP client -- How to obtain a session ID?
My question is:

VisualWorks SOAP client -- How to obtain a session ID?

I am using the VisualWorks SOAP client to converse with a web service
that requires the session ID as one of the arguments for the web
service call. I have been able to successfully execute a conversation
by swiping a non-terminated session ID from a Perl SOAP::Lite client,
but can't figure out where/how to obtain the session ID for the
VisualWorks SOAP client.

Here is the code:


--------  Smalltalk code starts here -----------

| wsdlClient soapRequest sessionID |
wsdlClient := WsdlClient new loadFrom:
'http://imac.local:8080/exist/services/Query?WSDL' asURI.
wsdlClient  transportClient loginToHost: 'myHost' port: 8080 asUser:
'myUserID' withPassword: 'myPassword' .
soapRequest := SoapRequest new.
soapRequest port: wsdlClient config anyPort.

"This is a session ID swiped from a Perl SOAP::Lite client session:"
sessionID := '9103440'.

"The sessionID is a required argument for the web service call:"
soapRequest smalltalkEntity:
(Message selector: #getResourceData arguments: #(sessionID
'/db/shakespeare/plays/hamlet.xml' true false false) ).
soapRequest value

--------  Smalltalk code ends here -----------

And here is the equivalent Perl SOAP client code:

--------  Perl code starts here -----------
#!/usr/bin/perl -w

use SOAP::Lite;

die "Usage: $0 collection document\n" unless @ARGV == 2;

my $collection = $ARGV[0];
my $doc = $ARGV[1];

my $service =

SOAP::Lite->service("http://myHost:8080/exist/services/Query?WSDL");
$service->on_fault(sub { my($soap, $res) = @_;
die ref $res ? $res->faultdetail : $soap->transport->status, "\n";
});

print "Connecting ...\n";

# The Perl connect method returns a session ID string:

my $session = $service->connect("guest", "guest");

print "$session\n";  # <--- got my session ID from here

print "Collection contents for $collection:\n";
my $resp = $service->listCollection($session, $collection);
my @resources = @{$resp->{'resources'}};
foreach $r (@resources) {
print "\t$r\n";
}

$doc = "$collection/$doc";
print "\nRetrieving document $doc ...\n\n";

$resp = $service->getResourceData($session, $doc, TRUE, FALSE, FALSE);
print "$resp\n\n";

#$service->disconnect($session);

--------  Perl code ends here -----------


Suggestions on how to obtain a session ID for a VisualWorks SOAP client
would be appreciated!

Thanks,

Pat Podenski


Report this thread to moderator Post Follow-up to this message
Old Post
stug23
01-02-05 08:56 AM


Re: VisualWorks SOAP client -- How to obtain a session ID?
As usual after thinking it over, I figured it out. Here is how to get
the sessionID for the eXist SOAP query:

| wsdlClient soapRequest  session args |
wsdlClient := WsdlClient new loadFrom:
'http://localhost:8080/exist/services/Query?WSDL' asURI.

soapRequest := SoapRequest new.
soapRequest port: wsdlClient config anyPort.
soapRequest smalltalkEntity: (Message selector: #connect arguments: #(
'userID' 'password' ) ).

session := soapRequest value.
args := OrderedCollection new.
args add: session.
args addAll: #( '/db/shakespeare/plays/hamlet.xml' true false false )
asOrderedCollection.

soapRequest smalltalkEntity:
(Message selector: #getResourceData arguments: args asArray ).
soapRequest value.
soapRequest smalltalkEntity:
(Message selector: #disconnect).


Report this thread to moderator Post Follow-up to this message
Old Post
stug23
01-04-05 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Smalltalk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:38 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.