jmp206 - lotus domino web services jumpstart
DESCRIPTION
A 2-hour 'jumpstart' presentation from Lotusphere 2008TRANSCRIPT
reg
Web Services BootcampBill Buchan - HADSL
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
IntroductionI am Bill Buchan I am
A blogger - httpwwwbillbuchancomI was blogging when it was called lsquoTalking rubbish on the internetrsquoSome things never change
A principal of HADSL - httpwwwhadslcomA Notes veteran of some 14 yearsOld Its my birthday today so no loud noises
You areLotus Domino developersInterested in starting or enhancing Web Services in your environmentFamiliar with LotusScript and perhaps Java
This is a JumpStartThis takes you from a low level in a subject to a good level of expertise
Little existing knowledge is assumedBut we assume your are developers and are familiar with LotusScript
Its 2 hours longSo get comfortable visit the toilet
People have paid to come to this sessionSo as a matter of courtesy please switch off all mobile phones etcIf your phone goes off you will have to buy a drink for everyone in the room
Feel free to ask some questions as we go alongBut I reserve the right to leave some answers till the end
I will be doing live demonstrationsSo feel free to laugh if they break
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
A quick Web Services overviewWeb services are
A standard application to application protocol for exchanging structured dataUsually (but not always) using the http protocolUsually (but not always) using XMLUsually we provide meta-information on what our service will do using a language calledWSDL (Web Service Description Language) ndash formatted in XML
Web services areLanguage independentPlatform independentData format representation independent
But hopefully you all knew this already
Web Services ArchitectureThe players
The Web Service serverCan answer questions on what it can doCan accept requests from Web Service clientsCan respond to requests from Web service clients
The Web Service client (or consumer)rlmKnows where the web service server is locatedKnows the services that it requiresKnows how to prepare a Web Services QueryKnows how to interpret the returned data
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
IntroductionI am Bill Buchan I am
A blogger - httpwwwbillbuchancomI was blogging when it was called lsquoTalking rubbish on the internetrsquoSome things never change
A principal of HADSL - httpwwwhadslcomA Notes veteran of some 14 yearsOld Its my birthday today so no loud noises
You areLotus Domino developersInterested in starting or enhancing Web Services in your environmentFamiliar with LotusScript and perhaps Java
This is a JumpStartThis takes you from a low level in a subject to a good level of expertise
Little existing knowledge is assumedBut we assume your are developers and are familiar with LotusScript
Its 2 hours longSo get comfortable visit the toilet
People have paid to come to this sessionSo as a matter of courtesy please switch off all mobile phones etcIf your phone goes off you will have to buy a drink for everyone in the room
Feel free to ask some questions as we go alongBut I reserve the right to leave some answers till the end
I will be doing live demonstrationsSo feel free to laugh if they break
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
A quick Web Services overviewWeb services are
A standard application to application protocol for exchanging structured dataUsually (but not always) using the http protocolUsually (but not always) using XMLUsually we provide meta-information on what our service will do using a language calledWSDL (Web Service Description Language) ndash formatted in XML
Web services areLanguage independentPlatform independentData format representation independent
But hopefully you all knew this already
Web Services ArchitectureThe players
The Web Service serverCan answer questions on what it can doCan accept requests from Web Service clientsCan respond to requests from Web service clients
The Web Service client (or consumer)rlmKnows where the web service server is locatedKnows the services that it requiresKnows how to prepare a Web Services QueryKnows how to interpret the returned data
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
IntroductionI am Bill Buchan I am
A blogger - httpwwwbillbuchancomI was blogging when it was called lsquoTalking rubbish on the internetrsquoSome things never change
A principal of HADSL - httpwwwhadslcomA Notes veteran of some 14 yearsOld Its my birthday today so no loud noises
You areLotus Domino developersInterested in starting or enhancing Web Services in your environmentFamiliar with LotusScript and perhaps Java
This is a JumpStartThis takes you from a low level in a subject to a good level of expertise
Little existing knowledge is assumedBut we assume your are developers and are familiar with LotusScript
Its 2 hours longSo get comfortable visit the toilet
People have paid to come to this sessionSo as a matter of courtesy please switch off all mobile phones etcIf your phone goes off you will have to buy a drink for everyone in the room
Feel free to ask some questions as we go alongBut I reserve the right to leave some answers till the end
I will be doing live demonstrationsSo feel free to laugh if they break
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
A quick Web Services overviewWeb services are
A standard application to application protocol for exchanging structured dataUsually (but not always) using the http protocolUsually (but not always) using XMLUsually we provide meta-information on what our service will do using a language calledWSDL (Web Service Description Language) ndash formatted in XML
Web services areLanguage independentPlatform independentData format representation independent
But hopefully you all knew this already
Web Services ArchitectureThe players
The Web Service serverCan answer questions on what it can doCan accept requests from Web Service clientsCan respond to requests from Web service clients
The Web Service client (or consumer)rlmKnows where the web service server is locatedKnows the services that it requiresKnows how to prepare a Web Services QueryKnows how to interpret the returned data
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
This is a JumpStartThis takes you from a low level in a subject to a good level of expertise
Little existing knowledge is assumedBut we assume your are developers and are familiar with LotusScript
Its 2 hours longSo get comfortable visit the toilet
People have paid to come to this sessionSo as a matter of courtesy please switch off all mobile phones etcIf your phone goes off you will have to buy a drink for everyone in the room
Feel free to ask some questions as we go alongBut I reserve the right to leave some answers till the end
I will be doing live demonstrationsSo feel free to laugh if they break
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
A quick Web Services overviewWeb services are
A standard application to application protocol for exchanging structured dataUsually (but not always) using the http protocolUsually (but not always) using XMLUsually we provide meta-information on what our service will do using a language calledWSDL (Web Service Description Language) ndash formatted in XML
Web services areLanguage independentPlatform independentData format representation independent
But hopefully you all knew this already
Web Services ArchitectureThe players
The Web Service serverCan answer questions on what it can doCan accept requests from Web Service clientsCan respond to requests from Web service clients
The Web Service client (or consumer)rlmKnows where the web service server is locatedKnows the services that it requiresKnows how to prepare a Web Services QueryKnows how to interpret the returned data
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
A quick Web Services overviewWeb services are
A standard application to application protocol for exchanging structured dataUsually (but not always) using the http protocolUsually (but not always) using XMLUsually we provide meta-information on what our service will do using a language calledWSDL (Web Service Description Language) ndash formatted in XML
Web services areLanguage independentPlatform independentData format representation independent
But hopefully you all knew this already
Web Services ArchitectureThe players
The Web Service serverCan answer questions on what it can doCan accept requests from Web Service clientsCan respond to requests from Web service clients
The Web Service client (or consumer)rlmKnows where the web service server is locatedKnows the services that it requiresKnows how to prepare a Web Services QueryKnows how to interpret the returned data
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
A quick Web Services overviewWeb services are
A standard application to application protocol for exchanging structured dataUsually (but not always) using the http protocolUsually (but not always) using XMLUsually we provide meta-information on what our service will do using a language calledWSDL (Web Service Description Language) ndash formatted in XML
Web services areLanguage independentPlatform independentData format representation independent
But hopefully you all knew this already
Web Services ArchitectureThe players
The Web Service serverCan answer questions on what it can doCan accept requests from Web Service clientsCan respond to requests from Web service clients
The Web Service client (or consumer)rlmKnows where the web service server is locatedKnows the services that it requiresKnows how to prepare a Web Services QueryKnows how to interpret the returned data
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Web Services ArchitectureThe players
The Web Service serverCan answer questions on what it can doCan accept requests from Web Service clientsCan respond to requests from Web service clients
The Web Service client (or consumer)rlmKnows where the web service server is locatedKnows the services that it requiresKnows how to prepare a Web Services QueryKnows how to interpret the returned data
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Web Services ProtocolA typical web service session looks like
Client to Web Service ServerldquoTell me the answer to this questionrdquo
Web Service ServerldquoHere it isrdquo
ConclusionThe clients drive the conversationThe Server cannot initiate a conversation with the client
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Web Services Protocol (in more detail) rlmThe Web Services Protocol
The client decides it needs to ask the server for some informationIt constructs the relevant XML based web services query (either dynamically or in a static fashion depending on the complexity of the application)rlmIt then connects to the Web Service Server
Pushing the web request up as an HTTP Post requestIt waits for a response
The Web service server then Posts back an XML payload representing the answerThe client then unpacks and interprets the data
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
This sounds hard
Not really Its a combination of web protocol and XML construction and unpackingMost of the hard work is done for you by the various Web Service servers and ConsumersIts fairly easy to debug using the correct tools
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Lets prepare a sample application
Fairly simple Domino Contact DatabaseA single lsquoContactrsquo form with some informationNot meant to be a lsquoreal-worldrsquo exampleIts here to demonstrate the techniques
All example code is in the databaseSimple to figure out and lsquoresearchrsquoProbably isnt best practice
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Example Database Contactsnsf
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Example Database Contactsnsf
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
How do we test a web service
I recommend SoapUIIts freehttpwwwsoapuiorg
It allows you to interrogate a web serviceAnd build test case with real data
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
SoapUI Example Screenshot
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Domino as a Web Service Server
Three different methodsUsing LotusScript as a Web serviceCoding a Java ServletUsing an agent
By far the simplest is to use a LotusScript Web ServiceThe majority of the work is done for you
Servlets should be avoided unlessYou are running on Domino v65x or olderYou absolutely require persistence
Agents are good forVery low transaction servicesSimple services
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
LotusScript Web Services in nd7 and nd8
Introduced in Lotus Domino 7
Robust
Code the web service using LotusScript
Fairly high performance butRemember Lack of persistence between calls so
Be aware of what your code is doingUse lsquoAgent Profilingrsquo to see timingshellip
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Profiling a LotusScript Web Service
LotusScript web services are very similar to LotusScript agentsSo you can profile themEnable Profiling on the WebServices Properties tab
View the last run profileRight click on the Web ServiceView Profile Results
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
A Sample Profile
This shows how long the agent took to run and how long the agent spent inside the Notes Object Interface
In our case 761ms total and 0ms within NOIOne call to CurrentDatabase and one call to Title
Obviously this wasnrsquot a very interesting web service callhellip
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Designing a Web Service
Spend time thinking about how your consumer will use this web service
More time thinking less time codingYou do NOT want to change this web service interface once its published
Instead - roll out a new web serviceThink through client use casesRemember - you can use LotusScript to perform complex business rules and provide a summary of data to your consumer
Donrsquot assume the consumer can perform a lot of data manipulationndash BlackBerry smartphones Windows Mobile
Best to put complex code in a script library and just surface it via a web service
It means you can put a normal agent lsquotest harnessrsquo around it and debug itRemote Debugging might not workhellip
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Contactsnsf - Web Service
In our case we wish toBe able to list all users
By NameBy Department
Be able to get details on a particular userBe able to search for users
Do we Pass all fields back as web service items Pass back an array of fields
In this case we pass back Web Service ItemsAssume data mapping knowledge and responsibility
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Contactsnsf - Web Service Design
We design our web service interface within a lsquoClassrsquo in LotusScriptAt this point you probably wished that you studied the Object Orientated LotusScript sessions I used to givehellipGood example presentations on my personal blog presentations page
httpwwwbillbuchancomwebnsfplinksBBUN6MQECQhtm
Our web service will expose all lsquopublicrsquo methods and propertiesWe do not have to put all the code in one lsquoclassrsquoBeware of extending existing classes - you might expose more than you want
Beware over-exposurehellip
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Contactsnsf - Web Service Design
LotusScript does NOT allow functions to return ArraysThis is a language limitation not a Web Service LimitationIt can return simple types A variant (but since web services donrsquot support lsquoem we cant use lsquoem)Instances of other classeshellip
We need to use arrays to return resultsFor instance we need to return an array of Zero or more entries to list our usersHow do we do that
We can define a class and return an instance of that classhellip
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Web Service Design - returning complex types
We can define a class called lsquoReturnArrayrsquo which has a singlearray as a public member
The constructor initialises the array so that it has one blank entry
We can then populate this arraywith one or more entries
LotusScript Web services only supports single dimension arrays
Nd7 supports arrays with one element or more - nd8 supports lsquoemptyrsquo arrays
Class returnArray Public S() As String Sub new Redim
S(0) S(0) = End SubEnd Class
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Web Services Design - returning complex typeshellip
We shall return our Person contact record using a class
We DONrsquoT have a constructorAll elements are Public - so itrsquoll be exposed to the Web Service as dataOur property names will be used by the web service as field names
Since LotusScript is case insensitive the web service field names will be UPPERCASE
Class Person Public FirstName
As String Public MiddleInitials
As String Public LastName
As String Public FullName
As String Public Telephone As String Public Cellphone
As String Public eMail
As String Public HomePhone
As String
Public Department as String
Public Notes As StringEnd Class
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Demo Time
Finally A Demo
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Web Services Design - lets make it better
We need to addLogging We need to know when it works and importantly when it does notError Handling We need to pass errors back to the consumerSecurity We might want to harden this service somewhat
We committed the following sinsWe put all the code in the web service itself making it hard to test Best to consider embedding most of the code in script librariesWersquove tightly bound the data structures in our data to our web service
If we add more fields to our contact record - we shall have to change the web service And therefore all our clients will have to be checked andor recompiledIf the data set is likely to change construct a more flexible data-mapping schema
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
ND7 and ND8 differences
Web services built or compiled in Notes 8 Designer WONT run on ND7 anymore
So be careful about what web services you host on which serversand which version of designer you use
Just bear this version difference in the same manner as all other version differences
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
ND7 and ND8 differences
In ND7 the class used for the web service has to reside in the web service design element In ND8 this can be in a script library
This means that for complex services you can place all the business code in a script library allowing simple construction of a test harness
ND8 now supports code in Java Libraries
ND8 supports more error handling SOAP elements
ND8 supports lsquoemptyrsquo arrays - nd7 does not
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Testing this web service using SoapUI
Demo Lets go test this service with SoapUI
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Web Services Design - lets talk about WSDL
WSDL - Web Services Description LanguageIts an XML documentYou can query a web service for its WSDL You build a web service consumer from the WSDL
Lotus Domino LotusScript Web Services WSDLIs automatically generated for youYou can query a LotusScript Web Service by passing a URL
httplthostgtltdirectorygtltdatabasegtltweb servicegtWSDLIt will then return an XML document showing the WSDL
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
WSDL Example
The first sectionoutlines the dataobjects we shallpass from thisservice
You can see ourreturnArray ampPerson objects
Note that our variables default to Uppercase - this is a side-effect of LotusScript being a non-case sensitive language
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
WSDL Example
The second section of our WSDL deals with the Web Services Messages that will be sent to the Web service and the types that get returned
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
WSDL Example
The port section associates input messages - function calls - with their return types
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
WSDL Example
The binding section defines all input and output operations
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
WSDL Example
The Service sectionConnects the service to the bindingGives a fully formed URL for the service
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
WSDL
Why mention that in such detail
LotusScript Web services does all the work
The following web service engines do NOTAnd it seems like a lot of workhellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Java Servlet Web Service Overview
Why construct a Web Service in a ServletPersistence
The LotusScript web engine does not persist data between calls Complex operations can take advantage of persistent memory objects in Java
PerformanceBecause of persistence you may be able to support many more simultaneous users
What are the downsidesVery old servlet engine (Servlet v11) in Domino Very little controlOld versions of Java
Example Nd6 uses Java 131 which is no longer supportedComplex
You have to do lots more work to achieve the same goalsMore difficult to support
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Java Servlet Web Service Introduction
So how do servlets workCompiled Java code placed in Dominoservlet directory in server data directoryServlet Engine enabled on server documentWhen http engine loads it loads any defined servlets
To reload a servlet restart the http processUses lsquoservletpropertiesrsquo file in data directory to
Map servlet URLs to servletsLoad servlets into memory
I use eclipse to build the servletYou might be able to debug in real-time
You can optionally link to the NotesDomino Java interface to examine data
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Java Servlet Engine servletproperties file
The text file lsquoservletpropertiesrsquo exists in the domino directory
servletContactcode=Contact Supply the intitialisation
arguments Server = the name of this server Db = the Database path for the web service database Name = the alias name youve given the servlet WSDL = the name of the WSDL file (remember to double up characters to ) This should all be in one linehellipservletContactinitArgs=Db=customersls2008ContactsnsfServer=idm-
demo1HADSLName=ContactWSDL=cLotusDominoidm-
demo1dominoservletContactswsdl Load this servlet
at startupservletsstartup=Contact
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Java Servlet Architecture
The Servlet will On startup will read parameters from servletpropertiesRespond to http lsquogetrsquo requests and return the WSDL for this service
For convenience wersquoll store this in a file Respond to http lsquopostrsquo requests
Parse incoming SOAP for requestsReturn results as XML
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Java Servlet Engine Code
Lets walk through the codehellip
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Java Servlet Engine Summary
Itrsquos a LOT of work
Its fairly normal Java
Its quite hard to change or add new functionality
Remember The Servlet engine in Domino is old and fairly crudeYou might wish to use a more modern Servlet engine such as Websphere
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Agent based Web Service Engine
Now that we understand how a web service works we can construct an Agent based Web Service
ProsCan run in Domino 6Straightforward
ConsPerformanceComplex code
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Agent Based Server - Architecture
A single web-based agent
Accepts requests GET Requests tend to be WSDL requestsPOST Requests are SOAP Requests
We can use the NotesDOM parser to decode the incoming SOAPFairly complex code
We can just use ldquoPrintrdquo statements to output the resultsFairly lsquobrittlersquo Tightly bound to the Web Service
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Agent Based Server - Demo
Demo Lets see this in action
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Agent Based Server - Summary
Lets look at the code
ProsNo additional server code requiredIt can run on Domino 6
ConsThe code is brittle unpleasantOnly do this if you have no other better web servers available
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
REST
REST - Representational State TransitionIts an architectural proposal - not a standard
In terms of Web Services it meansThe query part of the web service is represented using an URL For Example
httpmyservercomserviceListContactshttpmyservercomserviceContactInfoFred+FlintstonehttpmyservercomserviceListContactsByDepartmentSales
Who does it helpWith simple web services you spend less time parsing XMLVery simple to implement consumer code No incoming XML payload
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
REST
We pass in parameters on the URL
Our URL needs to start withhttpdominserverpathdatabasensfDesignElementhellipAny URL customisation needs to happen after the DesignElement EG
httpibmcomdbnsfAgentOpenAgentampCmd=ListUsershttpibmcomdbnsfAgentOpenAgentampCmd=GetUserampName=Fred+Flintstone
In our servlet or in our AgentWe can intercept the incoming URL decode it and take action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Consuming a web service - overview
Why consume web servicesTo gain access to information in other systemsTo prevent the syncronisation and replication of external data sources to NotesReal time up to date data lookup
WhereWe could use a scheduled Java agent in Domino to interrogate external services
No UI means you have to monitor and checkWe could use client-driven code on the client workstation
Be aware of network issues between the clients and the remote servicendash Large corporate intranets are rarely stable and predictablendash Predict amp accommodate remote service outage
Any issues are immediately visible to the usersndash Empowering or Confusing
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Consuming a web service - overview
SecurityRemote web services may require
Usernamepassword loginEncrypted usernamepassword pairs in data SSL
Things changeYou may have to change your web service consumer to accommodate thisThe remote web service may moveWhen designing donrsquot hard-codehellip
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Consuming a web service - examples
In the following sections We shall use the web services we constructed earlier as a targetWe wont use any security features for simplicityWersquore coding to demonstrate technique not best practices
So by all means reuse this code but make it production-strengthndash Add Error handlingndash Remove hard-codingndash Add Logging
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Consuming Web Services with LotusScript
SummaryNotes 8Its very simpleIt works in LotusScript and in JavaIt does a lot of work for you
How do I construct a Web Service Consumer in LotusScriptCreate a new empty script libraryClick on the Import WSDL buttonIt creates a Class definitionYou can then ldquouserdquo the script library and class
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Consuming Web Services using LotusScript
Create a new LotusScript Script Library
Click on the WSDL buttonhellip
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Consuming Web Services with LotusScript
It needs a WSDL file Whats thatYou can open the WSDL definition for your web service in your browserUse View Source and save that as a WSDL fileSelect ithellip
Designer will then construct helper classes and a main class which we can then call
Thatrsquos it
Sub Initialize Dim C As New Contacts Dim V As Variant Set V = ClistUsers() Forall
thisUser
In VS Print Found User + thisUser End ForallEnd Sub
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Demo LotusScript Web Service Consumer
Lets go build our LotusScript consumer LIVEhellip
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
LotusScript Consumer Gotchas
The entire LotusScript library is taken up with the computed Web service definition Best not to make changes
Next time its refreshed you will lose those changes
If you change the web service you must remember to update the Web Services consumer
It doesnrsquot take long - so donrsquot forget itAnd when you change the web service consumer script library you must recompile all the LotusScript that relies on it
lsquoTools Recompile LotusScriptrsquo is your friend
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
LotusScript Consumer Gotchas
It requires the Notes 8 client to run onWe as Application Developers deploy solutions on usersrsquo target notes clientsNotes 8 may not yet be adopted in your environmentThis may help drive the upgrade process
What if you need Web Service consumption now and are not yet on Notes 8
The following sections will answer your questionshellip
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Consuming a web service using COM
There are applications which enable you to perform web service consumer work directly from LotusScript
We shall focus on the MS Soap ToolkitIts not the only one - many others exist
Very Quick and Very DirtyIts platform specificYou need to install a DLL on each workstation
When would you use thisBuilding test harnessesPerhaps on low user-count web service applications
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
COM Consumer
So what does the code look like
Dim Client As VariantSet Client = CreateObject(MSSOAPSoapClient)Initialize connection to the Web ServiceCall Clientmssoapinit
( url
)Dim result As String
result = ClientgetApplicationName()Msgbox
Application Name is + result
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
COM Consumer
The MS Soap web service consumerIs Platform specific - windows onlyRequires installationIs no longer supportedDoesnrsquot handle complex objects well
Arrays and Class Objects are returned as COM objectsVery opaque - difficult to work out how they work
Doesnrsquot sound very usefulBut it can help quickly build test harnesses
A more useful COM based SOAP consumerMicrosoft XML HTTP objecthellip
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
COM Consumer MS XMLHTTP
Its far more low level than MS SOAPYou have to construct the HTTP header SOAP payloadYou get back raw text which you can pass to an XML parser
Its bundled by default with various Microsoft PackagesYou might find that its already deployed in your environmentVarious versions exist
Lets see it in action
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Stubby Introduction
ItIs a project on httpOpenNtforgGenerates the relevant java stub files to allow you to consume java web servicesruns on the notes clientOnly runs on Notes 7
So itrsquos a very tactical solutionhellip
Use the helper form to create the necessary stub files
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Stubby Generating Stub Files
Enter the URL for the web service and click lsquoGenerate Stub Filesrsquo
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Stubby Copy generated files
Save the JAR fileto your local harddrive
Copy the same code to the clipboard
Go to your database create a new java agentEdit Project and attach the JAR filePaste the sample code into the Java agentExtend the class to use the web service methods
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Stubby Exposing Java to LotusScript
So far this has created a platform independent Java agent But wersquore interested in LotusScript
We have two easy ways of interfacing Java and LotusScript agentsLS2JNotes agents can call Notes agentshellip
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Stubby LotusScript to Java Interface
We can write a LotusScript agentWrite a document with some parameter informationCall a Java agent and pass the NoteID of the documentIn the Java agent
Read the parametersWrite the resultsSave the Document
Back in the LotusScript agent re-open the same NoteIDRead the results
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Stubby Calling from LotusScript
Demo Lets call a stubby web service from LotusScript
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
AgendaIntroduction
Web Services Overview
Using Domino to provide Web ServicesLotusScript in Domino v7 and v8Java using a servlet in Domino 5 upwardsUsing an agentREST
Using Notes to consume Web ServicesLotusScript in Notes 8COMStubby in Notes 7
Summary Q+A
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
SummaryWeb Services
Are pretty straightforwardAn important part of your armouryHelp break down barriers between Domino and other systemsHelp prevent data duplication in your environment
By now you know enough to make a real difference
Keep learning
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Questions and Answers
Please fill out your evaluationsThey are taken extremely seriously and form the basis for next years speaker list
Thank you for your time today
Bill Buchanhttpwwwbillbuchancomhttpwwwhadslcom
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-
Legal StuffThe workshops and sessions offered have been prepared by IBM or the session speakers and reflect their own views They are provided for general information purposes only and are neither intended to nor shall have the effect of being legal or other guidance or advice to any participants Such information is provided lsquoas isrsquo without warranty of any kind and IBM assumes no liability or responsibility for the content of any information made available during the workshops and sessions including without limitation information you obtain during general or individual discussions andor question and answer sessions
Material in this directory (including without limitation any advertisements) regarding third parties is based on information obtained from such parties and their Web sites No effort has been made to independently verify the accuracy of the information Mention or reference to all non-IBM products is for informational purposes only Information is provided lsquoas isrsquo without warranty of any kind This document does not constitute an express or implied recommendation or endorsement by IBM of any third party its product or service
This directory is provided AS IS without warranty of any kind express or implied IBM shall not be responsible for any damages arising out of the use of or in any way related to this directory andor any information herein Nothing herein shall create any warranties or representations from IBM or its licensors or alter the terms and conditions of the applicable license or agreements governing the use of IBM software or services References in these materials to IBM products programs or services do not imply that they will be available in all countries in which IBM operates Product release dates andor capabilities referenced in these materials may change at any time at IBM痴 sole discretion based on market opportunities or other factors and are not intended to be a commitment to future product or feature availability In addition certain information may be based on IBMreg current product plans and strategy which are subject to change by IBM without notice
Nothing contained in these materials is intended to nor shall have the effect of stating or implying that any activities undertaken by you will result in any specific sales revenue growth or other results All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved Actual environmental costs and performance characteristics may vary by customer
IBM the IBM logo the e-business logo Lotus Lotusphere IBM Workplace PartnerWorld Move2Lotus Notes Domino Sametime QuickPlace LearningSpace iNotes Domino Designer DominoDoc Lotus Workflow DB2 WebSphere Tivoli Rational LotusScript Everyplace Lotus Enterprise Integrator Lotus Discovery Server Activity Explorer MQIntegrator eServer zSeries pSeries and iSeriesare trademarks of IBM Corporation in the United States other countries or both Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems Inc in the United States other countries or both
Microsoft Windows Windows NT and the Windows logo are trademarks of Microsoft Corporation in the United States other countries or both UNIX is a registered trademark of The Open Group in the United States and other countries Other company product or service names may be trademarks or service marks of others
- Web Services Bootcamp
- Agenda
- Introduction
- This is a JumpStart
- Agenda
- A quick Web Services overview
- Web Services Architecture
- Web Services Protocol
- Web Services Protocol (in more detail)rlm
- This sounds hard
- Lets prepare a sample application
- Example Database Contactsnsf
- Example Database Contactsnsf
- How do we test a web service
- SoapUI Example Screenshot
- Agenda
- Domino as a Web Service Server
- Agenda
- LotusScript Web Services in nd7 and nd8
- Profiling a LotusScript Web Service
- A Sample Profile
- Designing a Web Service
- Contactsnsf - Web Service
- Contactsnsf - Web Service Design
- Contactsnsf - Web Service Design
- Web Service Design - returning complex types
- Web Services Design - returning complex typeshellip
- Demo Time
- Web Services Design - lets make it better
- ND7 and ND8 differences
- ND7 and ND8 differences
- Testing this web service using SoapUI
- Web Services Design - lets talk about WSDL
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL Example
- WSDL
- Agenda
- Java Servlet Web Service Overview
- Java Servlet Web Service Introduction
- Java Servlet Engine servletproperties file
- Java Servlet Architecture
- Java Servlet Engine Code
- Java Servlet Engine Summary
- Agenda
- Agent based Web Service Engine
- Agent Based Server - Architecture
- Agent Based Server - Demo
- Agent Based Server - Summary
- Agenda
- REST
- REST
- Agenda
- Consuming a web service - overview
- Consuming a web service - overview
- Consuming a web service - examples
- Agenda
- Consuming Web Services with LotusScript
- Consuming Web Services using LotusScript
- Consuming Web Services with LotusScript
- Demo LotusScript Web Service Consumer
- LotusScript Consumer Gotchas
- LotusScript Consumer Gotchas
- Agenda
- Consuming a web service using COM
- COM Consumer
- COM Consumer
- COM Consumer MS XMLHTTP
- Agenda
- Stubby Introduction
- Stubby Generating Stub Files
- Stubby Copy generated files
- Stubby Exposing Java to LotusScript
- Stubby LotusScript to Java Interface
- Stubby Calling from LotusScript
- Agenda
- Summary
- Questions and Answers
- Legal Stuff
-