[prev in list] [next in list] [prev in thread] [next in thread] 

List:       soap-user
Subject:    Nested Classes for Java Beans
From:       "Doug Haigh" <dhaigh () gatorzone ! com>
Date:       2003-03-07 17:44:50
[Download RAW message or body]

I have a class that does all soap that looks like

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

public class SoapMgr
{
  public int GetInfo()
  {
      Service service = new Service();
      Call    call    = (Call) service.createCall();
      QName   qn      = new QName( "urn:remote-adap", "NumAdaptersInfo" );

      call.registerTypeMapping(InfoBean.class,
                               qn,
                               new
org.apache.axis.encoding.ser.BeanSerializerFactory(InfoBean.class, qn),
                               new
org.apache.axis.encoding.ser.BeanDeserializerFactory(InfoBean.class, qn));

      call.setTargetEndpointAddress(serverUrl);
      call.setOperationName(new QName("urn:remote-adap",
"GetNumAdapters") );

      call.setReturnType(qn);

      InfoBean ai = (InfoBean)call.invoke(new Object[]{} );
     ...
    }
    catch (javax.xml.rpc.ServiceException se)
    {
      System.err.println("Caught ServiceException:" + se.getMessage());
    }
    catch (java.rmi.RemoteException re)
    {
      System.err.println("Caught RemoteException:" + re.getMessage());
    }
  }

  public class InfoBean() implements Serializable
  {
    public InfoBean()
    {
    }
    ...
  }
}

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

but the call fails because it says the InfoBean does not have a public
constructor (which it does). Does Axis not support nested classes to be used
as deserializers?

Doug

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>I have a 
class that does all soap that looks like</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>=======================================</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>public class 
SoapMgr</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>{</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>&nbsp; 
public int GetInfo()</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>&nbsp; 
{</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Service service = new 
Service();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Call&nbsp;&nbsp;&nbsp; 
call&nbsp;&nbsp;&nbsp; = (Call) 
service.createCall();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QName&nbsp;&nbsp; 
qn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = new QName( "urn:remote-adap", 
"NumAdaptersInfo" );</FONT></SPAN></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
call.registerTypeMapping(InfoBean.class,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 qn,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 new org.apache.axis.encoding.ser.BeanSerializerFactory(InfoBean.class, 
qn),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 new org.apache.axis.encoding.ser.BeanDeserializerFactory(InfoBean.class, 
qn));</FONT></SPAN></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
call.setTargetEndpointAddress(serverUrl);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
call.setOperationName(new QName("urn:remote-adap", "GetNumAdapters") 
);</FONT></SPAN></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
call.setReturnType(qn);</FONT></SPAN></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InfoBean ai = (InfoBean)call.invoke(new 
Object[]{} );</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT 
face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; catch 
(javax.xml.rpc.ServiceException se)<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.err.println("Caught 
ServiceException:" + se.getMessage());<BR>&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp; catch (java.rmi.RemoteException 
re)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.err.println("Caught RemoteException:" + 
re.getMessage());<BR>&nbsp;&nbsp;&nbsp; }<BR></FONT></SPAN><SPAN 
class=812513817-07032003><FONT face="Courier New" size=2>&nbsp; 
}</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>&nbsp; 
public class InfoBean() implements Serializable</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>&nbsp; 
{</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp; public InfoBean()</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp; {</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp; }</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>&nbsp;&nbsp;&nbsp; ...</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>&nbsp; 
}</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>==========================</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" size=2>but the call 
fails because it says the InfoBean does not have a&nbsp;public constructor 
(which it does). Does Axis not support nested classes to be used as 
deserializers?</FONT></SPAN></DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=812513817-07032003><FONT face="Courier New" 
size=2>Doug</FONT></SPAN></DIV></BODY></HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic