Reputation: 2015
We are using axis 1.4 for our WS implementation. Whenever the WS request fails we would like to add to our logging the XML of the actual request that was sent. To do that we of course need to be able to transform the request object into its XML representation, same as it will be sent later to the server. In most cases this is to be able later copy-paste it to some other tool, for debug, so it is important to have exactly same XML string as it would be sent to the server. Hope that was clear enough. Thank you.
Upvotes: 0
Views: 2465
Reputation: 2015
OK, answering my own question: To do so for Axis-1.4, according to the example posted by NJSC, need to replace SerializationContextImpl with just a org.apache.axis.encoding.SerializationContext.
qname = removeNamespaces ? new QName(lname) : new QName(qname.getNamespaceURI(), lname);
final AxisServer server = new AxisServer();
final BeanSerializer ser = new BeanSerializer(obj.getClass(), qname, typeDesc);
final SerializationContext ctx = new SerializationContext(outStr, new MessageContext(server));
ctx.setSendDecl(false);
ctx.setDoMultiRefs(false);
ctx.setPretty(prettyPrint);
Upvotes: 2