Hello,

I am using axis 1.4 and my doubt is about something that should be
straightforward but so far i have been unable to accomplish.

I log into a database the soap message sent to the web service and the
soap message response.

What i am trying to do is get those two soap messages (two xml's), and
transforming each one of them into the object, as if the service was
invoked.

It would really appreciate if someone could tell me if this is
possible or is not possible in this axis version, and if it was
possible how this can be accomplished.

So far my best options have been:

Option 1)

public class Topota {
       public static final String CALL_SEND = "here goes the soap message";

       public static final void main  (String[] args){
               TypeDesc plCatTypeDesc =
SimulationMultiTarifRequest.getTypeDesc();
               XMLReader reader;
               ObjectTypeThatIWant toUse = null;
               try {
                       BeanDeserializer deserializer = new
BeanDeserializer(SimulationMultiTarifRequest.class,
plCatTypeDesc.getXmlType(),
plCatTypeDesc);
                       reader = XMLReaderFactory.createXMLReader();
                       reader.setContentHandler(deserializer);
                       reader.setErrorHandler(deserializer);
                       reader.setEntityResolver(deserializer);
                       reader.setDTDHandler(deserializer);

                       InputSource s = new InputSource(new
StringReader(CALL_SEND));
                       reader.parse(s);
                       toUse = (ObjectTypeThatIWant)deserializer.getValue();
               }
               catch (SAXException e) {
                       e.printStackTrace();
               }
               catch (IOException ioe) {
                       ioe.printStackTrace();
               }
       }
}


The problem with this code is that only returns the top level object
and all the rest are not informed. No errors generated whatsoever.



Option 2)

public class MasTopota2 {

       public static final String CALL_SEND = "here goes the soap message";

       public static Object serializeFromBinding(Object object, QName
qname)  throws Exception {

               MessageContext msgContext = new MessageContext(new AxisServer());
               msgContext.setEncodingStyle(null);

               TypeMappingRegistry tmr = new TypeMappingRegistryImpl();
               msgContext.setTypeMappingRegistry(tmr);

               InputSource s = new InputSource(new StringReader(CALL_SEND));

               DeserializationContext deser = new DeserializationContext(s,
msgContext, "request");
               deser.parse();

               return null;
       }

       public static void main (String[] args){
               try{
                       ObjectThatIWant sm = new ObjectThatIWant();
                       Object result = MasTopota2.serializeFromBinding(sm, new
javax.xml.namespace.QName("Package of the qname", "Name of the
qname"));
                       System.out.println(result);
               }
               catch(Exception e){
                       e.printStackTrace();
               }
       }
}

The problem here is that i do not know if this code is correct and if
there is some possible method to retrieve the object after doing the
parse. No errors generated neither.

Any help would be greatly appreciate, specially if it is not possible
to do something so basic (at least conceptually) with axis 1.4.

Kind regards,

Reply via email to