Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Use SOAP to Access EJB Components with PHP : Page 4

PHP code on the front end and EJBs on the back end—how do you make them talk to each other? Apply a little SOAP. Exposing the EJBs as Web services enables PHP to work with them, and SOAP is the key.


advertisement
Install Apache SOAP
At this point, you need to download and install Apache SOAP and then integrate it into your application. Go back to your deployment tool window (Did you close it already? Too fast! Open it once again!) and take the following steps:
  1. Single click on AlohaApp.

    FILE → ADD TO APPLICATION → WEB WAR

    Click to enlarge
    Figure 9: Add Web WAR
  2. Click on ADD WEB WAR (choose soap.war in the webapps/ directory where your Apache SOAP is installed, like in the screenshot above).



    TOOLS → DEPLOY

    Click to enlarge
    Figure 10: Deploy AlohaApp - Introduction
  3. Click NEXT, again NEXT, then FINISH

    If you've done everything correctly, you will see the screen below.

    Click to enlarge
    Figure 11: Deployment Progress

Now, to be 100 percent sure that your Apache SOAP is installed and working properly, type this URL in your browser window: http://localhost:8000/admin/. If everything is okay, you will see the Apache SOAP Admin interface.

Have SOAP Expose Your EJB Component
Now, you need to tell Apache SOAP that you want to expose the EJB component to it. To accomplish this, use the next deployment descriptor, soap_dd.xml:

<?xml version="1.0"?> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:demo"> <isd:provider type="org.apache.soap.providers.StatelessEJBProvider"
scope="Application" methods="create"> <isd:java class="greentest.HelloWorld"/> <isd:option key="JNDIName" value="Aloha" /> <isd:option key="FullHomeInterfaceName" value="greentest.HelloWorldHome" /> <isd:option key="ContextProviderURL" value="iiop://localhost:1050" /> <isd:option key="FullContextFactoryName"
value="com.sun.jndi.cosnaming.CNCtxFactory" /> </isd:provider> <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener> </isd:service>

To deploy the EJB component as a Web service to Apache SOAP, use the following command:

java org.apache.soap.server.ServiceManagerClient
http://localhost:8000/servlet/rpcrouter deploy soap_dd.xml

It's that easy!



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date