ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3144Web Services Operation…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3144

    Web Technologies

    Progress0 / 38 done
    Topics38
    1Introduction to Web Applications2TCP/IP Application Services
    3Basic Operation4Virtual Hosting5Chunked Transfers6Caching Support7Extensibility8SGML9HTML510CSS3
    11Core XML12XHTML13XHTML MP
    14SOAP15REST16WML17XSL
    18Operations19Processing HTTP Requests20Processing HTTP Responses21Cookie Coordination22Privacy and P3P23Complex HTTP Interactions24Dynamic Content Delivery25Server Configuration26Server Security27Web Browsers Architecture and Processes
    28JavaScript29DHTML30AJAX31JSON32Approaches to Web Application Development33Programming in Any Scripting Language34Search Technologies35Search Engine Optimization36XML Query Language37Semantic Web38Future Web Application Framework
    7 min read
    Topic 18 of 38
    Topic Study Note Illustration
    18

    Web Services: Operations

    In the context of web services, operations refer to the specific functions or actions that a web service can perform when it is invoked by a client....

    Web Services: Operations

    In the context of web services, operations refer to the specific functions or actions that a web service can perform when it is invoked by a client. These operations define the interaction between the client and the server, specifying what functionality is offered and how data is processed.

    Web services, whether SOAP-based or RESTful, expose a set of operations to allow clients to request data or perform actions. These operations are defined in service descriptions and are crucial for the client-server communication.

    Key Aspects of Web Services Operations

    1. SOAP-Based Web Services Operations

    In SOAP (Simple Object Access Protocol) web services, operations are defined in the WSDL (Web Services Description Language) document. WSDL serves as the contract between the client and the service, detailing the available operations, their input and output parameters, and the protocols that are supported.

    SOAP Operations typically follow a request-response pattern, where the client sends a request message, and the service responds with a message. Each operation in a SOAP web service corresponds to a specific action that the service can perform.

    Structure of SOAP Operation in WSDL

    In a WSDL file, an operation is defined within the <operation> tag inside the <portType> element. Each operation specifies its request and response messages, which are defined in the <message> element.

    Example of a WSDL operation:

    <definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://example.com/service">
        <portType name="BookService">
            <operation name="GetBookDetails">
                <input message="tns:GetBookDetailsRequest"/>
                <output message="tns:GetBookDetailsResponse"/>
            </operation>
        </portType>
        <binding name="BookServiceSoap" type="tns:BookService">
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
            <operation name="GetBookDetails">
                <soap:operation soapAction="http://example.com/GetBookDetails"/>
                <input>
                    <soap:body use="literal"/>
                </input>
                <output>
                    <soap:body use="literal"/>
                </output>
            </operation>
        </binding>
    </definitions>
    
    • Operation Name: The operation is named GetBookDetails and describes a specific action the service can perform (retrieving details about a book).
    • Input and Output: Each operation has defined input and output messages. For GetBookDetails, the request and response are defined in the messages GetBookDetailsRequest and GetBookDetailsResponse.
    Example SOAP Operation (Request-Response)

    When a client invokes a SOAP operation like GetBookDetails, it might send a request message in XML format, such as:

    Request (SOAP Envelope)

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://example.com/service">
        <soapenv:Header/>
        <soapenv:Body>
            <web:GetBookDetails>
                <web:BookID>12345</web:BookID>
            </web:GetBookDetails>
        </soapenv:Body>
    </soapenv:Envelope>
    

    The server processes the request and sends back a response:

    Response (SOAP Envelope)

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://example.com/service">
        <soapenv:Header/>
        <soapenv:Body>
            <web:GetBookDetailsResponse>
                <web:BookTitle>Introduction to Web Services</web:BookTitle>
                <web:Author>John Doe</web:Author>
                <web:Year>2023</web:Year>
            </web:GetBookDetailsResponse>
        </soapenv:Body>
    </soapenv:Envelope>
    

    2. RESTful Web Services Operations

    In REST (Representational State Transfer) web services, operations are mapped to HTTP methods (GET, POST, PUT, DELETE, etc.). Each HTTP method corresponds to a specific CRUD (Create, Read, Update, Delete) operation on the resources exposed by the service.

    REST is stateless, and each operation is performed by sending an HTTP request to a specific URL (or endpoint) that represents a resource. The response can be in various formats, such as XML, JSON, or plain text.

    Common REST Operations
    • GET: Retrieve data from the server (Read).
    • POST: Submit data to be processed by the server (Create).
    • PUT: Update existing data on the server (Update).
    • DELETE: Delete data from the server (Delete).
    Example of REST Operations

    Let's assume you have a RESTful web service for managing books, where each book is identified by a unique ID.

    • GET: Retrieve details of a book

      • Endpoint: /books/{id}
      • Example Request: GET /books/12345
      • Example Response (JSON):
        {
          "bookID": "12345",
          "title": "Introduction to Web Services",
          "author": "John Doe",
          "year": 2023
        }
        
    • POST: Create a new book

      • Endpoint: /books
      • Example Request:
        {
          "title": "Mastering REST",
          "author": "Jane Smith",
          "year": 2024
        }
        
      • Example Response (Status 201 Created):
        {
          "bookID": "67890",
          "title": "Mastering REST",
          "author": "Jane Smith",
          "year": 2024
        }
        
    • PUT: Update an existing book

      • Endpoint: /books/12345
      • Example Request:
        {
          "title": "Introduction to Web Services (Updated)",
          "author": "John Doe",
          "year": 2024
        }
        
      • Example Response (Status 200 OK):
        {
          "bookID": "12345",
          "title": "Introduction to Web Services (Updated)",
          "author": "John Doe",
          "year": 2024
        }
        
    • DELETE: Delete a book

      • Endpoint: /books/12345
      • Example Request: DELETE /books/12345
      • Example Response (Status 204 No Content)

    3. GraphQL Operations

    GraphQL is an alternative approach to traditional REST or SOAP web services. Instead of having predefined endpoints for specific actions (like GET or POST requests), GraphQL exposes a single endpoint that can handle a variety of operations through queries, mutations, and subscriptions.

    • Query: Retrieves data from the server.
    • Mutation: Changes data on the server.
    • Subscription: Enables real-time data updates.
    Example GraphQL Operations
    • Query: To get details of a book by ID
    query {
      book(id: 12345) {
        title
        author
        year
      }
    }
    
    • Mutation: To create a new book
    mutation {
      createBook(title: "New Book", author: "Jane Doe", year: 2024) {
        id
        title
        author
      }
    }
    
    • Subscription: To get real-time updates when a new book is added
    subscription {
      newBook {
        id
        title
      }
    }
    

    Key Features of Web Service Operations

    1. Encapsulation of Functionality: Operations expose specific functionality that clients can invoke remotely, abstracting the underlying implementation.
    2. Interoperability: Operations in web services are designed to work across different platforms, technologies, and programming languages, enabling diverse systems to communicate.
    3. Data Exchange: Web service operations define the format for data exchange, which can range from XML (in SOAP) to JSON (in REST).
    4. Statelessness (in REST): RESTful operations are stateless, meaning each request is independent, and no session information is stored between requests.
    5. Security: Operations often include mechanisms for authentication and authorization, such as API keys in REST or WS-Security in SOAP.

    Conclusion

    Web service operations are the core functions that enable clients to interact with web services. They define the actions that can be performed on the server-side, whether retrieving data, modifying resources, or performing specific business logic. The operation details, including input parameters, output formats, and communication protocols (SOAP, REST, or GraphQL), are key to defining how the client and server communicate in web service-based architectures. Understanding web service operations is essential for designing and consuming effective APIs, ensuring seamless data exchange and application integration.

    ← Previous topic 17
    Web Service: XSL
    Next topic 19 →
    Web Services: Processing HTTP Requests

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    7mremaining
    1.1kwords
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Web Technologies