Consuming the contact web service

Introduction

This document is to show how the contact web service created with XFire and Spring is consumed by a desktop client.In this tutorial, you will need Netbeans 6.1/6.0.

Creating the Project

1. Choose File >New Project, Under Java select Java Application.

Set Project name : ContactClient and Set the Project Location.

Uncheck “Use Dedicated Folder for Storing Libraries if check.

Uncheck “Create Main Class”

2.Next we have to create the web service client, so deploy the ContactService web application.

3.Right click the project “ContactClient”,choose New >Other .Under Web Services Category,select Web Service Client.

Specify the WSDL file of the Web Service :

set the WSDL URL :http://localhost:8080/ContactService/services/contactService

Check “Generate Dispatch code” if uncheck.

4.You should a new node “Web Service References”.Expand to see the web methods exposed to you.

5.Get the code clientapp and create a class with the same name as that of the document.

6.Some errors shown up ,get SwingX

7.Through the code:

There are four methods namely:

-getAllContacts

-getContactByFN

-getContactByFLN

-getContactByMobile

The codes within the methods were genereated by dragging the web methods ,Under

Web Service References > contactService > contactService > contactServiceHttpPort onto the editor.

Code is edited slightly to reflect what you see now.

8.As a test create you own method and drag one methods into that method.

9.Running the project:

Right click the project and choose Run.

Output:

 

~ by frankappiahnsiah on September 3, 2008.

Leave a Reply