2 Replies Latest reply on Mar 15, 2005 4:37 PM by Jason Greene

    problems calling webservices from a Stateless Session Bean

    srikrishna kalavacharla Newbie

      I'm calling webservices from a stateless session bean, which returns an array of user defined objects(complex types) and it returns me a "No deserializer defined for array type " exception. This works fine, if I just use a normal J2SE client.

      My environment(webservices client) is JBOSS 3.2.1 + apache axis + SLSB.

      http://www.jboss.org/wiki/Wiki.jsp?page=WSClientAppl says how to do this but I've some questions.

      1) How do I generate the jaxrpc-mapping.xml file from a wsdl file?
      2) where do I add the service-ref tags?
      3) How do I package my jar file?
      4) can someone please post a small example or tell me the issues with my example here?

      ArrayOfUserDefinedObjects.jar
       com.webservices.client.complex_types.ArrayOfUserDefinedObjectsRemoteHome
       com.webservices.client.complex_types.ArrayOfUserDefinedObjectsRemote
       com.webservices.client.complex_types.ArrayOfUserDefinedObjectsBean
       com.webservices.server.complex_types.ArrayOfUserDefinedObjects
       com.webservices.server.complex_types.ArrayOfUserDefinedObjectsService
       com.webservices.server.complex_types.ArrayOfUserDefinedObjectsServiceLocator
       com.webservices.server.complex_types.ArrayOfUserDefinedObjectsSoapBindingImpl
       com.webservices.server.complex_types.ArrayOfUserDefinedObjectsSoapBindingStub
       com.webservices.server.complex_types.ArrayOfUserDefinedObject
       META-INF/ejb-jar.xml
       META-INF/jboss.xml
       META-INF/ArrayOfUserDefinedObjects.wsdl
      
      



      
      /**
       * ArrayOfUserDefinedObjectsRemoteHome.java
       */
      
      package com.webservices.client.complex_types;
      
      public interface ArrayOfUserDefinedObjectsRemoteHome extends javax.ejb.EJBHome {
       public javax.ejb.EJBObject create() throws javax.ejb.CreateException, java.rmi.RemoteException;
      }
      
      
      


      /**
       * ArrayOfUserDefinedObjectsRemote.java
       */
      
      package com.webservices.client.complex_types;
      
      public interface ArrayOfUserDefinedObjectsRemote extends javax.ejb.EJBObject {
       public com.webservices.server.complext_types.ArrayOfUserDefinedObject[] getArrayOfUserDefinedObjects(String[] arrInput) throws RemoteException;
      }
      
      


      
      /**
       * ArrayOfUserDefinedObjectsBean.java
       */
      
      package com.webservices.client.complex_types;
      
      public class ArrayOfUserDefinedObjectsBean implements javax.ejb.SessionBean {
       public com.webservices.server.complext_types.ArrayOfUserDefinedObject[] getArrayOfUserDefinedObjects(String[] arrInput) {
       try {
       com.webservices.server.complex_types.ArrayOfUserDefinedObjects objArrayOfUserDefinedObjects = new com.webservices.server.complex_types.ArrayOfUserDefinedObjectsServiceLocator().getArrayOfUserDefinedObjects();
      
       return objArrayOfUserDefinedObjects.getArrayOfUserDefinedObjects(arrInput);
       } catch(Exception e) {
       e.printStackTrace();
       }
       }
      
       public void ejbActivate() throws EJBException{}
      
       public void ejbPassivate() throws EJBException {}
      
       public void ejbRemove() throws EJBException{}
      
       public void setSessionContext(SessionContext arg0) throws EJBException {}
      
       public void ejbCreate() throws CreateException {}
      }
      
      


      <!--ejb-jar.xml-->
      
      
      <?xml version="1.0"?>
      <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
      <ejb-jar>
       <description>ArraofUserDefinedObjects WebServices Client</description>
       <display-name>ArraofUserDefinedObjects WebServices Client</display-name>
       <enterprise-beans>
       <session>
       <ejb-name>ejb/ArraofUserDefinedObjectsWebServicesClient</ejb-name>
       <home>com.webservices.client.complex_types.ArrayOfUserDefinedObjectsRemoteHome</home>
       <remote>com.webservices.client.complex_types.ArrayOfUserDefinedObjectsRemote</remote>
       <ejb-class>com.webservices.client.complex_types.ArrayOfUserDefinedObjectsBean</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Bean</transaction-type>
       </session>
      
       <!-- This declaration is obviously wrong. What is the correct way to do this??? -->
       <service-ref>
       <service-ref-name>ejb/ArraofUserDefinedObjectsWebServicesClient</service-ref-name>
       <service-interface>com.webservices.client.complex_types.ArrayOfUserDefinedObjectsRemote</service-interface>
       <wsdl-file>META-INF/ArrayOfUserDefinedObjects.wsdl</wsdl-file>
       <service-qname>https://www.mywebsite.com/urn:array-of-user-defined-objects</service-qname>
       </service-ref>
       </enterprise-beans>
      </ejb-jar>
      
      


      <!-- jboss.xml -->
      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
      
      <jboss>
       <enterprise-beans>
       <session>
       <ejb-name>ejb/ArraofUserDefinedObjectsWebServicesClient</ejb-name>
       <jndi-name>ejb/ArraofUserDefinedObjectsWebServicesClient</jndi-name>
       </session>
       </enterprise-beans>
      
      
       <!-- Again what is the correct way to do this? -->
       <service-ref-mapping name="ejb/ArraofUserDefinedObjectsWebServicesClient">
       <port-info>
       <wsdl-port namespaceURI="https://www.mywebsite.com/urn:array-of-user-defined-objects" localpart="https://www.mywebsite.com/urn:array-of-user-defined-objects"/>
       <!--<stub-property>
       <name>javax.xml.rpc.service.endpoint.address</name>
       <value>http://localhost:8888/ejbws/timeport</value>
       </stub-property> -->
       </port-info>
       </service-ref-mapping>
      </jboss>
      
      



      Thanks
      Srikrishna Kalavacharla