![Page 1: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/1.jpg)
AUTHOR: HAI NGUYENCREATED DATE: 04 /11 /2008
Web Service Introduction
![Page 2: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/2.jpg)
Agenda
Web Service Introduction What is Web Service? Why Web Service?
XML and SchemaWeb Service: Style of UseWeb Service interactionsWeb Service elements
SOAP WSDL
Web service development
![Page 3: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/3.jpg)
WHAT IS WEB SERVICE?
WHY WEB SERVICE?
Web Service Introduction
![Page 4: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/4.jpg)
What is Web Service
A Software system designed to support interoperable Machine to Machine interaction over network
They are the Web APIs are hosting in machine that can be invoked by remote machine
The basic platform of Web services is Http + XML
![Page 5: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/5.jpg)
Why web service?
Interoperability is the highest prioritySimple use
![Page 6: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/6.jpg)
XMLSCHEMA
XML and Schema
![Page 7: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/7.jpg)
XML
All of you already knows XML! It is very popular now and be used everywhere
We only talk some advance feature of XML
![Page 8: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/8.jpg)
XML namespaces
Namespace is used to solve conflicts between XML element
Example 1: Conflicts of Address information<root>
<address> <name>Nextss</name>
<street>123 ABC</street> <city>HCM</city>
<country>VN</country> </address> <address> <name>Google</name> <street>123 ABC</street> <city>ABC</city> <state>ABC</state> <zipcode>xxx-xxx-xxxx</zipcode> </address></root>
![Page 9: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/9.jpg)
XML namespaces
The namespace is defined by the xmlns attribute in the start tag of an element.
The namespace declaration has the following syntax. xmlns:prefix="URI".
![Page 10: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/10.jpg)
XML namespaces
Example 2: Solve conflicts in data<root>
<vn:address xmlns:vn=“http://www.nextss.com/schema/vnAddress”> <vn:name>Nextss</vn:name>
<vn:street>123 ABC</vn:street> <vn:city>HCM</vn:city>
<vn:country>VN</vn:country> </vn:address> <us:address xmlns:us=“http://www.nextss.com/schema/usAddress”> <us:name>Google</us:name> <us:street>123 ABC</us:street> <us:city>ABC</us:city> <us:state>ABC</us:state> <us:zipcode>xxx-xxx-xxxx</us:zipcode> </us:address></root>
![Page 11: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/11.jpg)
XML encoding
XML can contains non Ascii characters like Vietnamese language
The encoding errors can happen in case: XML contains non ASCII characters, and the file was
saved as single-byte ANSI (or ASCII) with no encoding specified.
Encoding specified in XML is invalid: XML file was saved as double-byte Unicode (or UTF-16) with a single-byte encoding (Windows-1252, ISO-8859-1, UTF-8) specified.
![Page 12: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/12.jpg)
XML
SCHEMA
XML and Schema
![Page 13: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/13.jpg)
XML Schema
XML Schema is an XML-based to describe the structure of XML document
The XML Schema language is also referred to as XML Schema Definition (XSD)
![Page 14: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/14.jpg)
XML Schema
XML Schema defines: Elements that can appear in a document Attributes that can appear in a document Which elements are child elements The order of child elements The number of child elements Whether an element is empty or can include text Data types for elements and attributes Default and fixed values for elements and attributes
![Page 15: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/15.jpg)
XML Schema
Example: Xml file “Note.xml”:<?xml version="1.0"?> <note>
<to>Tove</to> <from>Jani</from>
<heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
![Page 16: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/16.jpg)
XML Schema
An XML Schema “note.xsd”:<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.nextss.com" xmlns="http://www.nextss.com" elementFormDefault="qualified"><xs:element name="note"><xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
![Page 17: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/17.jpg)
XML Schema
Validate XML by using XML Schema<?xml version="1.0"?>
<note xmlns="http://www.nextss.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nextss.com note.xsd">
<to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body>
</note>
![Page 18: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/18.jpg)
REMOTE PROCEDURE CALLS (RPC)
RESOURCE ORIENTED
MESSAGING
Web Service: Styles of Use
![Page 19: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/19.jpg)
Style Of Uses
![Page 20: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/20.jpg)
Web Services RPC
RPC Web services present a distributed function (or method) call interface that is familiar to many developers. Typically, the basic unit of RPC Web services is the WSDL operation.
SOAP using a synchronous RPC programming approach and, typically, generated 'skeletons/stubs' and some sort of Object-to-XML marshalling technology
![Page 21: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/21.jpg)
Web Service Resource Oriented
A client-server based resource-oriented pattern where the server-side provides a representation of a set of resources (often hierarchical) and exposes Create, Read, Update and Delete capabilities for these resources to client programs.
REST or 'RESTful Web Services' or ROA, re-using World-Wide-Web based approaches and standards like HTTP and URIs
![Page 22: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/22.jpg)
Web Service Messaging
Messages or documents are passed asynchronously between peer systems in either, but not always both, directions.
SOAP using an asynchronous Message/Document passing approach where invariably the documents are defined by schemas and, often, the use of message-level (rather than transport-level) security elements is required
![Page 23: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/23.jpg)
RPC INTERACTIONS
DOCUMENT INTERACTIONS
Web Service Interactions
![Page 24: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/24.jpg)
RPC Interactions
![Page 25: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/25.jpg)
RPC Interactions
The web service is viewed by the consumer as a single logical application or component with encapsulated data, where the WSDL described by the publicly-exposed interface
The messages directly map onto input and output parameters of the procedure calls or operations
![Page 26: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/26.jpg)
RPC INTERACTIONS
DOCUMENT INTERACTIONS
Web Services Interactions
![Page 27: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/27.jpg)
Document Interactions
![Page 28: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/28.jpg)
Document Interactions
The service consumer interacts with the service using documents that are meant to be processed as complete entities
These exchanged documents typically take the form of XML, which is defined by a commonly agreed upon schema between the service provider and service consumer
The exchanged document represents a complete unit of information and may be completely self-describing
![Page 29: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/29.jpg)
SOAPWSDL
Web Service Elements
![Page 30: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/30.jpg)
SOAP
SOAP stands for Simple Object Access Protocol
SOAP is the transport methodSOAP is the format of sending messageSOAP is platform and language independentSOAP is XML-based formatSOAP is simple and extensible
![Page 31: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/31.jpg)
SOAP
Skeleton of SOAP message<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Header> ... ... </soap:Header> <soap:Body> ... ... <soap:Fault> ... ... </soap:Fault> </soap:Body> </soap:Envelope>
![Page 32: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/32.jpg)
SOAP
WSDL
Web Service Elements
![Page 33: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/33.jpg)
WSDL
WSDL stands for Web Services Description Language
WSDL is written in XML WSDL is an XML document WSDL is used to describe Web services WSDL is also used to locate Web services
![Page 34: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/34.jpg)
WSDL
- Types
- Message
- PortType
- Binding
WSDL Document Structure
<types> The operations performed by the web service
<message> The messages used by the web service
<portType> The data types used by the web service
<binding> The communication protocols used by the web service
![Page 35: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/35.jpg)
WSDL Types
The <types> element defines the data type that are used by the web service.
For maximum platform neutrality, WSDL uses XML Schema syntax to define data types.
![Page 36: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/36.jpg)
WSDL Messages
The <message> element defines the data elements of an operation.
Each message can consist of one or more parts. The parts can be compared to the parameters of a function call in a traditional programming language.
![Page 37: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/37.jpg)
WSDL Ports
The <message> element defines the data elements of an operation.
Each message can consist of one or more parts. The parts can be compared to the parameters of a function call in a traditional programming language.
![Page 38: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/38.jpg)
WSDL Ports
Operation Types
One-way The operation can receive a message but will not return a response
Request-response The operation can receive a request and will return a response
Solicit-response The operation can send a request and will wait for a response
Notification The operation can send a message but will not wait for a response
![Page 39: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/39.jpg)
SOAP Bindings
The <binding> element defines the message format and protocol details for each port.
Example:<soap:binding style="document“
transport=http://schemas.xmlsoap.org/soap/http> <operation> <soap:operation soapAction="http://example.com/getTerm”> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding>
![Page 40: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/40.jpg)
SOAP Bindings
The soap:binding element has two attributes - the style attribute and the transport attribute.
The style attribute can be "rpc" or "document". The transport attribute defines the SOAP protocol to use.
The operation element defines each operation that the port exposes.
For each operation the corresponding SOAP action has to be defined. You must also specify how the input and output are encoded.
![Page 41: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/41.jpg)
SOAP Bindings
A WSDL SOAP binding can be either a Remote Procedure Call (RPC) style binding or a document style binding. A SOAP binding can also have an encoded use or a literal use. There are four style/use models: RPC/encoded RPC/literal Document/encoded Document/literal
![Page 42: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/42.jpg)
SOAP Bindings Example
We have the service interface
@WebService(name="HelloWorld“, targetNamespace="http://spring.demo/") @SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL)
public interface HelloWorld {String sayHi(@WebParam(targetNamespace="http://spring.demo/",
name="text")String text);}
![Page 43: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/43.jpg)
SOAP Bindings Example
WSDL file for service interface:
<wsdl:binding name="HelloWorldImplServiceSoapBinding" type="tns:HelloWorld"> <soap:binding style="document”
transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="sayHi"> <soap:operation soapAction="" style="document"/> <wsdl:input name="sayHi"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="sayHiResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding>
![Page 44: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/44.jpg)
SOAP Bindings Example
SOAP Request with RPC/Encoded Format <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <sayHi xmlns="http://spring.demo/"> <text xmlns="">Viet Nam</text> </sayHi> </s:Body> </s:Envelope>
SOAP Response with RPC/Encoded Format <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:sayHiResponse xmlns:ns1="http://spring.demo/"> <return>Hello Viet Nam</return> </ns1:sayHiResponse> </soap:Body> </soap:Envelope>
![Page 45: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/45.jpg)
SOAP Bindings Example: RPC/Literal
WSDL with RPC/Literal Format <wsdl:message name="sayHiResponse"> <wsdl:part name="return" type="xsd:string"> </wsdl:part> </wsdl:message> <wsdl:message name="sayHi"> <wsdl:part name="text" type="xsd:string"> </wsdl:part> </wsdl:message>
![Page 46: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/46.jpg)
SOAP Bindings Example: RPC/Literal
SOAP Request with RPC/Literal Format <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:sayHi xmlns:ns1="http://spring.demo/"> <text>Viet Nam</text> </ns1:sayHi> </soap:Body> </soap:Envelope>
SOAP Response with RPC/Literal Format <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:sayHiResponse xmlns:ns1="http://spring.demo/"> <return>Hello Viet Nam</return> </ns1:sayHiResponse> </soap:Body> </soap:Envelope>
![Page 47: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/47.jpg)
SOAP Bindings Example: Document/Literal
WSDL file for Document/Literal Format <wsdl:types> <xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified“
targetNamespace="http://spring.demo/"> <xsd:element name="sayHi" type="tns:sayHi"/> <xsd:complexType name="sayHi"> <xsd:sequence> <xsd:element minOccurs="0" name="text" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="sayHiResponse" type="tns:sayHiResponse"/> <xsd:complexType name="sayHiResponse"> <xsd:sequence> <xsd:element minOccurs="0" name="return" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </wsdl:types> <wsdl:message name="sayHiResponse"> <wsdl:part element="tns:sayHiResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="sayHi"> <wsdl:part element="tns:sayHi" name="parameters"> </wsdl:part> </wsdl:message>
![Page 48: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/48.jpg)
SOAP Bindings Example: Document/Literal
SOAP Request with Document/Literal Format <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <sayHi xmlns="http://spring.demo/" xmlns:i="http://www.w3.org/2001/XMLSchema-
instance"> <text xmlns="">Viet Nam</text> </sayHi> </s:Body> </s:Envelope>
SOAP Response with Document/Literal Format
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:sayHiResponse xmlns:ns1="http://spring.demo/"> <return>Hello Viet Nam</return> </ns1:sayHiResponse> </soap:Body> </soap:Envelope>
![Page 49: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/49.jpg)
Decision on the formatting style
Validate business documents: service is accepting or returning a complex XML structure, a document style is better suited, since the XML can be validated against the schema prior to calling the service.
Performance and memory limitations: Marshalling and un-marshalling parameters to XML in memory can be an intensive process
![Page 50: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/50.jpg)
Decision on the formatting style
Interoperability: using RPC style can causes interoperability issues across platforms. To facilitate interoperability, the WS-I Basic Profile limits the use of the encoding (RPC-encoded or document-encoded) and encourages a literal formatting (document-literal or RPC-literal style)
![Page 51: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/51.jpg)
TWO APPROACHES OF DEVELOPING SERVICES
WEB SERVICE DEBUGGING
Web Service Development
![Page 52: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/52.jpg)
Two approaches of developing web service
-- Code first
-- WSDL first
Code first: write the business code and web service engine will generate the WSDL by itself at compile time or runtime
WSDL first: write the WSDL first before writing interface and business code for service.
Note: Each approach has both advantages and disadvantages!
![Page 53: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/53.jpg)
Code First
Advantage: Time of writing code is reduced. Developers mostly
focus on code only.Disadvantage:
Less interoperable among platforms/programming language! Example: - .NET client program could not invoke the web service
written in Java language - Java client program (use Axis framework) could not
invoke web service written in Java language (use Cxf framework)
![Page 54: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/54.jpg)
WSDL First
Advantage: More interoperable among platforms/programming
language!Disadvantage:
Time of development is greater than Code first approach (includes manual update WSDL while service change)
![Page 55: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/55.jpg)
Web Service Debugging
Log filesDebugging Tools
TCP Monitor: WSMonitor: https://wsmonitor.dev.java.net/ Tcpmon: https://tcpmon.dev.java.net/ Wireshark: http://www.wireshark.org/ Eclipse IDE
Functional Testing: SOAP UI: http://www.pushtotest.com/ PushToTest: http://www.pushtotest.com/
![Page 56: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/56.jpg)
References
[1]. Web service - http://en.wikipedia.org/wiki/Web_service
[2]. Web Service Tutorial - http://www.w3schools.com/webservices/default.asp
[3]. SOAP Tutorial - http://www.w3schools.com/soap/default.asp
[4]. WSDL Tutorial - http://www.w3schools.com/wsdl/default.asp
[5]. Russel, Butek - Which style of WSDL should I use? http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
![Page 57: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/57.jpg)
References
[6]. Sameer Tyagi - Patterns and Strategies for Building Document Based Web Services –http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns/
[7]. Sameer Tyagi - Interoperability With Patterns and Strategies for Document Based Web Services - http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns2/index.html
[8]. Paul Done - Web Services: RPC, REST and Messaging - http://dev2dev.bea.com/blog/pdone/archive/2008/02/web_services_rp.html
![Page 58: AUTHOR: HAI NGUYEN CREATED DATE: 04/11/2008 Web Service Introduction](https://reader035.vdocuments.mx/reader035/viewer/2022070409/56649e975503460f94b9a79d/html5/thumbnails/58.jpg)
References
[10], Representational State Transfer - http://en.wikipedia.org/wiki/Representational_State_Transfer