I am having a problem getting my Deserializer to be used
after registering it’s Factory with the typeMapping element in the
dd. I have tried many different combinations but regardless of what I do
the SimpleDeserializer is selected. I believe this is happening because
axis is interpreting the entire message as a String instead of my desired type.
I am somewhat new to axis so any help from those of you who really
understand the framework would be much appreciated. There have been several similar threads on this with this
one being the closest to my problem, however the solution needs to be on the
server not the client: List: axis-user Subject: (resolved) RE: deserializing
nested complex types From: Mitch Gitman
<mgitman () Date: 2002-12-06 21:36:19 From my dd: <typeMapping
qname="baldue:BalanceDueMsg"
xmlns:baldue="http://balancedue.websvc.csp.leapwireless.com"
languageSpecificType="java:com.leapwireless.csp.websvc.balancedue.BalanceDueMsgType"
serializer="com.leapwireless.csp.websvc.balancedue.axis.BalanceDueSerializerFactory"
deserializer="com.leapwireless.csp.websvc.balancedue.axis.BalanceDueDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> My web service class’ relevant method signature (this
is a java rpc service): public BalanceDueMsgType getBalanceDue(BalanceDueMsgType
msgT) I am using JDK 1.4.2, JBoss 3.2.5/JBoss.Net/Axis 1.1 Basically my DeserializerFactory/Deserializer never gets a chance
to deal with the incoming request message (java rpc web service). The
SimpleDeserializer always gets these and returns a this error when dealing with
the nested type in the message: org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize. I set a breakpoint in the Eclipse debugger in the
SimpleDeserializer onChildElement method (which throws the exception) and this
is what the variables look like in that method: this= SimpleDeserializer (id=212) activeDeserializers=
HashSet (id=229) attributeMap=
null cacheStringDSer=
null cacheXMLType=
null componentsReadyFlag=
false constructor=
Constructor (id=236) defaultType=
null id=
null isEnded=
false isHref=
false isNil=
false javaType=
Class (java.lang.String) (id=200)//Based on other problems like this one I
believe the problem is here, i.e. axis thinks this is a string type. myElement=
null myElements=
null myIndex=
0 propertyMap=
null targets=
Vector (id=241) typeDesc=
null val=
CharArrayWriter (id=246) value=
null xmlType=
QName (id=249) localPart=
"string" namespaceURI=
"http://www.w3.org/2001/XMLSchema" namespace=
"http://balancedue.websvc.csp.leapwireless.com" localName= "BalanceDueMsg" prefix= "" attributes= NullAttributes (id=205) context= DeserializationContextImpl (id=213) Most interesting here are the values of the namespace and
localName local variables (which are the ones I want) and the value of the
SimpleDeserializer.javaType field which is set to a String when it should
be BalanceDueMsgType. Based on the debugger variables above, the value of the curElement
field inside of the context variable has this data (which is what was intended): <BalanceDueMsg
xmlns="http://balancedue.websvc.csp.leapwireless.com">
<accountNum>ACCOUNTNUMBER</accountNum>
<sessionId>STRING</sessionId>
<balanceData/>
</BalanceDueMsg> The client I am using is a little gizmo in Oxygen XML that prepares
the raw xml so you can edit it manually and then sends it… so I am not
using any wsdl2java stubs or anything like that. This tool bases
everything off the wsdl/schema and is more rigorous than most in terms of
validation. Also the information is getting to the correct place in the
correct way with the exception of the Deserializer that is chosen. Here is the SOAP input and response: <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body>
<oxy:getBalanceDue
xmlns:oxy="http://balancedue.websvc.csp.leapwireless.com"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<msgT>
<BalanceDueMsg
xmlns="http://balancedue.websvc.csp.leapwireless.com">
<accountNum>ACCOUNTNUMBER</accountNum>
<sessionId>STRING</sessionId>
<balanceData/>
</BalanceDueMsg>
</msgT>
</oxy:getBalanceDue> </SOAP-ENV:Body> </SOAP-ENV:Envelope> <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>org.xml.sax.SAXException: SimpleDeserializer
encountered a child element, which is NOT expected, in something
it was trying to deserialize.</faultstring>
<detail/>
</soapenv:Fault> </soapenv:Body> </soapenv:Envelope> Mike Cassisa Software Engineer Cricket Communications 858-882-6096 Office A good solution applied with vigor now is better than a perfect solution applied ten minutes later.
- General George S. Patton Jr. |
- Re: Custom Deserializer/typeMapping problem Mike Cassisa
- Re: Custom Deserializer/typeMapping problem Bill Keese
- Re: Custom Deserializer/typeMapping pro... Sebastien Mayemba Mbokoso