Oops, forgot to mention you will also need test.encoding.RETURN in your classpath...

Thanks,
dims

--- Davanum Srinivas <[EMAIL PROTECTED]> wrote:
> Team,
> 
> Am using latest CVS. When i call message.getSOAPPart().getAsString(), am getting bad 
>XML back.
> See
> output below. The problem seems to be that the recorder in SOAPEnvelope still has 
>stuff in it
> that
> it wants to play back. When i call message.getSOAPEnvelope().setRecorder(null); 
>all's well. See
> enclosed sample to recreate the problem.
> 
> Thanks,
> dims
> 
> ===============
> <?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:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
>xmlns:xsd-cr="http://www.w3.org/2000/10/XMLSchema";
> xmlns:xsd-lc="http://www.w3.org/1999/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
> <SOAP-ENV:Body>
> <ser-root:SrvResponse xmlns:ser-root="urn:test.encoding">
>   <ser-root:RETURN xsi:type="ser-root:RETURN">
>     <TYPE xsi:type="xsd:string">000</TYPE>
>     <ID xsi:type="xsd:string">001</ID>
>     <NUMBER xsi:type="xsd:string">002</NUMBER>
>     <MESSAGE xsi:type="xsd:string">003</MESSAGE>
>     <LOG_NO xsi:type="xsd:string">004</LOG_NO>
>     <LOG_MSG_NO xsi:type="xsd:string">005</LOG_MSG_NO>
>     <MESSAGE_V1 xsi:type="xsd:string">006</MESSAGE_V1>
>     <MESSAGE_V2 xsi:type="xsd:string">007</MESSAGE_V2>
>     <MESSAGE_V3 xsi:type="xsd:string">008</MESSAGE_V3>
>     <MESSAGE_V4 xsi:type="xsd:string">009</MESSAGE_V4>
>   </ser-root:RETURN>
> </ser-root:SrvResponse></SOAP-ENV:Body>
> </SOAP-ENV:Envelope><ser-root:SrvResponse xmlns:ser-root="urn:test.encoding">
>   <ser-root:RETURN xsi:type="ser-root:RETURN"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>     <TYPE xsi:type="xsd:string">000</TYPE>
>     <ID xsi:type="xsd:string">001</ID>
>     <NUMBER xsi:type="xsd:string">002</NUMBER>
>     <MESSAGE xsi:type="xsd:string">003</MESSAGE>
>     <LOG_NO xsi:type="xsd:string">004</LOG_NO>
>     <LOG_MSG_NO xsi:type="xsd:string">005</LOG_MSG_NO>
>     <MESSAGE_V1 xsi:type="xsd:string">006</MESSAGE_V1>
>     <MESSAGE_V2 xsi:type="xsd:string">007</MESSAGE_V2>
>     <MESSAGE_V3 xsi:type="xsd:string">008</MESSAGE_V3>
>     <MESSAGE_V4 xsi:type="xsd:string">009</MESSAGE_V4>
>   </ser-root:RETURN>
> </ser-root:SrvResponse>
> ===============
> 
> =====
> Davanum Srinivas - http://xml.apache.org/~dims/
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Movies - coverage of the 74th Academy Awards®
> http://movies.yahoo.com/> package test.encoding;
> 
> import org.apache.axis.Constants;
> import org.apache.axis.Message;
> import org.apache.axis.MessageContext;
> import org.apache.axis.encoding.TypeMapping;
> import org.apache.axis.encoding.TypeMappingRegistry;
> import org.apache.axis.message.RPCElement;
> import org.apache.axis.message.SOAPEnvelope;
> import org.apache.axis.server.AxisServer;
> 
> import javax.xml.rpc.namespace.QName;
> import java.util.Vector;
> 
> /**
>  * Test deserialization of SOAP responses
>  */
> public class TestOutput {
>     private static AxisServer server = new AxisServer();
>     private static String header =
>             "<?xml version=\"1.0\"?>\n" +
>             "<SOAP-ENV:Envelope\n" +
>             "xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n"; +
>             "xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"\n"; +
>             "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n"; +
>             "xmlns:xsd-cr=\"http://www.w3.org/2000/10/XMLSchema\"\n"; +
>             "xmlns:xsd-lc=\"http://www.w3.org/1999/XMLSchema\"\n"; +
>             "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"; +
>             
>"SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\";>\n" +
>             "<SOAP-ENV:Body>\n";
>     private static String footer =
>             "</SOAP-ENV:Body>\n" +
>             "</SOAP-ENV:Envelope>\n";
>     private static String response =
>             "<ser-root:SrvResponse xmlns:ser-root=\"urn:test.encoding\">\n" +
>             "  <ser-root:RETURN xsi:type=\"ser-root:RETURN\">\n" +
>             "    <TYPE xsi:type=\"xsd:string\">000</TYPE>\n" +
>             "    <ID xsi:type=\"xsd:string\">001</ID>\n" +
>             "    <NUMBER xsi:type=\"xsd:string\">002</NUMBER>\n" +
>             "    <MESSAGE xsi:type=\"xsd:string\">003</MESSAGE>\n" +
>             "    <LOG_NO xsi:type=\"xsd:string\">004</LOG_NO>\n" +
>             "    <LOG_MSG_NO xsi:type=\"xsd:string\">005</LOG_MSG_NO>\n" +
>             "    <MESSAGE_V1 xsi:type=\"xsd:string\">006</MESSAGE_V1>\n" +
>             "    <MESSAGE_V2 xsi:type=\"xsd:string\">007</MESSAGE_V2>\n" +
>             "    <MESSAGE_V3 xsi:type=\"xsd:string\">008</MESSAGE_V3>\n" +
>             "    <MESSAGE_V4 xsi:type=\"xsd:string\">009</MESSAGE_V4>\n" +
>             "  </ser-root:RETURN>\n" +
>             "</ser-root:SrvResponse>";
> 
>     public static void main(String[] args) throws Exception {
>         TypeMappingRegistry tmr = server.getTypeMappingRegistry();
>         TypeMapping tm = (TypeMapping) tmr.createTypeMapping();
>         tm.setSupportedNamespaces(new String[]{Constants.URI_CURRENT_SOAP_ENC});
>         tmr.register(Constants.URI_CURRENT_SOAP_ENC, tm);
>         tm.register(test.encoding.RETURN.class,
>                 new QName("urn:test.encoding", "RETURN"),
>                 new org.apache.axis.encoding.ser.BeanSerializerFactory(
>                         test.encoding.RETURN.class,
>                         new QName("urn:test.encoding", "RETURN")),
>                 new org.apache.axis.encoding.ser.BeanDeserializerFactory(
>                         test.encoding.RETURN.class,
>                         new QName("urn:test.encoding", "RETURN")));
> 
>         Message message = new Message(header + response + footer);
>         message.setMessageContext(new MessageContext(server));
> 
>         SOAPEnvelope envelope = (SOAPEnvelope) 
>message.getSOAPPart().getAsSOAPEnvelope();
>         RPCElement body = (RPCElement) envelope.getFirstBody();
>         Vector arglist = body.getParams();
> 
>         //message.getSOAPEnvelope().setRecorder(null);
>         String xml = message.getSOAPPart().getAsString();
>         System.out.println("===============");
>         System.out.println(xml);
>         System.out.println("===============");
>     }
> }
> 


=====
Davanum Srinivas - http://xml.apache.org/~dims/

__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

Reply via email to