Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have modified an HTTP server to implement within the server all the services

ID: 440040 • Letter: Y

Question

You have modified an HTTP server to implement within the server all the services usually implemented outside the server by CGI. Is it more appropriate to implement access to the new internal services using WSDL-SOAP or REST? Justify your answer.

Explanation / Answer

!perl -w use SOAP::Transport::HTTP; SOAP::Transport::HTTP::CGI -> dispatch_to('Demo') -> handle; package Demo; sub hi { return "hello, world"; } sub bye { return "goodbye, cruel world"; } There are basically two parts to this: the first four lines set up a SOAP wrapper around a class. Everything from 'package Demo' onward is the class being wrapped. In the previous version of the SOAP specification (1.0), SOAP over HTTP was supposed to use a new HTTP method, M-POST. In practice, there are many web servers that don't understand the M-POST method so this requirement was weakened and now it's common to try a normal POST first and then use M-POST if the server needs it. If you don't understand POST and M-POST, don't worry, you don't need to know all about it to use the module. Writing a Client This program prints the results of the hi() method call: 1.a. client (hibye.pl) #!perl -w use SOAP::Lite; print SOAP::Lite -> uri('http://www.soaplite.com/Demo') -> proxy('http://services.soaplite.com/hibye.cgi') -> hi() -> result; The uri() identifies the class on the server, and the proxy() identifies the CGI script that provides access to the class. Since both look like URLs, I'll take a minute to explain the difference, as it's quite important. proxy() proxy() is simply the address of the server to contact that provides the methods. You can use http:, mailto:, even ftp: URLs here. uri() Each server can offer many different services through the one proxy() URL. Each service has a unique URI-like identifier, which you specify to SOAP::Lite through the uri() method. If you get caught up in the gripping saga of the SOAP documentation, the 'namespace' corresponds to the uri() method. Run your client and you should see:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote