You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ji...@apache.org on 2004/05/13 09:20:56 UTC

[jira] Updated: (WSFX-3) WSDoAllReceiver does not backup processed-header flags

The following issue has been updated:

    Updater: Christof Soehngen (mailto:christof.soehngen@syracom.de)
       Date: Thu, 13 May 2004 12:20 AM
    Comment:
Suggestion to backup and restore the processed-flags
    Changes:
             Attachment changed to WSDoAllReceiver.patch
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/WSFX-3?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/WSFX-3

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: WSFX-3
    Summary: WSDoAllReceiver does not backup processed-header flags
       Type: Improvement

     Status: Unassigned
   Priority: Major

    Project: WSFX
 Components: 
             WSS4J

   Assignee: 
   Reporter: Christof Soehngen

    Created: Thu, 6 May 2004 3:44 AM
    Updated: Thu, 13 May 2004 12:20 AM
Environment: Java 1.4.2
CVS snapshot from 2004/05/05

Description:
WSDoAllReceiver replaces the SOAP-Part of the Axis message with a new SOAP-Part (e.g. after decryption). Must-understand headers, that were marked as processed by previous handlers lose this flag.

Although the WSS4J-docs suggests WSDoAllReceiver as the first handler, there might be special cases where this is not possible (e.g. a replacement for the Axis mapper based on a "target service"-header). 

I therefore suggest saving the original processed-flags and setting them after the replacement of the SOAP-Part, for example with the following code:

Vector processedHeaders = new Vector();
Vector tempHeaders = sm.getSOAPEnvelope().getHeaders();

// save the processed-header flags
for (int i = 0; i < tempHeaders.size(); i++) {
    org.apache.axis.message.SOAPHeaderElement tempHeader = (org.apache.axis.message.SOAPHeaderElement) tempHeaders.elementAt(i); 
    if (tempHeader.isProcessed()) {
        processedHeaders.add(tempHeader.getName());
        processedHeaders.add(tempHeader.getNamespaceURI());
    } 
}

// Existing code (replace SOAP-Part) comes here ...
SOAPPart sPart = (org.apache.axis.SOAPPart) sm.getSOAPPart();

ByteArrayOutputStream os = new ByteArrayOutputStream();
XMLUtils.outputDOM(doc, os, true);
sPart.setCurrentMessage(os.toByteArray(), SOAPPart.FORM_BYTES);
if (doDebug) {
    log.debug("Processed received SOAP request");
    log.debug(org.apache.axis.utils.XMLUtils.PrettyDocumentToString(doc));
}

// set the original processed-header flags
for (int i = 0; i < processedHeaders.size(); i = i + 2) {
    String localname = (String) processedHeaders.elementAt(i);
    String namespace =(String) processedHeaders.elementAt(i + 1);
		
    org.apache.axis.message.SOAPHeaderElement tempHeader = (org.apache.axis.message.SOAPHeaderElement) sm.getSOAPEnvelope().getHeaderByName(namespace, localname); 
    tempHeader.setProcessed(true);
}


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira