Assignment Document

PHP Client and Server Web Service Design

Pages:

Preview:


  • " SOAP Table of ContentsTask 1 ........................................................................................................................................................... 1Task 2 .........................................................

Preview Container:


  • " SOAP Table of ContentsTask 1 ........................................................................................................................................................... 1Task 2 ........................................................................................................................................................... 3References .................................................................................................................................................... 6Task 1PHP Client and Server Web Service Design, Implementation and OperationWeb services are widely used by all the organizations. Across many platforms andha rdw a re ?s, the web services are used to allow sharing of data. Many scripting languages areused to create the web services. The scripting language PHP is one of the most powerfullanguage with open source functions and tools. There are three methods used for producing andconsuming web services. They are SOAP, XML-RPC and REST(David, 2017).This assignment needs to implement the SOAP based web service. The request andresponse of the web services are designed by the SOAP service. This services are designed as anXML wrapper. The SOAP service has the advantage of using the XML schema data types andnamespaces in the coding lines. PHP platform has the powerful API that developed forimplementing the web services. This API is helpful to develop the client and server web services.The developed API is called as NuSOAP. This NuSOAP has many features. One of the mainfeature is built-in WSDL support. 1 SOAP ClientWith the help of library files, the client and the server web services creation is so easy. Inthis assignment, the web service needs to implement the function with XQuery which takes oneparameter and returns the results as a string that describes the output of the query. The command„require_once ? is used to bring the specified library file at once in the script. The belowcommand specifies the usage of nusoap library file.<?require_once('nusoap.php'); After accessing the library, define the location of WSDL where it is used. Then createinstance of the class “soapclient ”. This instance is used to access the web service. Then send the query as parameter to get the particular name with the help of searching anidentity (id) of the student. The function used for this web service is "getstudentname". Theparameter is passed by the function and the response is got from the remote server. After that theresponse is displayed to the user(David, 2017). echo $client->call('getstudentname', $param);The above command is the client call function with the parameter and the function thatpass to the remote server.$this->instance->soapcall('getstudentname', $id_array);In our function, the parameter is the student id that is passed by the query. SOAP ServerFirst the server needs to connect the client request and then send response to the client. public function constrct(){$this->con = (is_null($this->con)) ? self::connect(): $this->con;}2 The above constructor function is used to create the proxy client. Then, the belowconnect function is used to connect the eXist database into the web service(Webdam.inria.fr,2017). $db = new eXistAdmin('guest', 'guest', 'http://127.0.0.1:8080/exist/services/Admin?wsdl');$db->connect() or die ($db->getError());PheXist is defined as a set of classes. These classes are used to implement the queries onthe eXist database. This PheXist features are also used to manipulate the XML documents. Theexample methods which are used in the PheXist classes are connect(), constructor(), getError(),xquery(), and so on(David, 2017).Task 2SOAPSOAP- the acronym of SOAP is Simple Object Access Protocol, is used to perform XMLbased exchanges of messages, it is a standard protocol specification. Using XML messages thecommunication is made between the server and the client. The XML messaging format includesthe processing phenomenon, various signs and convention inorder to represent the calls andresponses for remote procedures and rules forapplication-defined and standard data typeencoding that is defined by SOAP(Tsenov, 2017).There are three major units, that grouptogether to form a SOAP protocol. They are listedbelow.? In the application process, the data exchange is deflated by a set of rules.? The process involved in obtaining relevant solution for the problems of various procedureis known as remote procedure calls and is represented in a format.? The usage of message and the data in the messages is reported by an envelope.Under SOAP there is a language called WSDL(Web Service Description Language). InXML, the network services are described as a set of end points based on the document-oriented3 messages using WSDL.WSDL is basically an XML format. In order to initiate an endpoint, thereis a description made for the operations and messages continued with concrete network protocolbounding and message formatting.There is a combination of related end points with the abstractend points. Disobeying communication network protocols, end points message and description isallowed by WSDL.Web services architecture:Various steps are used to define Web service architecture and that are listed below:? WSDL File and SOAP service client is being called by the calling applications such asinternet explorer, Mozilla and by various different applications.? The service in SOAP is done by caring out various parameters which is functioned at thetime, when the SOAP request is received by SOAP service provider, „Soap_parser_classparses ? that determines the calling function and the parameter for the SOAP request. Thisis executed on the server and the result for the request is returned.? The SOAP client class is located in the XML class of SOAP extension, from which aSOAP request is sent to the server.? There are different classes located under the XML class performing different functions inthe web services architecture(Tsenov, 2017).Fig 1. Structure of Web Services Architecture4 Software implementation of Web services architecture:The concept involved in submission, upload and review of conferencing the web systemis achieved through software implementation.A CGI script language is used as a programminglanguage for the software implementation of web services. The definition for the example islisted below.It is necessary to collect some data about the SOAP service, so that the SOAP clientcan be defined at the start, when the SOAP service is provided. The data that has to be collectedare listed below:1. SOAP action header value of the method? Input and output parameter names and types.? Namespace URI for the methods.? Endpoint URL where the service is running.? Method name.2. Second TaskAfter the completion of the first step, move on to the second step, were it is necessary tocreate WSDL document. This document contains some format that helps to find by the clientrequest. With the help of two messages, a structure is created below. The structure was created ina WSDL document.A message deals with both request and response of data. At the beginning, the datarequest is received (i.e.) getDataRequest which occupies a single string parameter named assymbol. on the other hand, the response for the request (i.e.) the result to be obtained, which isgot bygetDataResponse, that contains a single float value.The operation of the message for the request and response is operated and defined underthe port Type section. The transmission process of sending the message is done by sending anRPC request and the message is encoded across HTTP. 3. Third TaskTo perform various tasks under the web system such as uploading, submission, andreviewing a development is done in the web system5 Soap_parser_class,Soap_transport_http_class. The integrationis done in web service architecture.Since, the URL is present in service section, all the resources of the files should be located in thesame area.The code file is attached below:ReferencesDavid, J. (2017). Creating and Consuming Web Services With PHP. [online] Xml.com.Available at: https://www.xml.com/pub/a/ws/2004/03/24/phpws.html [Accessed 16 Mar. 2017].Tsenov, M. (2017). Web Services Example with PHP/SOAP. [online] Available at:http://www.visp-project.org/docs/publications/CompSysTech.pdf [Accessed 16 Mar. 2017].Webdam.inria.fr. (2017). Managing an XML Database with eXist. [online] Available at:http://webdam.inria.fr/Jorge/html/wdmch6.html [Accessed 16 Mar. 2017].6 "

Related Documents

Start searching more documents, lectures and notes - A complete study guide!
More than 25,19,89,788+ documents are uploaded!

Why US?

Because we aim to spread high-quality education or digital products, thus our services are used worldwide.
Few Reasons to Build Trust with Students.

128+

Countries

24x7

Hours of Working

89.2 %

Customer Retention

9521+

Experts Team

7+

Years of Business

9,67,789 +

Solved Problems

Search Solved Classroom Assignments & Textbook Solutions

A huge collection of quality study resources. More than 18,98,789 solved problems, classroom assignments, textbooks solutions.

Scroll to Top