axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From axis-...@ws.apache.org
Subject [jira] Created: (AXIS-1482) BeanSerializer not working for complex (nested) beans
Date Fri, 30 Jul 2004 15:36:42 GMT
Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1482

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1482
    Summary: BeanSerializer not working for complex (nested) beans
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Serialization/Deserialization
   Versions:
             1.2 Beta

   Assignee: 
   Reporter: Hongman Kim

    Created: Fri, 30 Jul 2004 8:36 AM
    Updated: Fri, 30 Jul 2004 8:36 AM
Environment: Windows XP, j2sdk1.4.2_05, Tomcat 5

Description:

BeanSerializer gives Exception for complex (nested) beans. This happens for 1.2beta and also
for nightly build of July 30 2004.
Below codes works OK for 1.1.

-- First Bean

/*
 * Run.java
 *
 * Created on July 28, 2004, 4:11 PM
 */

package beanxml;

/**
 *
 * @author  hkim
 */
public class Run {
   
   private String runID = null;

   /** Creates a new instance of Run */
   public Run() {
   }
   
   public void setRunID(String runID)
   {
      this.runID = runID;
   }
   
   public String getRunID()
   {
      return runID;
   }   
   

   public String toString()
   {
      String str = "";
      str = str + runID + ":";
      // for (int i=0; i < vars.length; i++)
      //   str = str + vars[i] +";"; 
      return str;
   }
   
}


--- Second Bean

/*
 * RunMatrix.java
 *
 * Created on July 28, 2004, 4:20 PM
 */

package beanxml;

/**
 *
 * @author  hkim
 */
public class RunMatrix {
   
   private Run run;
   private Integer tsID;
    
   /** Creates a new instance of RunMatrix */
   public RunMatrix() {
   }
  
   public void setRun(Run run)
   {
      this.run = run;
   }
   
   public Run getRun()
   {
      return run;
   }
   
   public Integer getTsID()
   {
      return tsID;
   }
   
   public void setTsID(Integer tsID)
   {
      this.tsID = tsID;
   }
   
   
   public String toString()
   {
      String str = "";
      str = str + tsID + ":";
      str = str + run.toString();
      return str;
   }
   
}


--- Service

/*
 * Server.java
 *
 * Created on July 28, 2004, 4:31 PM
 */

package beanxml;

/**
 *
 * @author  hkim
 */
public class MatrixBeanService {
   
   /** Creates a new instance of Server */
   public MatrixBeanService() {
   }
   
    public String getMatrixString(RunMatrix matrix)
    {
        String sep = System.getProperty("line.separator");
        
        String response = matrix.toString() + sep;
        
        return response;
    }
}

--- Client

/*
 * Client.java
 *
 * Created on July 28, 2004, 4:39 PM
 */

package beanxml;

import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.utils.Options;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
/**
 *
 * @author  hkim
 */
public class Client {
   
   /** Creates a new instance of Client */
   public Client() {
   }
   
   /**
    * @param args the command line arguments
    */
   public static void main(String[] args) {
      
      try
      {
        Options options = new Options(args);
        
        Run run = new Run();
        run.setRunID("77");

        RunMatrix matrix = new RunMatrix();
        matrix.setRun(run);
        
        matrix.setTsID(new Integer(55));
        
        Service  service = new Service();
        Call     call    = (Call) service.createCall();
        QName    qn1      = new QName( "urn:MatrixBeanService", "RunMatrix" );
        QName    qn2      = new QName( "urn:MatrixBeanService", "Run" );
        
        call.registerTypeMapping(beanxml.RunMatrix.class, qn1,
                      new org.apache.axis.encoding.ser.BeanSerializerFactory(beanxml.RunMatrix.class,
qn1),        
                      new org.apache.axis.encoding.ser.BeanDeserializerFactory(beanxml.RunMatrix.class,
qn1));
        call.registerTypeMapping(beanxml.Run.class, qn2,
                      new org.apache.axis.encoding.ser.BeanSerializerFactory(beanxml.Run.class,
qn2),        
                      new org.apache.axis.encoding.ser.BeanDeserializerFactory(beanxml.Run.class,
qn2)); 
        
        String result;
        try {
           System.out.println("url = " + options.getURL());
            call.setTargetEndpointAddress( new java.net.URL(options.getURL()) );
            call.setOperationName( new QName("PrintRunMatrix", "getMatrixString") );
            call.addParameter( "arg1", qn1, ParameterMode.IN );            
            call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );

            result = (String) call.invoke( new Object[] { matrix } );
        } catch (AxisFault fault) {
           fault.printStackTrace();
            result = "Error : " + fault.toString();
        }
        
        System.out.println(result);
      }
      catch(Exception e)
      {
         e.printStackTrace();
      }
    }      
}

--- deployment

