Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Web Service - Demo Oren Shamir Gal Moshitch Goals Set up the environment Create web service from scratch in VS.Net Test the web service View the auto generated WSDL Create a c# .Net client application Create a java client application Create a C client application using GSOAP Create a windows forms .net application that consumes Amazon web services Setup (server side) Requirements web server Web services infrastructure Accepts and send http messages Security mechanism Parsing SOAP requests and call the web methods Package return value as SOAP response and send it to the client Automatic creation of WSDL Aim - environment in which we can easily Create and deploy web services Publish web services Test web services Installation (server side) Install web server Install web services infrastructure Install and run a web server (IIS/Tomcat) Create a site for the web service To use ASP.Net – Install .Net framework To use Axis – install axis environment In windows almost everything can be done automatically using Visual Studio .Net Creating a Simple Web Service Environment Create a web service application (.asmx) Class inherits from WebService (optional) Create a Hello method IIS ASP.Net Visual Studio .Net Add [WebMethod] attribute Add a string argument to the method Use the http post to test the service Auto Generated WSDL Created and exposed by the web service infrastructure XML file that defines the web service <portType> - The operations performed by the web service <message> - The messages used by the web service <types> - The data types used by the web service <binding> -The communication protocols used by the web service Adding User Defined Types Define a new type Create a web service that uses the new type The new type must be serializable The type that the web service exposes includes all the serializable properties Publish the Web Service Using UDDI Universal Discovery, Description, and Integration visit the UDDI web site and register your service there Using DISCO – Microsoft tool for discovering web services Windows Forms .Net Client Create a new windows application using Visual Studio .Net Add a web reference to the project This will automatically generate proxy to the web service The proxy is actually generated using the a command line tool called wsdl.exe The proxy can be used to make synchronous and asynchronous requests. If the services uses a user defined type, a class for that type is also generated Java Client Application Axis provides tool for creating proxy to a web service according to the web service’s WSDL To create proxy run: java org.apache.axis.wsdl.WSDL2Java (WSDL-file-URL) The tool creates Class for each type Interface for all the portTypes A stub class for each binding A service interface and a service interface implementation for each service C Client Application GSOAP provides tools for web services Wsdl2h generates header file for the WSDL To create a pure c header run: wsdl2h –c <wsdl-file-or-url> -o <output-header> soapcpp2 creates a stub (client proxy to the server) and skeleton for the web service To create pure c sources run: soapcpp2 –c <header-file-name> Add a tester that will call the web service Include soapH.h and <server-name>.nsmap Call soap_init Call web service using the proxy functions Call soap_end and soap_done To compile the application run: gcc –o <output> <tester-file> soapC.c soapClient.c stdsoap2.c Creating an Amazon Client Add a web reference to Amazon WSDL http://soap.amazon.com/schemas2/AmazonWebServices.wsdl Use the proxy to Query Amazon products Manipulate the shopping cart etc...