users@jax-ws.java.net

Re: XWSS prints SOAP message

From: V B Kumar Jayanti <Vbkumar.Jayanti_at_Sun.COM>
Date: Fri, 15 Jun 2007 14:16:54 +0530

Erik Eriksson XB (TN/EAB) wrote:

> Hi,
>
> When I'm securing my message in my web service client with XWSS it
> always System.out prints the SOAP message that I send and receive. Can
> I somehow turn on and off this "feature"?
>
> Code snippet from a class that implements
> SOAPHandler<SOAPMessageContext>:
>
> public boolean handleMessage(SOAPMessageContext context) {
>
> try {
> XWSSProcessorFactory xwssProcFactory =
> XWSSProcessorFactory.newInstance();
> XWSSProcessor xwssProc =
> xwssProcFactory.createProcessorForSecurityConfiguration(xwssInputStream,
> null);
>
In your security configuration file there is an attribute called
dumpMessages. If it is set to true then it will print the messages. If
set to false it won't.

Eg. :

<xwss:SecurityConfiguration dumpMessages="false"
xmlns:xwss="http://java.sun.com/xml/ns/xwss/config" >
    <xwss:Sign>
        <xwss:X509Token certificateAlias="xws-security-client"/>
    </xwss:Sign>
    <xwss:RequireSignature/>
</xwss:SecurityConfiguration>

The default value for dumpMessages is false. All our samples we set it
to true for illustration.

Thanks.


> xwssInputStream.reset();
> ProcessingContext procContext = new
> ProcessingContext();
>
> procContext.setSOAPMessage(context.getMessage());
>
> //secure the message.
> xwssProc.secureOutboundMessage(procContext);
> } catch (XWSSecurityException xwssE) {
> System.err.println(xwssE.getMessage());
> } catch (IOException e) {
> System.err.println(e.getMessage());
> }
>
> return true;
> }
>
> Regards
> Erik Eriksson
>