4 Replies Latest reply on Feb 13, 2011 1:07 AM by jaikiran pai

    how to quickly expose ejbs in jboss as web service?

    xuzhiling Newbie

       

        • 1. Re: how to quickly expose ejbs in jboss as web service?
          Jay Walters Newbie

          You can use Apache SOAP or Apache Axis. Both include features that allow you to expose arbitrary methods in EJBs remote interfaces as web services. There is currently a lot of work going on the JBoss.net subproject which is integration with Axis.

          Cheers

          • 2. Re: how to quickly expose ejbs in jboss as web service?
            Curtis D. Gayheart Newbie

            Hi, I'm having some issue with SOAP as well. I've got an EJB deployed through apache SOAP and JBOSS, but it appears that when tomcat comes to JBOSS to look up the bean, it's having issues even though I can look up the bean directly from a Java App. The deployment descriptor I'm using is this:

            <?xml version="1.0"?>
            <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:demographics">
            <isd: provider type="org.apache.soap.providers.StatelessEJBProvider" scope="Request" methods="getDemo">
            <isd:java class="Demographics"/>
            <isd:option key="FullHomeInterfaceName" value="com.nw.adaptors.demographics.DemographicsHome" />
            <isd:option key="ContextProviderURL" value="jnp://localhost:1099" />
            <isd:option key="FullContextFactoryName" value="org.jnp.interfaces.NamingContextFactory" />
            </isd: provider>
            <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
            </isd:service>

            And I'm trying to call the service like this:

            String AO = "usernamepassword";

            Vector params = new Vector();
            params.addElement(new org.apache.soap.rpc.Parameter("MRN", String.class, "0000023211-03", null));
            params.addElement(new org.apache.soap.rpc.Parameter("FACILITY_ID", String.class, "", null));
            params.addElement(new org.apache.soap.rpc.Parameter("Authentication", String.class, AO, null));

            Call c = new Call();
            c.setMethodName("getDemo");
            c.setParams(params);
            c.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
            c.setTargetObjectURI("urn:demographics");
            Response resp = c.invoke(new URL("http://localhost:8080/soap/servlet/rpcrouter"), "http://localhost:8080/soap/servlet/rpcrouter/demographics");
            if (resp.generatedFault()) {
            System.out.println(resp.getFault().toString());
            }else {
            System.out.println((String)resp.getReturnValue().getValue());
            }

            The result that I get is:

            [SOAPException: faultCode=SOAP-ENV:Client; msg=A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must contain a: 'faultcode' element.; targetException=java.lang.IllegalArgumentException: A 'http://schemas.xmlsoap.org/soap/envelope/:Fault' element must contain a: 'faultcode' element.]

            at org.apache.soap.rpc.Call.invoke(Call.java:246)

            at test.Test.main(Test.java:36)

            And in the JBoss window I see:

            [Default] In TemplateProvider.locate()
            [Default] URI: urn:demographics
            [Default] DD.ServiceClass: org.apache.soap.providers.StatelessEJBProvider
            [Default] DD.ProviderClass: Demographics
            [Default] Call.MethodName: getDemo
            [Default] Exception caught: javax.naming.NameNotFoundException: Demographics not
            bound

            Any help with this would be greatly appreciated, as I'm completely stumped at this point

            • 3. how to quickly expose ejbs in jboss as web service?
              Sam W Expert

              Hello,

               

              With Eclipse 3.6 EE Developer, I tried to create a Web Service  from an EJB class, but it failed with the following statemen. The Eclipse has an embedded JBOSS 6.0Final server running, it has been added into the projects.

               

               

              Here is what it said from Eclipse:

              ========================================

               

              The service class "au.com.housewareonline.dao.facade.RoleFacade" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.

              The method "create" on the service class "au.com.housewareonline.dao.facade.RoleFacade" is overloaded. Overloaded methods are allowed by chapter 5.5.5 of the JAX-RPC 1.1 specification, however, some JAX-RPC 1.1 compliant tools may not allow overloaded methods or may generate WSDL with overloaded operations as contrary to rule R2304 of the WS-I Basic Profile.

              The method "find" on the service class "au.com.housewareonline.dao.facade.RoleFacade" uses a data type, "java.lang.Object", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.

              The method "findAll" on the service class "au.com.housewareonline.dao.facade.RoleFacade" uses a data type, "java.util.List", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.

              The method "findRange" on the service class "au.com.housewareonline.dao.facade.RoleFacade" uses a data type, "java.util.List", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.

              ==========================================

               

              This EJB class is copied from the one I created in Netbeans. When I used Netbeans to create a web services, there is no problem at all.

               

              Can anyone tell me what causes this issue?

              What kind of Web Services does Eclipse required from an EJB class, in order to deploy it to JBOSS?

               

              Your suggestion would be appreciated.

               

              SS

              • 4. how to quickly expose ejbs in jboss as web service?
                jaikiran pai Master

                Sam, please do not post the same question in multiple threads. Please continue your discussion here http://community.jboss.org/message/587023#587023