What are Web Services?
Web services are XML-based information exchange systems that use the Internet for direct application-to-application interaction. Web services are application components which communicate using open protocols.
In simple terms a Web Service is an application or business logic that is accessible using standard Internet protocols.
How does Web Services work?
Web Services works on a simple rule of Consumer and Producer, where Consumer acts as a Client Application which is in of needs some information and Producer acts as information Provider application.
Consumer requests information or services from Producer , Producer, in turn, sends the info/services back to App1, who displays the information to the Client.
What are Web Services Components?
The basic platform for Web services is XML and HTTP.
UDDI-(Universal Description, Discovery and Integration): Web services can be discovered using UDDI. One can publish our application's functions to everyone.
WSDL-(Web Service Description Language): WSDL is an XML-based language for describing Web services. It describes the complete contract for Application Communication. Web services are widely approachable by using WSDL definitions to generate code(stub) that precisely knows how to interact with the Web service.
What are Implementation of Web Services?
Implementation of Web Services has two Approaches:
- Bottom to Top(Contract Last)Approach: Generating WSDL files from Implementation Classes (Learners Level)..
- Top to Bottom(Contract First) Approach: Real time, where interfaces and service classes will be created from WSDL (Better Approach).you start with the WSDL contract, and use Java to implement said contract.
What are the Types of Web Services?
Web services can be implemented in various ways. There are two important types of web services, which are:
- SOAP(Simple Object Access Protocol): It is communication protocol based on XML. JAX-WS APIs implemented for SOAP.
- RESTful Web Services: JAX-RS APIs provides the functionality for Representational State Transfer (RESTful) web services.
WSDL Elements mapping to Java:
| WSDL and XML construct | Java Construct |
|---|---|
| wsdl:targetNamespace(eg:http://example.com) | Package(name: com.example) |
| wsdl:service(where is the service located?-The service element defines the address for invoking the specified service). | Service Locator Class(Most commonly, this includes a URL for invoking the SOAP service). |
| wsdl:port which contains in the wsdl:service | Port accessor method in Service Locator Class. |
| wsdl:binding(The binding element provides specific details on how a portType operation will actually be transmitted over the wire). Style(attribute)=rpc(or)document. Use (attribute) =encoded (or) literal | STUB. Bindings can be made available via multiple transports, including HTTP GET, HTTP POST, or SOAP. |
| wsdl:port Type(what operations will be supported?) | Interface(SEI) |
| wsdl:operation | SEI Method |
| wsdl:message | The SEI method signature typically is determined by the wsdl:message |
| wsdl:message-input | Parameters |
| wsdl:message-output | Return |
| wsdl:message-fault | Throws |
| xsd:complexType | User defined exceptions,Java beans,Arrays |
| xsd:simpleType | Java bean properties ,Primitive types |
Next Article: RESTful Web services
For any questions, suggestions and feedback, Please write to us. Thanks for Reading :)
No comments:
Post a Comment