You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Shawn McKisson <sh...@deverus.com> on 2001/12/12 00:49:07 UTC

Having difficulty passing a custom object to web service method

I successfully downloaded and installed the a2 release, and within a few minutes the stock quote example was running correctly. However,  when I started trying to pass a custom object from the client to the server,  I began getting errors. I found example5 in the userguide, which is passing across an Order object, but I get the same exception from this code as I do from the code that I wrote.

Below is the exception returned from the client for example5
Following that is the exception seen in the webserver logs
I am using Tomcat 4.0.1,  and the Xerces 2_0_0 beta 3 parser for axis.

What mistake have I made to cause this?

Exception returned from the client 

D:\axis-1_0>java samples.userguide.example5.Client
Error : AxisFault
  faultCode: null
  faultString: java.lang.NullPointerException
        at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:160)
        at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:244)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:232)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:262)
        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:338)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        <...snip org.apache.catalina.core.* ...>

  faultActor: null
  faultDetails: null


Exception in the tomcat server logs

Starting service Tomcat-Apache
Apache Tomcat/4.0.1
AxisServlet: init
java.lang.NullPointerException
        at org.xml.sax.helpers.AttributesImpl.getValue(AttributesImpl.java:286)
        at org.apache.axis.encoding.DeserializationContext.getTypeFromAttributes(DeserializationContext.java:256)
        at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:101)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:528)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:142)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:361)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:66)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:95)
        at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:104)
        at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:244)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:232)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:262)
        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:338)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        <... snip org.apache.catalina.core.* ...>

Re: Having difficulty passing a custom object to web service method

Posted by Shawn McKisson <sh...@deverus.com>.
I found the cause of this error, but I am not sure why it is happening just yet - maybe someone can shed some light on it.

The problem was the Xerces 2_0_0 beta 3 parser, and was thrown from the following axis code:

org.apache.axis.encoding.DeserializationContext:

...

// Check for type
String type = null;
for (int i=0; i<Constants.URIS_SCHEMA_XSI.length && type==null; i++) {
    //my debugging output
    try {
      System.out.println("Constants.URIS_SCHEMA_XSI[" + i + "] = " +
                          Constants.URIS_SCHEMA_XSI[i]);
    }
    catch (Exception e) {
        e.printStackTrace();
    } //end my debugging output

    //NPE thrown from getValue() on next line
    type = attrs.getValue(Constants.URIS_SCHEMA_XSI[i], "type");
  }

Debugging output revealed that the exception was being thrown on the first iteration of the for loop.
The output was as follows:

Constants.URIS_SCHEMA_XSI[0] = http://www.w3.org/1999/XMLSchema-instance

Does anyone have a clue as to why attrs.getValue("http://www.w3c.org/1999/XMLSchema-instance", "type") might throw an exception?

Anyway, in summary, Axis alpha 2 is not compatible with Xerces 2_0_0 beta 3. When a3 is finally released I will try it again.

--shawn


  ----- Original Message ----- 
  From: Shawn McKisson 
  To: axis-user@xml.apache.org 
  Sent: Tuesday, December 11, 2001 5:49 PM
  Subject: Having difficulty passing a custom object to web service method


  I successfully downloaded and installed the a2 release, and within a few minutes the stock quote example was running correctly. However,  when I started trying to pass a custom object from the client to the server,  I began getting errors. I found example5 in the userguide, which is passing across an Order object, but I get the same exception from this code as I do from the code that I wrote.

  Below is the exception returned from the client for example5
  Following that is the exception seen in the webserver logs
  I am using Tomcat 4.0.1,  and the Xerces 2_0_0 beta 3 parser for axis.

  What mistake have I made to cause this?

  Exception returned from the client 

  D:\axis-1_0>java samples.userguide.example5.Client
  Error : AxisFault
    faultCode: null
    faultString: java.lang.NullPointerException
          at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:160)
          at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:244)
          at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:232)
          at org.apache.axis.server.AxisServer.invoke(AxisServer.java:262)
          at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:338)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
          <...snip org.apache.catalina.core.* ...>

    faultActor: null
    faultDetails: null


  Exception in the tomcat server logs

  Starting service Tomcat-Apache
  Apache Tomcat/4.0.1
  AxisServlet: init
  java.lang.NullPointerException
          at org.xml.sax.helpers.AttributesImpl.getValue(AttributesImpl.java:286)
          at org.apache.axis.encoding.DeserializationContext.getTypeFromAttributes(DeserializationContext.java:256)
          at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:101)
          at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:528)
          at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:142)
          at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:361)
          at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:66)
          at org.apache.axis.message.RPCElement.getParams(RPCElement.java:95)
          at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:104)
          at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:244)
          at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:232)
          at org.apache.axis.server.AxisServer.invoke(AxisServer.java:262)
          at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:338)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
          <... snip org.apache.catalina.core.* ...>