Web Service Development Cycle

This topic describes the process of developing web services with WebLogic Workshop. The steps in developing a web service are the same as for any software development: design, implement, test, debug and deploy.

# 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 accomplish this task in the Design View. To lean more about WebLogic Workshop's Design View, see 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 WebLogic Workshop Projects.

- Add the methods your web service will expose and configure the methods' parameters.

- Add any callbacks your web service will expose and configure the callbacks' parameters. 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 Maintaining State with Conversations.

The set of methods and callbacks you define for your web service is called the public interface or public contract. Once you have defined the public interface of your web service, you are ready to implement the web service's internal logic. Implementation is described in the next section.

# Implementing Web Service Code

You implement the internal logic of your web service in WebLogic Workshop's Source View. 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. To implement your web service's logic, add code to the body of the various methods, and invoke callbacks where appropriate.

It may be necessary or desirable for your web service to utilize other resources, such as a database or another web service. In WebLogic Workshop, you accomplish this via controls. Controls provide a simple, common model for interacting with resources from within your web service. To learn more about controls, see Controls: Using Resources from a Web Service.

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 will want 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 with Debug 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).

To learn more about testing web services in Test View, see Test View.

# 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. This includes the Java code in your web service's methods as well as any ECMAScript code you may be using to map XML to Java types and vice versa.

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 Web Services.

# 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 web service 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 Web Services.

Related Topics

What Are Web Services?

Building Web Services with WebLogic Workshop

Structure of a JWS File