This code is working for me now, to both encode and decode multiRefs. My deserializer is based on the MapDeserializer included with Axis.


AxisServer server = new AxisServer();
server.setOption(AxisEngine.PROP_DOMULTIREFS, Boolean.TRUE);
MessageContext msgContext = new MessageContext(server);
msgContext.setProperty(AxisEngine.PROP_DOMULTIREFS, Boolean.TRUE);
SOAPEnvelope msg = new SOAPEnvelope();
RPCParam arg = new RPCParam(SOAPFactory.NAMESPACE, WRAP_ELEMENT, data);
RPCElement body = new RPCElement(SOAPFactory.NAMESPACE, "method1", new Object[]{arg});
msg.addBodyElement(body);
StringWriter writer = new StringWriter();


SerializationContext context = new SerializationContext(writer, msgContext);

        TypeMappingRegistry reg = context.getTypeMappingRegistry();
        lastRegistry = reg;
        msg.output(context);

        String messageStr = writer.toString();
        //System.err.println(messageStr);

Reader reader = new StringReader(messageStr);
DeserializationContext dser = new DeserializationContext
(new InputSource(reader), msgContext, org.apache.axis.Message.REQUEST);
dser.parse();
SOAPEnvelope env = dser.getEnvelope();


RPCElement rpcElem = (RPCElement) env.getFirstBody();
MessageElement struct = rpcElem.getChildElement(new QName(SOAPFactory.NAMESPACE, WRAP_ELEMENT));
assertNotNull(struct);


These last three lines are the fix I eventually discovered. Previously, I had been trying to get my deserialized value from the message by calling rpcElem.getParam(WRAP_ELEMENT).getObjectValue() (WRAP_ELEMENT is a String). The object value on the param was always null. Doing it this way, I get my deserialized stuff out without any problems.

Hope this helps.

--Peter



On Dec 15, 2004, at 7:46 AM, Alexander Sherkin wrote:

I guess, our problems may have the same root.

It seems like DeserializerImpl (in Axis 1.2RC2) replaces
multi-references with their definitions in startElement(...) method.
As soon as it realized that it found a multiref (if(href != null) on
line 347), it resolves multiref to ref (line 351) and then publishes
ref to the specified handler (line 369). This ref object seems to be
the corresponding multiref definition. So, it publishes
multi-reference definition to the spcified handler ignoring the actual
multi-reference. Please, correct me if I am wrong.

Thank you.
Alexander.

On Tue, 14 Dec 2004 15:22:34 -0800, Peter Molettiere
<[EMAIL PROTECTED]> wrote:

I'm having similar problems, I think. Maybe we can pool our resources?

On Dec 14, 2004, at 2:24 PM, Alexander Sherkin wrote:
<myElement href="#id3"/>

<multiRef id="id3"
   soapenc:root="0"
   soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
   xsi:type="xsd:short"

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>33</
multiRef>

My multiRefs have the exact same structure, but in debugging my deserialization process, I notice that my deserializer does seem to be deserializing the multiRef properly. My problem is that when I try to call

        RPCElement rpcElem = (RPCElement) env.getFirstBody();
        RPCParam struct = rpcElem.getParam("myElement");

struct ends up being null.

As I can see, org.apache.axis.encoding.DeserializerImpl just replaces
multi-references with their definitions, i.e., it replaces "myElement"
with "multiRef". This is why I am getting "multiRef" instead of
"myElement".

Looking through DeserializerImpl, I don't see where this happens.

Is this behavior normal? If so, how can I get true localName (i.e.
"myElement") from my derserializer?

... I'm not sure about this...

--
Peter Molettiere
Senior Engineer
Truereq, Inc.
http://www.truereq.com/



--
Peter Molettiere
Senior Engineer
Truereq, Inc.
http://www.truereq.com/



Reply via email to