Web Services Example

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

Web Services Example

Postby vincid » Sun Sep 07, 2008 12:07 pm

Hi,

Somehow I seem to have trouble getting the Web Services Example from
http://www2.instantiations.com/VAST/Docs/ws/websrvctfrm.htm
to work.
Most likely because I don't know where the hosts file should be located:
The examples in this guide specify URL resources using a host name of 'vasthost'. You must add a line to your 'hosts' file, or use any hostname valid for your environment in place of 'vasthost', in order to successfully execute the described examples.


I loaded the Config map 'z.St: Server, Web Services V 7.5.2 [99]'.
Debugging the example, the problem seems to be caused by
Code: Select all
SstRemoteEndpoint fromUrl: 'http://www.capescience.com' sstAsUrl

Which produces "SstInvalidAddressError(ENOADDRESS (11004): No address or No Data)" although this service is available (http://www.capescience.com/AirportWeather.wsdl). Since this method is from 1998 and has a comment stating "Object sstToBeFixed" I could imagine the wrong protocol being used...

Did anybody get this example to work? Hints would be appreciated!

Regards, Vincent

P.S. The complete code:
Code: Select all
|server|
server := SstHttpServerExample
  runAt: 'http://:9999'
  in: (AbtXmlConfiguration current defaultResourceQualifier).

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

"SstWSContainer clearAll."
[ | aContainer aServiceCollection|
  aContainer := SstWSContainer containerNamed: SciSocketManager default getHostName.
  aServiceCollection := aContainer
    deploy: 'http://www.capescience.com/AirportWeather.wsdl'.
  ( aServiceCollection first getSummary: 'NZCM' ) inspect] fork.
vincid
 
Posts: 7
Joined: Sun May 18, 2008 11:23 pm
Location: Bern, Switzerland

Re: Web Services Example

Postby marten » Sun Sep 07, 2008 10:15 pm

vincid wrote:Hi,

Somehow I seem to have trouble getting the Web Services Example from
http://www2.instantiations.com/VAST/Docs/ws/websrvctfrm.htm
to work.
Most likely because I don't know where the hosts file should be located:
The examples in this guide specify URL resources using a host name of 'vasthost'. You must add a line to your 'hosts' file, or use any hostname valid for your environment in place of 'vasthost', in order to successfully execute the described examples.



The "hosts" file is a standard configuration file under tcp/ip. It's used to resolve computer names. When doing "ip-name resolution" tcp/ip first uses the entries in the "hosts" file and after that (if not found) it may query the domain name server. Under Unix you may look at "/etc/hosts" and under Windows you may look at "C:\Windows\System32\drivers\etc\hosts".
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Web Services Example

Postby marten » Sun Sep 07, 2008 10:41 pm

vincid wrote:I loaded the Config map 'z.St: Server, Web Services V 7.5.2 [99]'.
Debugging the example, the problem seems to be caused by
Code: Select all
SstRemoteEndpoint fromUrl: 'http://www.capescience.com' sstAsUrl

Which produces "SstInvalidAddressError(ENOADDRESS (11004): No address or No Data)" although this service is available (http://www.capescience.com/AirportWeather.wsdl). Since this method is from 1998 and has a comment stating "Object sstToBeFixed" I could imagine the wrong protocol being used...

Did anybody get this example to work? Hints would be appreciated!


This is just a fast answer. For me - and I'm not an expert on this topic - it seems, that the web service you wanted to use has been moved to another site. When executing this example you - somewhere deep below - get an error message, telling one, that the site has been moved permanently to : "http://developer.capeclear.com/files/GlobalWeather.wsdl". More or less it seems, that this error information gets lost in the framework, which is pretty sad.

Using the new address you another error message, which seems to indicate, that the used method getSummary: is NOT known at the WebService you called.
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Web Services Example

Postby Diane Engles » Mon Sep 08, 2008 10:14 am

I hope you are making progress with the example.

When I executed your code in a workspace, I got a deployment error due to the fact that the resource could not be found rather than an invalid address message. This is more in line with Marten's results and he is correct in pointing out the source of the error message.

I certainly think the error message should report the page moved response, and I have opened an internal case to address it for Version 8.0: Number 37101.

I have been able to get the example working to the point of deserializing into a SoapMappedElement, which is as far as VA Smalltalk can go without classes so that it can instantiate the objects. The new wsdl does contain a getSummary message, so I used another:

Code: Select all
aServiceCollection := aContainer
        deploy: 'http://developer.capeclear.com/files/GlobalWeather.wsdl'.
      ( aServiceCollection first listCountries: nil) inspect] fork.

When you are working with deploying wsdl and invoking a remote service as a client, you do not need to have a server running. The Insurance Example functions as both the client and server. The vasthost entry and running HttpServer are necessary for that full example.

You can just deploy the client wsdl into a container as you have done, and the framework will create an endpoint and send the message.

The readme file in the doc_literal directory of the insurance example has some useful information as well as the readme for Version 7.5.2.

A couple of breakpoints you might find useful:

You can see the http message that is sent out and the response by setting a breakpoint in SstHttpClient>>post:typed:at:using:withHeaders:. In this method you can inspect the http message that is sent out and the http message that is received including header information.

In your case, this would have been useful since the error was occurring on deployment during the attempt to retrieve the wsdl from the website.

Once the service is successfully deployed, another useful place to set a breakpoint is in SstWSHttpDispatchHandler>>invoke:.

In this method you can highlight and inspect "self contentsFrom: aMessageContext" to see the SOAP envelope that will be sent out. You can modify it in the inspector before it is sent to test a change.

You can then step through and inspect the response to the message.
Instantiations Smalltalk Support
diane@instantiations.com
Diane Engles
Moderator
 
Posts: 66
Joined: Mon Oct 16, 2006 2:40 pm

Re: Web Services Example

Postby marten » Mon Sep 08, 2008 11:10 am

Diane Engles wrote:The new wsdl does contain a getSummary message, so I used another:.


... does not contain ... ????

Marten
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Web Services Example

Postby Diane Engles » Mon Sep 08, 2008 11:17 am

Sorry for the typo -- the new wsdl does not contain a getSummary message.


Diane
Instantiations Smalltalk Support
diane@instantiations.com
Diane Engles
Moderator
 
Posts: 66
Joined: Mon Oct 16, 2006 2:40 pm

Re: Web Services Example

Postby vincid » Tue Sep 09, 2008 2:51 am

Hi Diane & Marten,

Thanks for the tips!

Meanwhile we found the problem: Though our company proxy settings allow us to view the websites mentioned and even fetch the wsdl, we're not allowed to connect to it in the manner needed. Connecting directly over tcp yields no result.
For every 'open' address your example works perfectly. Since our applications run in the company network, this problem should not occur.

So, we were just confounded by seeing the wsdl coming up in the browser but not being able to connect to the server...

Thanks for your prompt answers -

Vincent
vincid
 
Posts: 7
Joined: Sun May 18, 2008 11:23 pm
Location: Bern, Switzerland

Re: Web Services Example

Postby tc » Tue Sep 09, 2008 12:44 pm

Hello,

Actually, the original address used does work. The way to test a web service is to go to

http://www.soapclient.com/soaptest.html

. . . and type in the address of the service. The web page will list all the functiions available and what parameters are required.

I did notice the service is not working. There is a function 'listCountries' but it returned an error as did the other functions.

I'd recommend trying again but choosing a web service from xmethods.net, testing it on the soapclient.com web page, then trying it from ST.

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

Re: Web Services Example

Postby marten » Wed Sep 10, 2008 6:03 am

tc wrote:Actually, the original address used does work.


The original address is valid - yes - but only because the answering WWW-server is answering a redirecting http-answer (I do not know the correct technical name) to the page I mentioned in an earlier posting. The VASmalltalk-WebService framework is not able to handle the redirecting http-answer and therefore fails. More or less it makes more clear, that the framework must handle a redirection internally and NOT cause an error.
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: Web Services Example

Postby tc » Wed Sep 10, 2008 5:03 pm

The VASmalltalk-WebService framework is not able to handle the redirecting http-answer and therefore fails.


As you know, a good test case needs to be developed to investigate these situations. If sopaclient.com is not able to use any functions with that web service then I would say a new one needs to be found before knowing if the above is true.

I have never had any web service fail with soapclient.com unless the web service itself is down, which is often the case.


--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: Yahoo [Bot] and 1 guest