# Web Service Development Cycle

The life cycle of a web service is similar to that of any web application component: design, implement, test, debug and deploy. Designing and building the web service will typically follow design and implementation of the custom Java control(s) that implements the web service's business logic.

## Designing a Web Service

When designing a new web service, you specify the names and parameters of all of the service's exposed operations and callbacks. In WebLogic Workshop, you can accomplish this task in Design View.

The specific steps you follow to create and define a new web service are:

- Create a new JWS file in an appropriate folder within your project. To learn about WebLogic Workshop projects, see Applications and Projects.
- Add the methods your web service will expose and configure each method's parameters. Invoke Java control methods as desired from each web service method. To lean about Java controls, see Working with Java Controls.
- Add any callbacks your web service will expose and configure each callback's parameters. Implement callback handlers for all callbacks from Java controls that you need to accept. To learn about callbacks, see Using Callbacks to Notify Clients of Events.
- Determine and configure the conversation phase of each method and callback. To learn more about conversations, see Designing Conversational Web Services.

The set of methods and callbacks you define for your web service is called the public interface or public contract.

## Implementing Web Service Code

WebLogic Workshop recommends that you use one or more custom Java control(s) in your web service to implement the business logic of your web service. Custom Java controls in turn sometimes will need to use built-in Java controls to access enterprise resources such as databases or other web services.

You can implement your web service using both the Design and Source Views. In Source View, you can edit the contents of the JWS file that defines your web service. If you added methods or callbacks in Design View, you will see the definitions of those methods and callbacks in Source View. In Source View you can add code to the body of the methods and implement callback handlers for the Java controls.

While WebLogic Workshop web services are written in the Java programming language, WebLogic Workshop strives to make it possible to implement Java web services without being a Java expert. If you are competent in any programming language and are familiar with common programming concepts like variable declarations, method declarations, control structures (if-then-else statements, for loops, etc.) you should be able to implement web services in WebLogic Workshop.

If you are completely new to the Java programming language, see Introduction to Java.

## Testing a Web Service

Once you have implemented the logic of a web service, you need to test it. WebLogic Workshop provides a test environment for the web services you develop. This environment is called Test View.

Test View runs in a browser. Remember that your web service's methods are typically invoked via the HTTP web protocol (thus the name web services). Real clients will typically invoke your web service by sending HTTP requests and receiving HTTP responses (the same thing your browser always does). However, the responses from web service method invocations are not typically HTML pages, they are typically XML messages.

Test View provides a way for you to invoke a web service's methods from a browser and view the XML messages that are exchanged. Test View keeps a log of activity while testing a web service so that you can examine the details of the interaction between the client and web service at any point.

Test View can be reached directly via the Start or Start without Debugging actions in WebLogic Workshop's user interface. However, you may also enter Test View directly by entering the URL of your web service in the address bar of a browser (assuming the WebLogic Server hosting your web service is running).

## Debugging a Web Service

Since web services are application components containing code and code is seldom correct the first time it is written, you need a way to debug your web service's code. WebLogic Workshop provides full debugging capabilities for all code that implements a web service.

WebLogic Workshop provides an efficient edit-compile-debug cycle so that you can arrive at correct web service code quickly and easily. To debug, begin by setting breakpoints at desired locations in your web service's source code. Next execute your service. When execution reaches one of your break points, execution is suspended and you can examine the state of your service's variables and environment. When you are ready, you can continue execution, perhaps stopping at another breakpoint. When you locate a programming error, you may correct the error in the program source and re-execute the web service to test the new code.

To learn more about how to debug WebLogic Workshop web services, see Debugging Your Application.

## Deploying a Web Service

One you have designed, implemented and debugged a web service, you are ready to make that web service available to potential clients. Clients may be customers, business partners or other software components within your organization. The process of making your web service available on a production server and publishing its location is known as deployment.

At a basic level, deployment of WebLogic Workshop services is very simple. You merely package the application containing your web services as an EAR file, and copy the EAR file to a production server on which the WebLogic Workshop runtime environment is installed. Your web service is immediately available.

In enterprise environments, the deployment story is typically more complicated, involving various levels of staging and testing to ensure the code being deployed won't adversely affect other applications on the eventual production server.

To learn more about deployment of WebLogic Workshop web services, see Deploying Applications.

Related Topics

What Are Web Services?

Building Web Services with WebLogic Workshop

Structure of a JWS File

Working with Java Controls