axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kris Melotte" <kris.melo...@expandedmedia.com>
Subject RE: samples.encoding with samples.userguide5 problem
Date Thu, 21 Feb 2002 17:46:52 GMT
Sorry, this was not the solution. Is still have the NullPointerException.

-----Original Message-----
From: Kris Melotte 
Sent: Thursday, February 21, 2002 5:49 PM
To: axis-user@xml.apache.org
Subject: RE: samples.encoding with samples.userguide5 problem


I solved this problem:

it looks like the <typeMapping> in the .wsdd requires the serializer and deserializer
class instead of the factories as stated in the user-guide documentation.

Does anybody know why you don't need to specify the factories in the deployment descriptor?

best regards,
kris

-----Original Message-----
From: Kris Melotte 
Sent: Wednesday, February 20, 2002 6:25 PM
To: axis-user@xml.apache.org
Subject: samples.encoding with samples.userguide5 problem


Hello,

1. I tried the samples.encoding.TestSer example and this worked fine.
2. Next, I changed the samples.userguide5 example to use the Data custom mapping
	- I added a property data to the Order. bean with getter and setter
	- added this to Client.java:
        QName qnd = new QName("urn:BeanService","Data");
        call.registerTypeMapping(samples.encoding.Data.class, qnd,
            new samples.encoding.DataSerFactory(),
            new samples.encoding.DataDeserFactory());
	- added this to deploy.wsdd:
		  <typeMapping qname="myNS:Data" xmlns:myNS="urn:BeanService" 						languageSpecificType="java:samples.encoding.Data"

			serializer="samples.encoding.DataSer" 
			deserializer="samples.encoding.DataDeserFactory"/>	
3. Next I deployed the service

Then, the client gives this error: 
	Error : java.lang.NullPointerException 

What am I doing wrong?

Best regards,
Kris


Request:
POST /axis/servlet/AxisServlet HTTP/1.0 Content-Length: 1772 Host: localhost Content-Type:
text/xml; charset=utf-8 SOAPAction: ""  <?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">
 <SOAP-ENV:Body>
  <ns1:processOrder xmlns:ns1="OrderProcessor">
   <arg1 href="#id0"/>
  </ns1:processOrder>
  <multiRef id="id0" SOAP-ENC:root="0" xsi:type="ns2:Order" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="urn:BeanService">
   <customerName xsi:type="xsd:string">Glen Daniels</customerName>
   <shippingAddress xsi:type="xsd:string">275 Grove Street, Newton, MA</shippingAddress>
   <itemCodes xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2]">
    <item xsi:type="xsd:string">mp3jukebox</item>
    <item xsi:type="xsd:string">1600mahBattery</item>
   </itemCodes>
   <quantities xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:int[2]">
    <item xsi:type="xsd:int">1</item>
    <item xsi:type="xsd:int">4</item>
   </quantities>
   <data href="#id1"/>
  </multiRef>
  <multiRef id="id1" SOAP-ENC:root="0" xsi:type="ns3:Data" xmlns:ns3="urn:BeanService"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <stringMember xsi:type="xsd:string">String member</stringMember>
   <floatMember xsi:type="xsd:float">1.23</floatMember>
   <dataMember href="#id2"/>
  </multiRef>
  <multiRef id="id2" SOAP-ENC:root="0" xsi:type="ns4:Data" xmlns:ns4="urn:BeanService"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <stringMember xsi:type="xsd:string">another str member</stringMember>
   <floatMember xsi:type="xsd:float">4.56</floatMember>
   <dataMember xsi:nil="true"/>
  </multiRef>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Response:
HTTP/1.0 500 Internal Server Error Content-Type: text/xml; charset=utf-8 Content-Length: 3330
Servlet-Engine: Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java 1.3.1; Windows 2000 5.0
x86; java.vendor=Sun Microsystems Inc.)  <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 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">
 <SOAP-ENV:Body>
  <SOAP-ENV:Fault>
   <SOAP-ENV:faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.userException</SOAP-ENV:faultcode>
   <SOAP-ENV:faultstring>java.lang.NullPointerException</SOAP-ENV:faultstring>
   <SOAP-ENV:detail>
    <ns2:stackTrace xmlns:ns2="http://xml.apache.org/axis/">java.lang.NullPointerException&#xd;
	at samples.encoding.DataDeser.onStartChild(DataDeser.java:59)&#xd;
	at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:789)&#xd;
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:197)&#xd;
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:444)&#xd;
	at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:332)&#xd;
	at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:802)&#xd;
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:197)&#xd;
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:444)&#xd;
	at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:332)&#xd;
	at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:802)&#xd;
	at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:197)&#xd;
	at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:444)&#xd;
	at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:118)&#xd;
	at org.apache.axis.message.RPCElement.getParams(RPCElement.java:142)&#xd;
	at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:114)&#xd;
	at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:254)&#xd;
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)&#xd;
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:151)&#xd;
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:118)&#xd;
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:287)&#xd;
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:535)&#xd;
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)&#xd;
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)&#xd;
	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)&#xd;
	at org.apache.tomcat.core.Handler.service(Handler.java:287)&#xd;
	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)&#xd;
	at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)&#xd;
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)&#xd;
	at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)&#xd;
	at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)&#xd;
	at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)&#xd;
	at java.lang.Thread.run(Thread.java:484)&#xd;
</ns2:stackTrace>
   </SOAP-ENV:detail>
  </SOAP-ENV:Fault>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


I checked with the debugger and the exception is thrown at the moment that I step into line
59. 


<snippet DataDeser.java>
55:        // These can come in either order.
56:        Deserializer dSer = context.getDeserializerForType(typeQName);
57:        try {
58:            FieldTarget ft = new FieldTarget(value, localName);
59:            dSer.registerValueTarget(ft);
60:        } catch (NoSuchFieldException e) {
61:            throw new SAXException(e);
62:        }

</snippet>

Mime
View raw message