0 Replies Latest reply: Aug 27, 2010 5:37 PM by tgresham RSS

    SOAPMessage.writeTo not functioning

    tgresham
      WebLogic Server 11.1.1.3.0 (PS2)

      I have a client proxy with a custom handler for logging the web service messages. Using commonly published patterns (includeing from the Oracle Support web site), I use SOAPMessage.writeTo() to generate the XML message. However, nothing gets written. Here is an except of the handler code:
      --------------
           public boolean handleMessage( SOAPMessageContext ctx )
           {
                System.out.println( "Message context is " + ctx.getClass().getName() );
                boolean outbound = ( ( Boolean )ctx.get( SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY ) ).booleanValue();
                QName service = ( QName )ctx.get( SOAPMessageContext.WSDL_SERVICE );
                String ws = service.getLocalPart();
                String dir = outbound ? "Outbound" : "Inbound";
                System.out.println( dir + " message [" + ws + "]" );
                SOAPMessage soapmsg = ctx.getMessage();
                if( soapmsg == null )
                     System.out.println( dir + " client soap message is null for [" + ws + "]" );
                else
                     writeXML( ctx, ws, soapmsg, outbound );

                return true;
           }

           private void writeXML( SOAPMessageContext ctx, String ws, SOAPMessage msg, boolean outbound )
           {
                try
                {
                     System.out.println( "Writing message content:");
                     ByteArrayOutputStream baos = new ByteArrayOutputStream();
                     msg.writeTo( baos );
                     baos.flush();

                     System.out.println( baos.toString() );

                }
                catch( IOException ioe )
                {
                     System.out.println( ws + ": I/O Exception: " + ioe.getMessage() );
                }
                catch( SOAPException e )
                {
                     System.out.println( ws + ": Soap exception logging message: " + e.getMessage() );
                }
           }
      -----------
      The output generated is:
      -----------
      Message context is com.sun.xml.ws.handler.SOAPMessageContextImpl
      Outbound message [AuthenticationService]
      Writing message content:

      Message context is com.sun.xml.ws.handler.SOAPMessageContextImpl
      Inbound message [AuthenticationService]
      Writing message content:

      Success!
      User Exists
      Process exited with exit code 0.
      -------------

      I believe this issue occurred after implementing PS2. Has anyone seen this problem or is there something missing here?

      Regards,
      Tom Gresham