# How Do I: Use a JPD Proxy to a Call Business Process?

You can use a JPD Proxy to call any business process (synchronous and asynchronous, stateful, and stateless) from any Java client, including standalone Java applications, EJBs, JSPs and Servlets. Using a Java proxy for a business process requires different steps depending on whether the client application that uses the proxy is in the same JVM as the target business process.

This topic includes the following sections:

- What is a JPD Proxy?
- How Do I: Get a JPD Proxy for a Business Process?
- How Do I: Use a JPD Proxy From a Java Client?
- How Do I: Use a JPD Proxy From a JSP?
- How Do I: Use a JPD Proxy From an EJB?

## What is a JPD Proxy?

A JPD Proxy is an RMI client to a business process (JPD). An interface that matches a business process' client requests is associated with each business process. This interface is called the JPD public contract. Each method on the JPD public contract has the same signature as the corresponding client request. A JPD Proxy is a JAR that contains the compiled class file for the JPD contract. You can use the class file to access the JPD as though it were a local Java class. JPD Proxy calls are over Java RMI. JPD Proxy calls propagate the transaction context from the clients to the business processes.

You can download the JPD Proxy JAR file from the JPD Proxy link on the WebLogic Workshop Test Browser Overview page (see How Do I: Get a JPD Proxy for a Business Process?).

Warning: Business processes that include client callbacks send those callbacks to the client that started the process. JPD Proxies cannot receive callbacks from business processes. An error will occur in your business process if a client uses a JPD Proxy to start a business process that includes client callbacks; the business process fails at run time when it tries to send the callback to the client (the JPD Proxy) that started it.

The JpdProxy class is a factory class for proxies to a WebLogic Integration business process type. Clients call one of the create() methods on the class to get a proxy instance. The create() methods take the JPD contract class (java.lang.Class) as input.

An example JPD contract interface for a business process named RequestQuote.jpd is shown in the following listing.

Listing : Example JPD Contract Interface

    package weblogic.wli.jpdproxy;

    import org.example.request.QuoteRequestDocument;

    public interface RequestQuote {
        public void quoteRequest(org.example.request.QuoteRequestDocument requestXML);
        public static final String SERVICE_URI =
        "/myApplication/requestquote/RequestQuote.jpd";
    }

Note the following characteristics in the preceding example contract interface:

- The class name of the interface matches the JPD class name (in this case, you download a JAR file named RequestQuoteProxy.jar that contains a class file named RequestQuote.class).
- One method is available: public void quoteRequest(org.example.request.QuoteRequestDocument requestXML).

Note: When you write your client application, you can determine which client request methods are available for you to use through the JPD Proxy by reviewing the source code for the business process. To do so, ensure that the business process (JPD) is open in the WebLogic Workshop graphical design environment, identify the Client Request calls in the Design View, then open the Source View to view the method names and signatures.

- The JPD contract references a strongly typed XML argument: requestXML, which is of type QuoteRequestDocument.
- The JPD contract interface includes a SERVICE_URI static final field. The String value of the SERVICE_URI field is the URI for the business process at the time the JPD Proxy is downloaded from the WebLogic Workshop test browser. The client can pass this constant to the create method, or can pass a different value.

A different value for SERVICE_URI is required if the business process (JPD) is deployed to a different location after the JPD Proxy JAR was generated. For example, you can create the JPD Proxy from the business process while the process is deployed in a development environment. Subsequently, the business process can be moved to a different location for production. Therefore, the business process is accessible through a different URI; clients must pass the new URI value to the create method.

Related Topics

- How Do I: Get a JPD Proxy for a Business Process?
- How Do I: Use a JPD Proxy From a Java Client?