I found in internet an example of a web service consumer in lotus environment (Planet Lotus or Wohill) and I wanted to write an other example.
I chose USA Weather web service from WebserviceX.NET.
- Create a web service consumer, name it “USA Weather”, set the WSDL file to http://www.webservicex.net/WeatherForecast.asmx?WSDL
The code in the web service consumer should be:
123456789101112131415161718192021222324252627282930313233343536373839404142Option Public%INCLUDE "lsxsd.lss"Class WeatherData_n1 As XSD_ANYTYPEPublic Day As XSD_STRINGPublic WeatherImage As XSD_STRINGPublic MaxTemperatureF As XSD_STRINGPublic MinTemperatureF As XSD_STRINGPublic MaxTemperatureC As XSD_STRINGPublic MinTemperatureC As XSD_STRINGSub NEWEnd SubEnd ClassClass ArrayOfWeatherData_n1 As XSD_ANYTYPEPublic WeatherData() As WeatherData_n1Sub NEWEnd SubEnd ClassClass WeatherForecasts_n1 As XSD_ANYTYPEPublic Latitude As SinglePublic Longitude As SinglePublic AllocationFactor As SinglePublic FipsCode As XSD_STRINGPublic PlaceName As XSD_STRINGPublic StateCode As XSD_STRINGPublic Status As XSD_STRINGPublic Details As ArrayOfWeatherData_n1Sub NEWEnd SubEnd ClassConst n1 = "http://www.webservicex.net"Class WeatherForecastSoap_n1 As PortTypeBaseSub NEWCall Service.Initialize ("HttpWwwWebservicexNetWeatherForecast", _"WeatherForecast.WeatherForecastSoap", "http://www.webservicex.net/WeatherForecast.asmx", "WeatherForecastSoap_n1")End SubFunction GetWeatherByZipCode(ZipCode As XSD_STRING) As WeatherForecasts_n1Set GetWeatherByZipCode = Service.Invoke("GetWeatherByZipCode", ZipCode)End FunctionFunction GetWeatherByPlaceName(PlaceName As XSD_STRING) As WeatherForecasts_n1Set GetWeatherByPlaceName = Service.Invoke("GetWeatherByPlaceName", PlaceName)End FunctionEnd Class - Create a lotusscript agent and insert this code:
1234567891011121314151617181920212223242526272829303132333435363738394041Option PublicOption DeclareUse "USA Weather"Sub Initialize()Dim serviceClass As New WeatherForecastSoap_n1Dim strRequest As New XSD_STRINGDim session As New NotesSessionDim response As WeatherForecasts_n1Dim details As ArrayOfWeatherData_n1Dim latitude As SingleDim longitude As SingleDim placeName As StringDim stateCode As StringDim calendarDay(5) As StringDim i As IntegerDim minTemperatureC(5) As IntegerDim maxTemperatureC(5) As IntegerstrRequest.Setvaluefromstring("New York")Set response = serviceClass.GetWeatherByPlaceName(strRequest)latitude = response.Latitudelongitude = response.LongitudeplaceName = response.Placename.Getvalueasstring()stateCode = response.Statecode.Getvalueasstring()Print placeName & " " & stateCode & " lon.:" & longitude & " lat.:" & latitudeSet details = response.DetailsFor i = 0 To 5calendarDay(i) = details.Weatherdata(i).Day.Getvalueasstring()minTemperatureC(i) = CInt(details.Weatherdata(i).minTemperatureC.Getvalueasstring())maxTemperatureC(i) = CInt(details.Weatherdata(i).maxTemperatureC.Getvalueasstring())Print calendarDay(i) & " T min:" & minTemperatureC(i) & " T max:" & maxTemperatureC(i)NextEnd Sub - Run the agent and look the status bar