Title: Web Services with WDSCi for Starbase
1Web Services with WDSCi for Starbase
2What is a Web Service
- A programmable application designed to support
machine-to-machine interaction over a network,
regardless of machine type, programming language,
or software application using standard internet
protocols.
3Web Service Components
- XML
- Web Services Description Language
- Universal Description, Discovery, and Integration
- Simple Object Access Protocol
XML
Format Used For Web Services
WSDL
- How to communicate
- Specific Operations
UDDI
- Discover Web Services
SOAP
- Protocol to Exchange Information
4Web Service Components
Bringing It All Together
5WSDL Components
- Types
- Data Types Definitions
- Messages
- Parameters
- Port Types
- Collection of Operations
- Bindings
- Protocol/Data Format
- Services
- Defines Endpoints
WSDL Interface
Types
- Schema Types
Messages
- Parameters
Port Types
- Operations
Bindings
- Operations/Transport Protocol
WSDL Implementation
Service
- Defines Endpoint
6WSDL Types
ltelement name InventoryIdRequestgt
ltcomplexTypegt ltelement name inventoryId
type string /gt lt/complexTypegt lt/elementgt lte
lement name InventoryCheckResponsegt
ltcomplexTypegt ltelement name
inventoryCount type int /gt
lt/complexTypegt lt/elementgt
Note Types can be embedded schema definitions.
7WSDL Messages
ltmessage name inventoryCheckRequestgt ltpart
name parameter1 element InventoryIdRequ
est /gt lt/messagegt ltmessage name
inventoryCheckResponsegt ltpart name
parameter2 element InventoryCheckResponse
/gt lt/messagegt
Note One or more parts in a message. Message
describe the content that will be sent in the
SOAP operation.
8WSDL PortTypes
ltportType name InventoryCheckServicegt
ltoperation name inventoryCheckgt ltinput
message intfinventoryCheckRequest /gt
ltoutput message
intfinventoryCheckResponse /gt
lt/operationgt lt/portTypegt
Note Operation can be one-way,
request-response, solicit-response, or
notification.
9WSDL Bindings
ltbinding name InvSoapBinding type
intfInventoryCheckServicegt ltbinding
style document transport
http//schema.xmlsoap.org/soap/http /gt
ltoperation name inventoryCheckgt ltinput
name inventoryCheckRequest /gt ltinput
name inventoryCheckResponse /gt
lt/operationgt lt/bindinggt
Note Underlying transport protocol.
10WSDL Service
ltservice name InventoryCheckServiceService
ltport binding intfInvSoapBinding name
InventoryCheckServicegt ltsoapaddress
location http//..... /gt
lt/portgt lt/servicegt
Note Each port definition identifies a single
address for a binding.
11SOAP Components
SOAP Envelope
- Wrapper for message content
SOAP Header - Optional
- Contains control information. Some example
include - date message was sent, routing or authentication
info.
SOAP Body
- Contains actual data
- Error reporting
12SOAP - XML
- lt?xml version"1.0"?gt
- ltsoap envelopegt
- ltsoap bodygt
- ltmethodgt
- ltparametersgtvalue1lt/parametersgt
- lt/methodgt
- lt/soap bodygt
- lt/soap envelopegt
13SOAP - Request
- lt?xml version"1.0"?gt
- ltsoap envelope .gt
- ltbodygt
- ltgetInventoryIdRequestgt
- ltinventoryIdgtabc123zyxlt/invento
ryIdgt - lt/getInventoryIdRequestgt
- lt/bodygt
- lt/soap envelopegt
14SOAP - Response
- lt?xml version"1.0"?gt
- ltsoap envelope .gt
- ltbodygt
- ltInventoryCheckResponsegt
- ltinventoryCountgt321lt/inventoryC
ountgt - lt/InventoryCheckResponsegt
- lt/bodygt
- lt/soap envelopegt
15Steps to Build Web Service?
- Basic Components
- Build a Service to provide that is capable of
handling the appropriate calls (i.e. java class
that can read a SOAP message request and send
SOAP response). - Build a WSDL to inform users how to access your
service. - Publish or share your WSDL with clients/users.
16Example of a Web Service
- Terra Server USA
- UPS Online Tracking Service
- Information Retrieval such as stock quotes or
weather conditions. - Keller Schroeder might use a web service to share
business logic between an ASP and Java
application.
17Java SAAJ API
- Use Java SAAJ API to create, send, and receive a
SOAP message. - It is a wrapper for XML parsing and can handle
HTTP calls. - Provides convenient methods for
accessing/creating a SOAP message. - Provides functionality for request/response SOAP
messages.
18What Can Be Done With WDSC?
- WSDC (WebSphere Development Studio Client for
iSeries) - Wizards make it easy to create and use web
services - Wizards create Web Services from Java Bean
(Java2WSDL) - Generates WSDL
- Creates all required components (XMLs)
- Creates a test client
- Wizards create Web Service from WSDL (WSDL2Java)
- Creates the Java classes required for the Web
Service - Creates all required components (XMLs)
- Wizards for creating a Web Service Client
19Resources Sites
- Resources
- W3C
- http//www.w3.org/TR/wsdl
- http//www.w3.org/TR/soap/
- IBM
- http//www-128.ibm.com/developerworks/webservices/
- MSDN
- http//msdn.microsoft.com/library/default.asp?url
/workshop/author/webservice/overview.asp - Wikipedia (SOAP, WSDL, UDDI)
- iSeries News (July2006)
- http//www.perfectxml.com/WebSvc3.asp
- Web Service Examples
- http//soapclient.com/soaptest.html (Test WSDL)
- http//www.xmethods.net/ (Many sample web
services)