<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: How to modify JAX-WS SOAP-Messages</title>
	<atom:link href="http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/</link>
	<description>Under development by Siegfried Bolz</description>
	<pubDate>Sun, 05 Feb 2012 09:30:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: viral</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-403</link>
		<dc:creator>viral</dc:creator>
		<pubDate>Thu, 24 Nov 2011 13:23:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-403</guid>
		<description>I am looking for logging soap request and response xml.

I tried this but it doesn't work for me.

ByteArrayOutputStream baos = new ByteArrayOutputStream();
msg.writeTo(baos);

it prints blank but webservice works fine and gives me result


anyone have any other solution or api to convert soapmessage to XML using java?</description>
		<content:encoded><![CDATA[<p>I am looking for logging soap request and response xml.</p>
<p>I tried this but it doesn&#8217;t work for me.</p>
<p>ByteArrayOutputStream baos = new ByteArrayOutputStream();<br />
msg.writeTo(baos);</p>
<p>it prints blank but webservice works fine and gives me result</p>
<p>anyone have any other solution or api to convert soapmessage to XML using java?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-352</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 12 Apr 2011 10:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-352</guid>
		<description>Hi a good  article

I try to modify a soap incoming using a Soap Handler


private void logToSystemOut(SOAPMessageContext smc) {

       try {
           
           Boolean outboundProperty = (Boolean) smc.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
           if (outboundProperty.booleanValue()) {
              HttpServletRequest req = (HttpServletRequest) smc.get("javax.xml.ws.servlet.request");

             SOAPMessage msg = ((SOAPMessageContext) smc).getMessage();
              //SOAPMessageContext smc = (SOAPMessageContext) context;
              //SOAPMessage msg = smc.getMessage();
             SOAPPart sp = msg.getSOAPPart();
             
             SOAPEnvelope se = sp.getEnvelope();

raise a next exception
error:Unable to create envelope from given source
by 
Caused by: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

may i help me 

I am  using  metro 1.5 , java 6</description>
		<content:encoded><![CDATA[<p>Hi a good  article</p>
<p>I try to modify a soap incoming using a Soap Handler</p>
<p>private void logToSystemOut(SOAPMessageContext smc) {</p>
<p>       try {</p>
<p>           Boolean outboundProperty = (Boolean) smc.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);<br />
           if (outboundProperty.booleanValue()) {<br />
              HttpServletRequest req = (HttpServletRequest) smc.get(&#8221;javax.xml.ws.servlet.request&#8221;);</p>
<p>             SOAPMessage msg = ((SOAPMessageContext) smc).getMessage();<br />
              //SOAPMessageContext smc = (SOAPMessageContext) context;<br />
              //SOAPMessage msg = smc.getMessage();<br />
             SOAPPart sp = msg.getSOAPPart();</p>
<p>             SOAPEnvelope se = sp.getEnvelope();</p>
<p>raise a next exception<br />
error:Unable to create envelope from given source<br />
by<br />
Caused by: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.</p>
<p>Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.</p>
<p>may i help me </p>
<p>I am  using  metro 1.5 , java 6</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SS</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-246</link>
		<dc:creator>SS</dc:creator>
		<pubDate>Tue, 09 Feb 2010 09:29:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-246</guid>
		<description>More over , is there any way to identify the service name from Soap Fault in the Handler</description>
		<content:encoded><![CDATA[<p>More over , is there any way to identify the service name from Soap Fault in the Handler</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SS</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-245</link>
		<dc:creator>SS</dc:creator>
		<pubDate>Tue, 09 Feb 2010 07:15:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-245</guid>
		<description>Suppose I want to change SOAP response Envelope attribute from   to standard format like  using handler class. Could you please tell me what changes need to be done here? 

Thanks in Advance</description>
		<content:encoded><![CDATA[<p>Suppose I want to change SOAP response Envelope attribute from   to standard format like  using handler class. Could you please tell me what changes need to be done here? </p>
<p>Thanks in Advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajiv</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-168</link>
		<dc:creator>Rajiv</dc:creator>
		<pubDate>Mon, 29 Jun 2009 19:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-168</guid>
		<description>oops the xml tags were ripped in the above - 

&#60;SOAP-ENV:Fault&#62;
  &#60;faultcode&#62;ABC&#60;/faultcode&#62;
  &#60;faultstring&#62;xyz&#60;/faultstring&#62;
&#60;/SOAP-ENV:Fault&#62;</description>
		<content:encoded><![CDATA[<p>oops the xml tags were ripped in the above - </p>
<p>&lt;SOAP-ENV:Fault&gt;<br />
  &lt;faultcode&gt;ABC&lt;/faultcode&gt;<br />
  &lt;faultstring&gt;xyz&lt;/faultstring&gt;<br />
&lt;/SOAP-ENV:Fault&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajiv</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-167</link>
		<dc:creator>Rajiv</dc:creator>
		<pubDate>Mon, 29 Jun 2009 19:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-167</guid>
		<description>I'm trying to get the exception handling to work.  I'm trying to get the below-


  ABC
  xyz
   blah


I created my own exception, and I'm able to set the faultstring. but when I use @HandlerChain(file='xxx.xml') the  faultstring is changed to 

Exception raised from invocation of public java.lang.String .....

could you advise why this could be happening.

Thanks in advace,
Rajiv.</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to get the exception handling to work.  I&#8217;m trying to get the below-</p>
<p>  ABC<br />
  xyz<br />
   blah</p>
<p>I created my own exception, and I&#8217;m able to set the faultstring. but when I use @HandlerChain(file=&#8217;xxx.xml&#8217;) the  faultstring is changed to </p>
<p>Exception raised from invocation of public java.lang.String &#8230;..</p>
<p>could you advise why this could be happening.</p>
<p>Thanks in advace,<br />
Rajiv.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siddhartha</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-165</link>
		<dc:creator>Siddhartha</dc:creator>
		<pubDate>Thu, 25 Jun 2009 13:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-165</guid>
		<description>Hi Siegfried,

This code is able to handle the request &#38; response
but when the webservice is throwing an exception it's not able to handle it.

My WS Code.


@WebService(name = "TestWS",targetNamespace="http://ws.test")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
use = SOAPBinding.Use.LITERAL)
@HandlerChain(name="ServerSOAPHandler",file="../../handler/serversoaphandler.xml")
public class TestWS {
	public String testWs(String str) throws Exception{
		if(some condition){
			throw new Exception("Sidd Exp");
		}
		return str;
	}
}</description>
		<content:encoded><![CDATA[<p>Hi Siegfried,</p>
<p>This code is able to handle the request &amp; response<br />
but when the webservice is throwing an exception it&#8217;s not able to handle it.</p>
<p>My WS Code.</p>
<p>@WebService(name = &#8220;TestWS&#8221;,targetNamespace=&#8221;http://ws.test&#8221;)<br />
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,<br />
use = SOAPBinding.Use.LITERAL)<br />
@HandlerChain(name=&#8221;ServerSOAPHandler&#8221;,file=&#8221;../../handler/serversoaphandler.xml&#8221;)<br />
public class TestWS {<br />
	public String testWs(String str) throws Exception{<br />
		if(some condition){<br />
			throw new Exception(&#8221;Sidd Exp&#8221;);<br />
		}<br />
		return str;<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Diego</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-135</link>
		<dc:creator>Diego</dc:creator>
		<pubDate>Mon, 16 Feb 2009 13:53:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-135</guid>
		<description>Hi, thanks a lot for this part of the code:

ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
msg.writeTo(baos); 

I was trying to write the content of the message to a log. Previously i was using msg.writeTo(System.out), and when I changed my System.out logs to log4J, it was driving me crazy (I haven't even think about dropping the content to an Output Stream variable!).

Now with 
logger.info("Message: " + baos.toString) i can log my messages again.

Best regards,
Diego.</description>
		<content:encoded><![CDATA[<p>Hi, thanks a lot for this part of the code:</p>
<p>ByteArrayOutputStream baos = new ByteArrayOutputStream();<br />
msg.writeTo(baos); </p>
<p>I was trying to write the content of the message to a log. Previously i was using msg.writeTo(System.out), and when I changed my System.out logs to log4J, it was driving me crazy (I haven&#8217;t even think about dropping the content to an Output Stream variable!).</p>
<p>Now with<br />
logger.info(&#8221;Message: &#8221; + baos.toString) i can log my messages again.</p>
<p>Best regards,<br />
Diego.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siegfried Bolz</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-134</link>
		<dc:creator>Siegfried Bolz</dc:creator>
		<pubDate>Sat, 07 Feb 2009 19:23:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-134</guid>
		<description>Hi Dieter,
es müsste möglich sein die SOAP-Message so zu manipulieren das daraus eine Version 1.1 entsteht, allerdings gibt es da große Unterschiede die du beachten must (siehe Links unten). Mit dem ServerSoapHandler müsste diese Manipulation möglich sein.

http://www.w3.org/2003/06/soap11-soap12.html
http://www.idealliance.org/papers/xmle02/dx_xmle02/papers/02-02-02/02-02-02.html

Viele Grüße
Siegfried</description>
		<content:encoded><![CDATA[<p>Hi Dieter,<br />
es müsste möglich sein die SOAP-Message so zu manipulieren das daraus eine Version 1.1 entsteht, allerdings gibt es da große Unterschiede die du beachten must (siehe Links unten). Mit dem ServerSoapHandler müsste diese Manipulation möglich sein.</p>
<p><a href="http://www.w3.org/2003/06/soap11-soap12.html" rel="nofollow">http://www.w3.org/2003/06/soap11-soap12.html</a><br />
<a href="http://www.idealliance.org/papers/xmle02/dx_xmle02/papers/02-02-02/02-02-02.html" rel="nofollow">http://www.idealliance.org/papers/xmle02/dx_xmle02/papers/02-02-02/02-02-02.html</a></p>
<p>Viele Grüße<br />
Siegfried</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dieter</title>
		<link>http://blog.jdevelop.eu/2008/03/08/how-to-modify-jax-ws-soap-messages/comment-page-1/#comment-131</link>
		<dc:creator>Dieter</dc:creator>
		<pubDate>Fri, 06 Feb 2009 08:16:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.jdevelop.eu/?p=67#comment-131</guid>
		<description>Hi Siegfried,

vielen Dank, Dein Beispiel ist aufschlussreich, was das zippen in Jax-Ws angeht. Ich habe aber noch ein anderes Problem zu lösen. Ich muß für einen .net Webservice mit jax-ws eine SOAP-Message in der Version 1.1 anstatt Standard 1.2 erzeugen. Kann ich da was im apt einstellen oder hilft mir die Implementierung des Handlers mit Bezug auf eine SOAP-Version dabei?

Vielen Dank und Grüsse aus Essen

Dieter</description>
		<content:encoded><![CDATA[<p>Hi Siegfried,</p>
<p>vielen Dank, Dein Beispiel ist aufschlussreich, was das zippen in Jax-Ws angeht. Ich habe aber noch ein anderes Problem zu lösen. Ich muß für einen .net Webservice mit jax-ws eine SOAP-Message in der Version 1.1 anstatt Standard 1.2 erzeugen. Kann ich da was im apt einstellen oder hilft mir die Implementierung des Handlers mit Bezug auf eine SOAP-Version dabei?</p>
<p>Vielen Dank und Grüsse aus Essen</p>
<p>Dieter</p>
]]></content:encoded>
	</item>
</channel>
</rss>

