# How Do I: Use a JPD Proxy From a JSP?

To Create a JSP file that Calls a Business Process Using the JPD Proxy

1. In your JSP file, add an import statement for the JPD Proxy package, as shown in the following lines:

    <%@ page import="com.bea.wli.bpm.proxy.JpdProxy"%>
    <%@ page import="com.bea.wli.bpm.proxy.JpdProxySession"%>

To learn about using the JpdProxySession interface, see To Import the Proxy Classes.

2. Create an instance of the proxy class.

Using the same example as we used in How Do I: Use a JPD Proxy From a Java Client?, the code should resemble the following code:

            try
            {
                PoProcess p = (PoProcess)
                    JpdProxy.create(
                       PoProcess.class,
                       PoProcess.SERVICE_URI,

                        new JpdProxy.ContextHandler()
                        {
                            public Context getContext() throws NamingException
                            {
                                Environment env = new Environment();
                                env.setProviderUrl("t3://localhost:7001");
                                env.setSecurityPrincipal("weblogic");
                                env.setSecurityCredentials("weblogic");
                                return env.getInitialContext();
                            }
                       });
                PoDocument document = PoDocument.Factory.newInstance();
                Po po = document.addNewPo();
                po.setSku("abc");

                PoReferenceDocument ref = p.processPO(document);
                p.done();
            }
            catch (Exception e) { ... }
        }
    %>
    </html>

Note: To learn about the signatures of the JpdProxy.create() class, see To Use the Proxy Factory (JpdProxy.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?