<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <service name="PrintRunMatrix" provider="java:RPC">
        <parameter name="className" value="beanxml.MatrixBeanService"/>
        <parameter name="allowedMethods" value="getMatrixString"/>
        <beanMapping qname="myNS:RunMatrix" xmlns:myNS="urn:MatrixBeanService" languageSpecificType="java:beanxml.RunMatrix"/>
        <beanMapping qname="myNS:Run" xmlns:myNS="urn:MatrixBeanService" languageSpecificType="java:beanxml.Run"/>
       
    </service>
</deployment>


--- StackTrace

C:\users\hkimSVN\Java\soap_test\beanxml>testit -p8085

C:\users\hkimSVN\Java\soap_test\beanxml>java -cp "..;.;C:\axis-1_2beta\lib\axis.
jar;C:\axis-1_2beta\lib\commons-discovery.jar;C:\axis-1_2beta\lib\commons-loggin
g.jar;C:\axis-1_2beta\lib\jaxrpc.jar;C:\axis-1_2beta\lib\saaj.jar;C:\axis-1_2bet
a\lib\log4j-1.2.8.jar;C:\xerces-2_6_2\build\xml-apis.jar;C:\xerces-2_6_2\build\x
ercesImpl.jar;C:\xerces-2_6_2\build\xmlParserAPIs.jar;C:\users\hkimSVN\JiniTest\
trunk\javarmi;C:\Program Files\Apache Software Foundation\Tomcat 5.0\shared\clas
ses;C:\Program Files\Apache Software Foundation\Tomcat 5.0\shared\classes\LSFJob
Server.jar;C:\SOAP\soap-2_3_1;C:\SOAP\soap-2_3_1\lib\soap.jar;C:\SOAP\javamail-1
_3_1\mail.jar;C:\SOAP\jaf-1.0.2\activation.jar;C:\SOAP\bsf-2_2\lib\bsf.jar;C:\SO
AP\rhino1_5R5\js.jar;C:\cog-0.9.13\lib\cog.jar;C:\cog-0.9.13\lib\log4j-core.jar;
C:\cog-0.9.13\lib\cog.jar;C:\Program Files\Phoenix Integration\ModelCenter 6.0\M
odelCenter.jar;C:\j2sdk1.4.2_05\jre\lib\ext\mysql-connector-java-3.0.11-stable-b
in.jar;C:\apache-ant-1.5.3-1\lib\ant.jar" beanxml.Client localhost -p8085
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectR
esourceBundle).
log4j:WARN Please initialize the log4j system properly.
url = http://localhost:8085/axis/servlet/AxisServlet
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:

java.lang.NullPointerException
        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
.java:223)
        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
java:130)
        at org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseri
alizationContextImpl.java:1053)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXPar
ser.java:585)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSD
ocumentScannerImpl.java:554)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1526)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:338)
        at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration
.java:828)
        at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration
.java:758)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1178)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
        at org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
tionContextImpl.java:218)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:568)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:427)
        at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j
ava:701)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:93)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:144)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2688)
        at org.apache.axis.client.Call.invoke(Call.java:2671)
        at org.apache.axis.client.Call.invoke(Call.java:2357)
        at org.apache.axis.client.Call.invoke(Call.java:2280)
        at org.apache.axis.client.Call.invoke(Call.java:1741)
        at beanxml.Client.main(Client.java:63)


java.lang.NullPointerException
        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
.java:223)
        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
java:130)
        at org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseri
alizationContextImpl.java:1053)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXPar
ser.java:585)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSD
ocumentScannerImpl.java:554)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1526)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:338)
        at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration
.java:828)
        at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration
.java:758)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1178)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
        at org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
tionContextImpl.java:218)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:568)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:427)
        at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.j
ava:701)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:93)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:144)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2688)
        at org.apache.axis.client.Call.invoke(Call.java:2671)
        at org.apache.axis.client.Call.invoke(Call.java:2357)
        at org.apache.axis.client.Call.invoke(Call.java:2280)
        at org.apache.axis.client.Call.invoke(Call.java:1741)
        at beanxml.Client.main(Client.java:63)
Error : java.lang.NullPointerException


--- TCP communication

 -- request

POST /axis/servlet/AxisServlet HTTP/1.0

Content-Type: text/xml; charset=utf-8

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.2beta

Host: 127.0.0.1:8085

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: ""

Content-Length: 1189



<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <ns1:getMatrixString soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="PrintRunMatrix">
   <arg1 href="#id0"/>
  </ns1:getMatrixString>
  <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:RunMatrix" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:MatrixBeanService">
   <run href="#id1"/>
   <tsID href="#id2"/>
  </multiRef>
  <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="soapenc:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">55</multiRef>
  <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns3:Run" xmlns:ns3="urn:MatrixBeanService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <runID xsi:type="soapenc:string">77</runID>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>

 --response

HTTP/1.1 500 Internal Server Error

Content-Type: text/xml;charset=utf-8

Date: Fri, 30 Jul 2004 15:24:11 GMT

Server: Apache-Coyote/1.1

Connection: close



<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>soapenv:Server.userException</faultcode>
   <faultstring>java.lang.NullPointerException</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message