Wednesday 25 July 2012

Procedure for Creating a Web Service at Client Side



Hi Friends..........

Previously we saw Overview of SOAP based Webservices and how to write the Web Service example.

I am sharing you how to develop a SOAP based webservice in WEBLOGIC 10.3  workshop and WEBLOGIC server for deployment.
(The procedure / structure of developing or using Webservices will be identical in many of the IDEs)

Lets see step by step procedure for developing a web Service at Client-side in-detail.

Creating a Client:


    1. Create a new Project. Either a normal 'Java project' or 'Web project'.

   2. Now you should create the artifacts of the Webservice, which helps for communication between the service and the client.
        This step is not related to the step 1.

           For generating artifacts, create a new 'ClientGen Web Service Client'.

   3. It will have two options for WSDL location:

  •        Local
  •        Remote

      Local :   If you select local option, then you have to browse the WSDL file which is generated from the service.
      Remote :   If you select remote option, then you have to provide the WSDL url.


         Then, click on 'Validate WSDL'. After finish button is enabled, then choose finish.
         Else, if you click on 'next' leave the default settings and click on 'finish'... ;)

     4. Then, a Jar file is generated in a 'Web service project'. It doesn't need to be a project where service is running. Actually, service not at all needed to be run on our machine.


    5. Copy the Jar file and place it in our Java project.
        Else, add that jar file in our Java project libraries.

   6. Till here the complete set-up is ready with you for communication between client and the server.
        Create a normal class and test the client.

   
      In this class, for sending request / getting response :

  • Create a Service
  • Get a port, to which you are going to communicate in that service
  • Invoke the method at that particular port
  • Collect the response and process it.
    All the class files which are needed to communicate with the service are automatically generated (i.e. at step 2, 3)

The request and response are sent and received in SOAP format. You need not to convert / write anything for SOAP. Automatically, those requests /  responses are converted.


1 comment:

  1. Very useful information that you have shared and it is very useful to me. Thanks for sharing the information with us.
    kindle mobi formatting services

    ReplyDelete