• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pretty Print SOAP message

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is kind of a newbie question... i'm trying to pretty print my request SOAP message after a javax.xml.rpc.GenericHandler implementation adds in some custom headers in my client code.

Any idea how i do this? I'm basically trying to log the contents of the SOAPEnvelope object. Here is the code im working with:

SOAPMessageContext smc = (SOAPMessageContext)context;
SOAPEnvelope se = smc.getMessage().getSOAPPart().getEnvelope();
 
Daniel Larusso
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry... I should have RTFM'ed a little more. SOAPMessage has a function called "writeTo" that takes an OutputStream... Solved the printing problem, but it doesn't pretty print the SOAP message.
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the following code to pretty print the soap message xml (code excerpted from Writer.java samples code with XercesJ 2.8.0 distribution).


The usage for above writer is:
Writing to Stream:

Writing to std out:

where, xmlDoc is of type org.w3c.dom.Document but you can pass a SOAPMessage org.w3c.dom.Node type too.
[ September 11, 2006: Message edited by: Watsh Rajneesh ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic