Friday, March 15, 2019

1. Compare and contrast web applications with web services, indicating the need for web services 



web applications
Web applications are defined by being interactive. You're supposed to use a web application in order to perform a function and use some of the web applications features. Lots of web applications don't even have real informative content or data exactly. People are just supposed to use them in order to perform additional tasks, using their features to accomplish something. You use a web application to check your incoming messages, for instance, or play a game.
web services
Web service is a technology by which two or more remote web applications interact with each other over network/internet. It can be implemented using Java, .net, PHP etc. Web pages allow people to communicate and collaborate with each other while web services allow programs to communicate and collaborate with each other.

2. Discuss what WSDL is and the use of it in the context of web services 
The Web Services Description Language (WSDL) is an XML-based language used to describe the services a business offers and to provide a way for individuals and other businesses to access those services electronically. WSDL is the cornerstone of the Universal Description, Discovery, and Integration (UDDI) initiative spearheaded by Microsoft, IBM, and Ariba. UDDI is an XML-based registry for businesses worldwide, which enables businesses to list themselves and their services on the Internet. WSDL is the language used to do this.
3. Explain the fundamental properties of a WSDL document and the use of WSDL document in web services and client development 
web services and client 
WSDL is often used in combination with SOAP and XML Schema to provide web services over the Internet. A client program connecting to a web service can read the WSDL to determine what functions are available on the server. Any special datatypes used are embedded in the WSDL file in the form of X
4. Discuss the structure of the WSDL document, explaining the elements in WSDL 
A WSDL document contains the following seven elements which are used to describe the services:
  1. types – The types element defines the data types that are used in web services. The types element is a container for XML Schema type definitions.
  2. message – The message element describes the data being exchanged between the web service and the client
  3. operation – A message exchange is represented in the form of operation. It is an abstract description of an action. The operation refers to one or more messages.
  4. portType – The portType elements refers to a collection of operations supported by one or more endpoints.
  5. binding – The binding element specifies the concrete protocol and data format specification used by the service. The binding can be made with protocols like SOAP, HTTP GET and HTTP POST and they have the information on location of the web services.
  6. port – The port elements defines a single communication endpoint for the binding. This provides the address for binding. The endpoint is a combination of a binding and an address
  7. service – The service element is a collection of related endpoints (port).

       
5. Compare the PortType and operation elements in WSDL with the java equivalences  
The <portType> element combines multiple message elements to form a complete oneway or round-trip operation.
For example, a <portType> can combine one request and one response message into a single request/response operation. This is most commonly used in SOAP services. A portType can define multiple operations.
Lets take a piece of code from the Example Session:


<portType name="HelloWorld_PortType">
      <operation name="sayHelloWorld">
         <input message="tns:SayHelloRequest"/>
         <output message="tns:SayHelloResponse"/>
      </operation>
   </portType>

  • The portType element defines a single operation, called sayHelloWorld.
  • The operation itself consists of a single input message SayHelloRequest
  • The operation itself consists of a single output message SayHelloResponse
6. Compare and contrast the binding and service elements in WSDL 


BindingWSDL Binding to SOAP. WSDLbindings defines the message format and protocol details for a web service. The binding element has two attributes - name and type. ... The soap:binding element has two attributes - style and transport.

Service elements
<types>
Defines the (XML Schema) data types used by the web service
<message>
Defines the data elements for each operation
<portType>
Describes the operations that can be performed and the messages involved.
<binding>
Defines the protocol and data format for each port type

