VisualAge Smalltalk Web Services Experience Report
description
Transcript of VisualAge Smalltalk Web Services Experience Report
Alison Dixon [email protected] ESUG August 2002
VisualAge Smalltalk Web VisualAge Smalltalk Web Services Experience Services Experience ReportReport
Alison Dixon Alison Dixon [email protected]@attglobal.net
Alison Dixon [email protected] ESUG August 2002
Current EnvironmentCurrent Environment
• Large financial application Large financial application
• Large user base spread over wide Large user base spread over wide geographic areageographic area
• VAST 6.0 Fat ClientVAST 6.0 Fat Client
• OS/2 moving to Windows XPOS/2 moving to Windows XP
• OS/2 server for near futureOS/2 server for near future
Alison Dixon [email protected] ESUG August 2002
Current Environment Current Environment RequirementsRequirements• High uptimeHigh uptime
• High speed High speed
• Peripheral supportPeripheral support
Alison Dixon [email protected] ESUG August 2002
Why Web Services?Why Web Services?
• Re-use of current business logicRe-use of current business logic
• Access to information from external Access to information from external and internal providersand internal providers
• Possible migration path to newer Possible migration path to newer client technologiesclient technologies
Alison Dixon [email protected] ESUG August 2002
Web Service PrototypesWeb Service Prototypes
• Simple string concatenationSimple string concatenation
• Insurance exampleInsurance example
• Client locate - complex input and Client locate - complex input and outputoutput
• External service consumption with External service consumption with complex input and outputcomplex input and output
Alison Dixon [email protected] ESUG August 2002
Various Client TypesVarious Client Types
• VA clientVA client
• C# .netC# .net
• ASP.netASP.net
• Java thick and thin (created using Java thick and thin (created using WSAD)WSAD)
Alison Dixon [email protected] ESUG August 2002
What is a Web Service?What is a Web Service?
• Web Services are self-contained, Web Services are self-contained, modular applications that can be:modular applications that can be:
• DescribedDescribed
• PublishedPublished
• FoundFound
• BoundBound
• InvokedInvoked
• ComposedComposed
Alison Dixon [email protected] ESUG August 2002
Web ServicesWeb Services
• How does it work?How does it work?
ServiceProvider
ServiceRequester
ServiceBroker
Publish
Find
Bind
Alison Dixon [email protected] ESUG August 2002
Service Oriented Service Oriented ArchitectureArchitecture
• Web Service Definition Language: an XML based interface Web Service Definition Language: an XML based interface definition language for network based servicesdefinition language for network based services
• Universal Description Discovery & Integration: a standards Universal Description Discovery & Integration: a standards based architecture specification for service description and based architecture specification for service description and discovery. (www.uddi.org)discovery. (www.uddi.org)
• Simple Object Access Protocol: a lightweight XML based Simple Object Access Protocol: a lightweight XML based protocol for the exchange of information in a decentralized, protocol for the exchange of information in a decentralized, distributed environment.distributed environment.
ServiceProvider
ServiceRequester
ServiceBroker
Publish
FindBind
WSDL
UDDI
SOAP
Alison Dixon [email protected] ESUG August 2002
VA Web Services PlatformVA Web Services Platform• SSTSST
– TransportsTransports
– DispatchingDispatching
• XMLXML
– Schema based SAX parsing handlersSchema based SAX parsing handlers
– Uses the existing SAX engineUses the existing SAX engine
• Supports SOAP over HTTPSupports SOAP over HTTP
– 0.40 beta has HTTPs (client)0.40 beta has HTTPs (client)
• Maintain Smalltalk SemanticsMaintain Smalltalk Semantics
– MessagingMessaging
– FaultsFaults
Alison Dixon [email protected] ESUG August 2002
The FilesThe Files
• .wsdl (parent and imported).wsdl (parent and imported)
• .xml (client and server).xml (client and server)
• .map (client and server).map (client and server)
Alison Dixon [email protected] ESUG August 2002
WSDLWSDL
• Allows separation of implementation Allows separation of implementation and interfaceand interface
• High-level WSDL has interface specs High-level WSDL has interface specs – location of service– location of service
• Imported file contains schema and Imported file contains schema and service messaging specsservice messaging specs
Alison Dixon [email protected] ESUG August 2002
XMLXML
• Allows specification of the Smalltalk Allows specification of the Smalltalk deploymentdeployment
• Define mapping specs and wsdlDefine mapping specs and wsdl
• Custom handlersCustom handlers
• Able to specify client and server sideAble to specify client and server side
• Allows user to specify whether service Allows user to specify whether service will run remote or localwill run remote or local
Alison Dixon [email protected] ESUG August 2002
MappingMapping
• Allows conversion between web Allows conversion between web service elements or types and service elements or types and Smalltalk classesSmalltalk classes
• Useful for mapping between Array Useful for mapping between Array and OrderedCollectionand OrderedCollection
Alison Dixon [email protected] ESUG August 2002
Web Services ContainerWeb Services Container
• The key element in the The key element in the implementation, the Services implementation, the Services Container is responsible for the Container is responsible for the storage and manipulation of all storage and manipulation of all information relating to deployed information relating to deployed Web servicesWeb services
• Client and server have their own Client and server have their own separate containersseparate containers
Alison Dixon [email protected] ESUG August 2002
Serialization ManagerSerialization Manager
• Makes available cached information (retrieved when Makes available cached information (retrieved when the service was deployed) that enables serialization the service was deployed) that enables serialization and deserialization of SOAP messagesand deserialization of SOAP messages
• Responsible for loading/storing XML Mapping specs Responsible for loading/storing XML Mapping specs named in VA ST Web services deployment descriptornamed in VA ST Web services deployment descriptor
• Responsible for loading/storing XML schemas Responsible for loading/storing XML schemas referenced in deployed WSDLreferenced in deployed WSDL
• Two level resolution of resourcesTwo level resolution of resources
– First meFirst me
– Then AbtXmlObjectCacheThen AbtXmlObjectCache
Alison Dixon [email protected] ESUG August 2002
HandlersHandlers
• VA web services supports various VA web services supports various handlershandlers
• Add to deployment descriptor for Add to deployment descriptor for customized processingcustomized processing
Alison Dixon [email protected] ESUG August 2002
Current StatusCurrent Status
• Functioning prototypes with various Functioning prototypes with various clientsclients
• Packaged client runtimePackaged client runtime
Alison Dixon [email protected] ESUG August 2002
Struggles Along the WayStruggles Along the Way
• Proxy serverProxy server
• Use of arrays in C# and JavaUse of arrays in C# and Java
• Multi-references in C# - Multi-references in C# - interoperabilityinteroperability
• Organizing the files and discovering Organizing the files and discovering the purposesthe purposes
• Beta codeBeta code
Alison Dixon [email protected] ESUG August 2002
Proxy Server Proxy Server AuthenticationAuthentication• Setting of credentials with Base64 Setting of credentials with Base64
encodingencoding(SstTransport configurationRegistry at: 'http')(SstTransport configurationRegistry at: 'http')
proxyCredentials: 'Basic proxyCredentials: 'Basic CCQwXXXNNN5kaWRR'.CCQwXXXNNN5kaWRR'.
• Setting of proxy urlSetting of proxy url(SstTransport configurationRegistry at: 'http')(SstTransport configurationRegistry at: 'http')
proxyUrl: ('http://proxy:8080') sstAsUrl.proxyUrl: ('http://proxy:8080') sstAsUrl.
Alison Dixon [email protected] ESUG August 2002
Content of an External Content of an External WSDLWSDL(SstXmlResourceReader new fetch:(SstXmlResourceReader new fetch:
('http://www.xmethods.net/sd/('http://www.xmethods.net/sd/TemperatureService.wsdl' sstAsUrl)) TemperatureService.wsdl' sstAsUrl)) inspect.inspect.
(SstXmlResourceReader new fetch:(SstXmlResourceReader new fetch:
('http://www.alethea.net/webservices/('http://www.alethea.net/webservices/zipcode.asmx?wsdl' sstAsUrl)) inspect.zipcode.asmx?wsdl' sstAsUrl)) inspect.
Alison Dixon [email protected] ESUG August 2002
Invoking Remote Web Invoking Remote Web ServicesServices
[ | aContainer aServiceCollection|[ | aContainer aServiceCollection|
aContainer := SstWSContainer containerNamed: aContainer := SstWSContainer containerNamed: SciSocketManager default getHostName.SciSocketManager default getHostName.
aServiceCollection := aContainer deploy: aServiceCollection := aContainer deploy:
'http://www.xmethods.com/sd/'http://www.xmethods.com/sd/StockQuoteService.wsdl'.StockQuoteService.wsdl'.
( aServiceCollection first getQuote: 'QCOM' ) inspect] ( aServiceCollection first getQuote: 'QCOM' ) inspect] forkfork
Alison Dixon [email protected] ESUG August 2002
TroubleshootingTroubleshooting
• Settings for disabling trapping of Settings for disabling trapping of exceptionsexceptions– Tools > SST > Trap exceptionsTools > SST > Trap exceptions
– Tools > SST > Forward exceptionsTools > SST > Forward exceptions
• Forking of actionsForking of actions
Alison Dixon [email protected] ESUG August 2002
Use of Handlers for Use of Handlers for Performance TimingsPerformance Timings• How we took timingsHow we took timings
– Use of web service handlersUse of web service handlers
– Addition of performance info to the Addition of performance info to the wsdlwsdl
• What we learned about our What we learned about our applicationapplication
Alison Dixon [email protected] ESUG August 2002
Client-side Output HandlerClient-side Output Handler
• Add a handler to the client containerAdd a handler to the client container
| chain || chain |
chain := (SstWSContainer containerNamed: chain := (SstWSContainer containerNamed: 'EnterpriseBankerServices') handlerFactory 'EnterpriseBankerServices') handlerFactory handlerNamed: handlerNamed: 'wsClientInputMessageConstructor'.'wsClientInputMessageConstructor'.
chain addHandler: chain addHandler: (WcWSClientContainerOutputHandler new (WcWSClientContainerOutputHandler new name: 'containerOutputHeaderHandler')name: 'containerOutputHeaderHandler')
Alison Dixon [email protected] ESUG August 2002
Client-side Output HandlerClient-side Output Handler
• The following adds information to the SOAP headerThe following adds information to the SOAP header
invoke: anSstWSMessageContextinvoke: anSstWSMessageContext
" Write performance timings to the output message."" Write performance timings to the output message."
| containerHeaderElement || containerHeaderElement |
containerHeaderElement := self newElementFrom: containerHeaderElement := self newElementFrom: anSstWSMessageContext.anSstWSMessageContext.
containerHeaderElementcontainerHeaderElement
timeParsingAtClient: Time now asMilliseconds asString;timeParsingAtClient: Time now asMilliseconds asString;
timeInvokedAtClient: WcPerformanceTimings timeInvokedAtClient.timeInvokedAtClient: WcPerformanceTimings timeInvokedAtClient.
anSstWSMessageContext currentMessage addHeaderElement: anSstWSMessageContext currentMessage addHeaderElement: containerHeaderElementcontainerHeaderElement
Alison Dixon [email protected] ESUG August 2002
Client-side Input HandlerClient-side Input Handler
• Add a handler to the client side xml fileAdd a handler to the client side xml file
<handlers namespace="urn:vastPerformanceGlobals"><handlers namespace="urn:vastPerformanceGlobals">
<handler name="vastPerformance"<handler name="vastPerformance" class="WcWSClientContainerInputHandler"/>class="WcWSClientContainerInputHandler"/>
</handlers></handlers>
• Add code to the invoke: method of your class ‘WcWSClientContainerInputHandler’Add code to the invoke: method of your class ‘WcWSClientContainerInputHandler’
invoke: anSstWSMessageContextinvoke: anSstWSMessageContext
" Perform any client-side handler processing "" Perform any client-side handler processing "
| performanceInfo || performanceInfo |
performanceInfo := anSstWSMessageContext propertyNamed: performanceInfo := anSstWSMessageContext propertyNamed: WSCustomHandlerElement.WSCustomHandlerElement.
WcPerformanceTimings timeInvokedAtClient: performanceInfo timeInvokedAtClient;WcPerformanceTimings timeInvokedAtClient: performanceInfo timeInvokedAtClient;
timeParsingAtClient: performanceInfo timeParsingAtClient;timeParsingAtClient: performanceInfo timeParsingAtClient;……………….(cont).(cont)
Alison Dixon [email protected] ESUG August 2002
Server-side Input HandlerServer-side Input Handler
• Add a handler to the server side xml fileAdd a handler to the server side xml file
<handlers <handlers namespace="urn:vastPerformanceGlobals">namespace="urn:vastPerformanceGlobals">
<handler name="vastPerformance"<handler name="vastPerformance"
class="WcWSServerContainerInputHandler"/>class="WcWSServerContainerInputHandler"/>
</handlers></handlers>
• Add code to the invoke: method of the above classAdd code to the invoke: method of the above class
Alison Dixon [email protected] ESUG August 2002
Server-side Output Server-side Output HandlerHandler• Add a handler to the server containerAdd a handler to the server container
<handler <handler name="wsGlobalResponseServerHanname="wsGlobalResponseServerHandler" dler" class="WcEBankerContainerHeaderOclass="WcEBankerContainerHeaderOutputHandler"/>utputHandler"/>
• Add code to the invoke: method of Add code to the invoke: method of the above classthe above class
Alison Dixon [email protected] ESUG August 2002
Performance TimingsPerformance Timings
Alison Dixon [email protected] ESUG August 2002
Performance Timings Performance Timings cont.cont.
Alison Dixon [email protected] ESUG August 2002
Next StepsNext Steps
• Consuming a web service from Consuming a web service from another departmentanother department
• Implementing our framework for Implementing our framework for web servicesweb services
• Serverizing our codeServerizing our code