axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Måns Tånneryd <m...@tanneryd.com>
Subject RE: About java.lang.InstantiationException.
Date Sun, 23 May 2004 20:58:43 GMT
Hello again Bing!

I see no server side generation in your wsdl2java... How did you deploy your
service implementation?

/Måns
  -----Original Message-----
  From: Bing_Wu@idx.com [mailto:Bing_Wu@idx.com]
  Sent: den 21 maj 2004 20:47
  To: axis-dev@ws.apache.org
  Subject: RE: About java.lang.InstantiationException.



  Thanks a lot for your response, Mans.

  I submitted an email to the group twice before with very specific
information. I guess the email was too long to get any reply. -:)

  Here is my old email message:

  Hi,

  I defined an interface: com.idx.lw.webservices.inbox.InboxRetrievalService
like the following:

  public interface InboxRetrievalService {
     public String getInboxList(CISContext cisContext, InboxRetrievalBean
inboxRetrieval) throws CISException;
  }

  where class CISException extends RemoteException implements Serializable;

  I then created a class:
com.idx.lw.webservices.inbox.InboxRetrievalServiceJP like the following:

  public class InboxRetrievalServiceJP implements InboxRetrievalService {
     public InboxRetrievalServiceJP() throws CISException {
     ......
     }

     public String getInboxList(CISContext cisContext, InboxRetrievalBean
inboxRetrieval) throws CISException {
     ......
     }
  }

  I used the following to generate the WSDL file:

  <target name="generate-inboxRetrieval-wsdl"
depends="compile-inboxRetrieval" unless="inboxRetrieval.wsdl.uptodate">
     <delete file="${axis-gen}/${inboxRetrieval-wsdl-file}"/>
     <java classname="org.apache.axis.wsdl.Java2WSDL"
classpath="${all-jars}" fork="on">
         <arg value="-o${axis-gen}/${inboxRetrieval-wsdl-file}"/>
         <arg
value="-l${axis-host}/cis-inbox/services/InboxRetrievalService"/>
         <arg
value="-n${axis-host}/cis-inbox/services/InboxRetrievalService"/>
         <arg value="-PInboxRetrievalServiceJP"/>
         <arg value="-SInboxRetrievalServer"/>
         <arg value="com.idx.lw.webservices.inbox.InboxRetrievalService"/>
     </java>
  </target>

  then I used the following to generate the stub classes:

  <target name="generate-inboxRetrieval-stubs"
depends="generate-inboxRetrieval-wsdl">
     <java classname="org.apache.axis.wsdl.WSDL2Java"
classpath="${all-jars}" fork="on">
         <arg value="-v"/>
         <arg value="-o${axis-gen}/src"/>
         <arg value="-pcom.idx.sage.wsstubs"/>
         <arg value="-t"/>
         <arg value="${axis-gen}/${inboxRetrieval-wsdl-file}"/>
     </java>
  </target>

  I then created an unit test as following:

  public class InboxRetrievalWebServiceTest extends TestCase {
     public InboxRetrievalWebServiceTest(java.lang.String testName) {
         super(testName);

         try {
             ......
             inboxRetrieval = new com.idx.sage.wsstubs.InboxRetrievalBean();
             inboxRetrievalService = new
InboxRetrievalServerLocator().getInboxRetrievalService();
             ......
         }
         catch (javax.xml.rpc.ServiceException jre) {
             if (jre.getLinkedCause() != null)
                 jre.getLinkedCause().printStackTrace();
             throw new junit.framework.AssertionFailedError("JAX-RPC
ServiceException caught: " + jre);
         }
         catch (CISException e1) {
             throw new junit.framework.AssertionFailedError("CISException
Exception caught: " + e1);
         }
         catch (IOException e) {
             e.printStackTrace();
         }
     }

     public void testGetInboxList() {
         try {
             ......
             inboxRetrievalService.getInboxList(cisContext, inboxRetrieval);
             ......
         }
         catch (CISException e) {
             e.printStackTrace();
         }
         catch (IOException e) {
             e.printStackTrace();
         }
     }
  }

  When I run my unit test, I got the following error:

  AxisFault
  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
  faultSubcode:
  faultString: java.lang.InstantiationException:
com.idx.lw.webservices.inbox.InboxRetrievalService
  faultActor: null
  faultNode: null
  faultDetail:
         stackTrace: java.lang.InstantiationException:
com.idx.lw.webservices.inbox.InboxRetrievalService

  This seems to me that the Axis tried to create an object based on the
interface InboxRetrievalService, not based on the actual implementation
InboxRetrievalServiceJP.

  Could you please tell me what I am doing wrong and how to fix it? Or we
just can't use an interface for the web service.

  BTW, if I used a concrete class, it works just fine.

  Thanks!

  Bing



       Mans Tanneryd <mans@tanneryd.com>
        05/21/2004 11:30 AM
        Please respond to axis-dev


                To:        <axis-dev@ws.apache.org>
                cc:
                Subject:        RE: About java.lang.InstantiationException.



  Hi Bing!

  Could you be a little more specific? What were the names of your interface
and your implementation classes? What options did you use when running
java2wsdl and wsdl2java? How did you "use" the stub classes?

  /Måns
  -----Original Message-----
  From: Bing_Wu@idx.com [mailto:Bing_Wu@idx.com]
  Sent: den 21 maj 2004 18:34
  To: axis-user@ws.apache.org; axis-dev@ws.apache.org
  Subject: About java.lang.InstantiationException.


  Hi,

  I created a Java interface and several Java classes which implement the
interface. I used Java2WSDL to generate the WSDL from the interface. Then I
used WSDL2Java to generate the stub classes.

  When I used the stub classes, I got the following error:

  AxisFault
  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
  faultSubcode:
  faultString: java.lang.InstantiationException:
com.idx.lw.webservices.inbox.InboxRetrievalService
  faultActor: null
  faultNode: null
  faultDetail:
         stackTrace: java.lang.InstantiationException:
com.idx.lw.webservices.inbox.InboxRetrievalService

  This seems to me that the Axis tried to create an object based on the
interface, not based on one of my implementation classes.

  I am wondering what I am doing wrong and how to fix it here? Or we just
can't use an interface for the web service directly, i.e., dynamic
invocation not supported.

  Thanks!

  Bing

  ----------------------------------------------------
  NOTICE OF CONFIDENTIALITY
  ----------------------------------------------------
  The information in this email, including attachments, may be confidential
and/or privileged and may contain confidential health information. This
email is intended to be reviewed only by the individual or organization
named as addressee. If you have received this email in error please notify
IDX immediately - by return message to the sender or to security@idx.com -
and destroy all copies of this message and any attachments. Please note that
any views or opinions presented in this email are solely those of the author
and do not necessarily represent those of IDX. Confidential health
information is protected by state and federal law, including, but not
limited to, the Health Insurance Portability and Accountability Act of 1996
and related regulations.


Mime
View raw message