7. Explain how SOAP is used with HTTP 
SOAP is an integral part of the service-oriented architecture (SOA) and the Web servicesspecifications associated with SOA. Because it allows the sender to create a message route based on the logical services that have to be applied to the message on the way to its destination, it lends itself to providing secure and compliant connections, controlling access, offering reliable delivery and failure recovery, and supporting dynamic service discovery. SOA without SOAP is difficult to imagine.
SOAP’s messages are defined at a high level in XML, but most SOAP applications use Web Services Definition Language (WSDL), which is authored in XML.  The XML structure of SOAP makes it handy for applications that expect their information to be provided in XML form, and the fact that SOAP can ride on a variety of network protocols, including HTTP, means it’s easily passed through firewalls, where other protocols might require special accommodation.
The data structure of SOAP is based on XML, which is similar in many ways to the HTML used to define web pages. Like HTML, XLM is largely human-readable, which makes it fairly easy to understand a SOAP message, but also makes the messages relatively large in comparison to the Common Object Request Broker Architecture (CORBA) and its Remote Procedure Call (RPC) protocol that will accommodate binary data.
The biggest disadvantage of SOAP (and SOA overall) is that it’s a heavyweight protocol for a heavyweight architecture.  The notion of a message passing through a string of nodes to be processed by each seems to mix protocols and service bus architectural models for software, and neither of those two are considered optimal for microservice-based development as popularly used today.
8. Discuss how SOAP can be used for functional oriented communication?  
SOAP ( Simple Object Access Protocol) is a message protocol that allows distributed elements of an application to communicate. SOAP can be carried over a variety of lower-level protocols, including the web-related Hypertext Transfer Protocol .  SOAP defines a header structure that identifies the actions that various SOAP nodes are expected to take on the message, in addition to a payload structure for carrying information. The concept of routing a message through a string of nodes that perform different functions is how SOAP supports things like addressing, security and format-independence. Essentially, the headers identify roles, which in turn provide the SOA features which SOAP then routes to. Stringing messages through a sequence of steps is uncommon in today’s micro service-centric development environments.
9. Discuss the importance of the SOAP attachments, explaining the MIME header 
When SOAP attachments are used as specified in [SwA] each SOAP message is accompanied by a MIME header and possibly multiple boundary parts. This is known as a SOAP message package. This document assumes that a proper SOAP message package is constructed using the HTTP and MIME headers appropriate to [SwA].
The primary SOAP envelope SHOULD be conveyed in the first MIME part, but MAY be conveyed in another MIME part when the start attribute is specified in the HTTP Multipart/Related header.
In particular, implementations should take care in distinguishing between the HTTP headers in the SOAP message package and the start of the SOAP payload. For example, the following  Multipart/Related header belongs to the HTTP layer and not the main SOAP payload:
Content-Type: Multipart/Related; boundary=xy1; type=”text/xml”; start="<foo>"
The main SOAP payload begins with the appropriate boundary. For example:

 --xy1
Content-Type: text/xml; charset=utf-8
Content-ID: <foo>

<?xml version='1.0' ?>
<s11:Envelope xmlns:s11=”http://schemas.xmlsoap.org/soap/envelope/” />

                             

10. Identify different set of frameworks/libraries for SOAP web service development, in different environments (Java, .Net, PHP, etc…) 
Java
WS-Reliable Messaging, WS-Security, WS- Atomic Transaction, WS-Addressing, MTOM, WS-Policy, WS-Metadata Exchange

.Net
WS-Addressing, WS-Metadata Exchange, WS-Security, WS-Policy, WS-Security Policy, WS-Trust, WS-Secure Conversation, WS-Reliable Messaging, WS-Coordination, WS-Atomic Transaction,WS-Discovery

PHP
SOAP MTOM, WS-Addressing, WS-Security, WS-Security Policy, WS-Secure Conversation, WS-Reliable Messaging

C and C++
WS-Addressing, WS-Discovery, WS-Policy, WS-Reliable Messaging, WS-Security, WS-Security Policy.

11. Explain the annotations in JAX-WS, providing examples of their use 
Java API for XML Web Services (JAX-WS) is one of a set of Java technologies used to develop Web services. JAX-WS belongs to what Sun Microsystems calls the "core Web services" group. Like most of the core group, JAX-WS is typically used in conjunction with other technologies. Those other technologies may also come from the core Web services group (JAXB, for example), as well as from enhanced Web services (WSIT), secure Web services (WSIT, WS-Security), legacy Web services (JAX-RPC), and systems management services (WS-Management) groups.
JAX-WS is a fundamental technology for developing SOAP (Simple Object Access Protocol) and RESTful (Web services that use representational state transfer, or REST, tools) Java Web services, where JAX-WS is designed to take the place of the JAVA-RPC (Remote Procedure Call) interface in Web services and Web-based applications. JAX-WS is also used to build Web services and corresponding clients that communicate using XML to send messages or use remote procedure calls to exchange data between client and service provider.
These are the basic steps for creating the web service and client:


  1. Code the implementation class.

  2. Compile the implementation class.

  3. Deploy the WAR file. The tie classes (which are used to communicate with clients) are generated by the Application Server during deployment.

  4. Code the client class.

  5. Use ws import to generate and compile the stub files.

  6. Compile the client class.

  7. Run the client.
12. Discuss how a web service can be tested using different approaches (using a dummy client or a dedicated tool, etc…) 
Web Testing in simple terms is checking your web application for potential bugs before its made live or before code is moved into the production environment.

During this stage issues such as that of web application security, the functioning of the site, its access to handicapped as well as regular users and its ability to handle traffic is checked.
  1. Unit testing
  2. Functional testing of web services
  3. Integration testing of web services
  4. Performance testing
Reffercance 

https://subscription.packtpub.com/book/web_development/9781849515665/1/ch01lvl1sec14/approaches-of-testing-web-services#!
    https://searchmicroservices.techtarget.com/definition/Web-Services-Description-Language-WSDL
      https://javaninja.io/question/explain-the-structure-of-a-wsdl-document/
        https://www.dineshonjava.com/wsdl-porttype-element/
          http://docs.oasis-open.org/wss-m/wss/v1.1.1/os/wss-SwAProfile-v1.1.1-os.html#_Toc307412696