invoking a web service from vast601

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

invoking a web service from vast601

Postby mariocarrera » Thu Dec 14, 2006 7:19 am

Hi all!
I want to use web services (from vast) and so I'm testing some examples to undertand how to use them.
So in the site xmethos (http://www.xmethods.net ) I find a very simple service that calculetes the exchange rate betwing 2 countries
(http://www.xmethods.net/sd/2001/Currenc ... rvice.wsdl)

Now I want to translate this in Smalltalk.
Actuali I'm using vast 6.0.1

I try this
[ | aContainer aServiceCollection aService st |
aContainer := SstWSContainer containerNamed: 'ContainerValuta'
ifNone: [ SstWSContainer createContainerNamed: 'ContainerValuta' ].
aServiceCollection := aContainer deploy:
' http://www.xmethods.net/sd/2001/Currenc ... rvice.wsdl '.

aService := aServiceCollection first.

] fork.

I know that somwhere in aServive is a method called getRate that need 2
parameters (2 strings)
but I dont'understand how to sent this method and also I dont'know the
instans tha receive this metod.
Can any body explain me

Thank you
Mario Carrera
mariocarrera
 
Posts: 17
Joined: Thu Dec 14, 2006 6:53 am

Postby tstalzer » Thu Dec 14, 2006 12:21 pm

Try this:

Code: Select all
[
   | aTimestamp aPort aContainer aServiceCollection aService aStream  result |
   aContainer := SstWSContainer containerNamed:  'ContainerValuta' ifNone: [
         SstWSContainer createContainerNamed: 'ContainerValuta'
   ].
   aServiceCollection := aContainer deploy: 'http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl'.
   aService := aServiceCollection first.
   (aService invoke: 'getRate' withArguments: #('USA' 'Germany')) inspect.
] fork.


I think, you had an extra blank in the URL

--Thomas
tstalzer
[|]
 
Posts: 65
Joined: Mon Oct 16, 2006 12:07 am
Location: Palma de Mallorca - Spain

Postby tc » Thu Dec 14, 2006 11:05 pm

Hello,

Execute this:

[
| aContainer |
SstWSContainer clearAll.
aContainer := SstWSContainer
createContainerNamed: SciSocketManager default getHostName
using: (SstWSContainerConfiguration defaultConfiguration).
aContainer startUp.
aContainer inspect
] fork


. . . wait for the inspector to pop up, then execute this:


[
| aContainer aServiceCollection|
aContainer := SstWSContainer containerNamed: SciSocketManager default
getHostName.
aServiceCollection := aContainer deploy:
'http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl'.
( aServiceCollection first getRate: 'uk' with: 'usa' ) inspect
] fork

. . . it takes a second but an inspector pops up with the exchange rate.
BTW, I am using St 7.0. The code can be combined into one but I have it separated out because I test services around the net and I like to keep that code separate.

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

Postby tc » Fri Dec 15, 2006 7:07 am

Hello,

XMethods is really slow today, so, the wbservice may not work at the moment.

--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