axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Susan Reuland" <sreul...@us.ibm.com>
Subject How to get complex type attributes to work?
Date Tue, 16 Apr 2002 20:05:31 GMT
  I'm having a heck of a time getting a complex type attribute from my WSDL
schema to be correctly
recognized by axis.  The simple example below shows what I'd like to do -
be able to define an attribute on
a complex type.

      <complexType name="CallRequest">
      <sequence>
          <element name="parm1" type="string" use="required"/>
          <element name="parm2"  type="string" minOccurs="0"/>
        </sequence>
       <attribute name="testAttr" type="string"  />
       </complexType>

    I can generate all the appropriate stubs and client programs required,
i.e., the getter and setter for the
attribute are generated in my CallRequest java class and there's even a
comment in the java code
to indicate that testAttr is an attirbute,  but when I invoke my service, I
always receive a
NullPointerException

         java.lang.NullPointerException
             at org.apache.axis.message.SOAPFaultBuilder.endElement(Unknown
Source)
             at
org.apache.axis.encoding.DeserializationContextImpl.endElement(Unknown
Source)
             at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:559)

   Looking at the SOAP messages through tcpmon, my request message looks
like:

       <?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:SOAP-ENV
="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

 <SOAP-ENV:Body>
  <ns1:runSvc xmlns:ns1="WebSvcIFPort">
   <body xsi:type="ns2:CallRequest" testAttr="MyAttr" xmlns:ns2
="http://oneParmReal/types">
    <parm1 xsi:type="xsd:string">PARM1VAL</programName>
    <parm2 xsi:type="xsd:string">PARM2VAL</machineName>
   </body>
  </ns1:runPgm>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 where I've set parm1, parm2 and the attribute value in my client program.
This looks OK to me, but the
response message has the following fault info:

<SOAP-ENV:Body>
  <SOAP-ENV:Fault>
   <faultcode xmlns:ns1
="http://xml.apache.org/axis/">ns1:Server.userException</faultcode>
   <faultstring>java.lang.NullPointerException</faultstring>
   <detail>
    <ns2:stackTrace xmlns:ns2
="http://xml.apache.org/axis/">java.lang.NullPointerException&#xd;

 at org.xml.sax.helpers.AttributesImpl.getValue(Unknown Source)&#xd;
 at org.apache.axis.message.RPCHandler.onStartChild(Unknown Source)&#xd;
 at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Unknown
Source)&#xd;
 at org.apache.axis.message.SAX2EventRecorder.replay(Unknown Source)&#xd;
 at org.apache.axis.message.MessageElement.publishToHandler(Unknown Source)
&#xd;
 at org.apache.axis.message.RPCElement.deserialize(Unknown Source)&#xd;
 at org.apache.axis.message.RPCElement.getParams(Unknown Source)&#xd;
 at org.apache.axis.providers.java.RPCProvider.processMessage(Unknown
Source)&#xd;
 at org.apache.axis.providers.java.JavaProvider.invoke(Unknown Source)&#xd;
 at org.apache.axis.strategies.InvocationStrategy.visit(Unknown Source)
&#xd;
 at org.apache.axis.SimpleChain.doVisiting(Unknown Source)&#xd;
 at org.apache.axis.SimpleChain.invoke(Unknown Source)&#xd;
 at org.apache.axis.server.AxisServer.invoke(Unknown Source)&#xd;
 at org.apache.axis.transport.http.AxisServlet.doPost(Unknown Source)&#xd;
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)&#xd;
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)&#xd;
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

#xd;
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

#xd;
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

#xd;
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

#xd;
...
</ns2:stackTrace>
   </detail>
  </SOAP-ENV:Fault>

  Axis seems to not be able to figure out the type or value of the
attribute.   Is there something special that I
need to do to get attributes like this to work?  Sorry if this is a dumb
question, but I've been struggling with
this for quite awhile now and decided it was time to ask for help.  I'm
using the very latest nightly drop axis code,
plus the latest xerces jar files also.

Thanks!
Sue



  Susan Reuland
  Dept 48T
  Phone 507-253-2089   Tie 553-2089
  Mail on Lotus Notes: Sue Reuland/Rochester/IBM
  Mail on Internet: sreuland@us.ibm.com



Mime
View raw message