You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Martin Gainty <mg...@hotmail.com> on 2012/09/28 23:27:48 UTC

RE: No headers in response

Yes..I always hardcoded those values in the descriptor...but the maven-mar-plugin should reconfigure axis2.xml to include  <module ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400


Martin, I’ll take a look at the Rampart checks but I am also having a problem with no ws-addressing in the response and that’s in Axis2 which I can’t get loaded because of maven problems. I do see success in the older versions (1.5.1). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400Martin, This looks like client side testing. I have no problem on the client. It’s my service whose response has no headers. The client is much easier to deal with as one tends to use code and for that there is great help from Eclipse and javadoc. The service, on the other hand, one usually has to use xml to control all behaviors and that is very difficult (difficult in the sense one has no idea what, for example, the possible parameters, elements, attributes, etc. are and what they do…and no help from Eclipse like there is with code). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to reconstruct our mustUnderstand later on
        String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results = engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd, rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned  on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
                        inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq = (String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq)) {
            try {
                
                String cancelAction = TrustUtil.getWSTNamespace(rmd.getWstVersion()) + RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt = msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if (Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey = RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId = (String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd, tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element) rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode = rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode, (Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(), config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400Martin, I tried that as well and the response still came back with no headers. Somehow the STS service manages to get a header in the response (missing must understand in the addressing); but it’s a start.  Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Hi Brian
i'll take the last question.. from axis2.xml i assume you have included optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new java.io.File(System.getProperty("basedir",".") + "/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx =org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing module should now be true

        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);        
        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(), org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTest.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/</wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action</wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400 I am re-opening a question I saw no answer to asked in this forum quite a while  ago. In the STS service requesting a SMAL20 token the response is okay.But in the service that needs to have the SAML20 token, the response has no headers at all. This is in spite of the must understand setting in the client headers in both the addressing and security part. Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the <parameter name="includeOptionalHeaders">true</parameter> in the service.xml does not help (though that is what I used programmatically on the client side to generate the correct addressing headers).Is this a bug or what am I doing wrong in the configuration? Thanks, Brian ReinholdNo virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12 		 	   		  

RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Martin,

 

I set the ‘debug to file’ in the log4j and once again I see the correct
message being dispatched by Rampart to axis2. I do have the source code for
axiom up and running and I don’t see any suspicious losses in there.

 

Here is the log from the point where rampart hands the message off to axis2.
Any ideas where it might be getting stripped in the subsequent routines?
(The client side is SO much easier because you can set it in code and you
know where and when it gets done!)

 

2012-09-29 10:32:58,928 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter  - Calling
MTOMXMLStreamWriter.flush

 

 

2012-09-29 10:32:58,928 [http-nio-8443-exec-6] DEBUG
org.apache.rampart.MESSAGE  - *********************** RampartSender sent out


<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header
xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true"><wsu:Timestamp
wsu:Id="TS-3"><wsu:Created>2012-09-29T14:32:58.926Z</wsu:Created><wsu:Expire
s>2012-09-29T14:37:58.926Z</wsu:Expires></wsu:Timestamp></wsse:Security><wsa
:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action><wsa:Relates
To>urn:uuid:dd4813d2-5094-4338-8abe-024782ed4fca</wsa:RelatesTo></soapenv:He
ader><soapenv:Body><pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120929103258.915-0500||ACK^R01^ACK|00520120929103254598|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00520120929103254598&
#xd;</pcd:CommunicatePCDDataResponse></soapenv:Body></soapenv:Envelope>

 

BR>This is good! The header is in place and correct.

 

2012-09-29 10:32:58,928 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Checking
post-conditions for phase "Security"

2012-09-29 10:32:58,928 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.client.Options  - getAction
(urn:ihe:pcd:2010:CommunicatePCDDataResponse) from
org.apache.axis2.client.Options@5051207c

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.context.MessageContext  - SoapAction is
(urn:ihe:pcd:2010:CommunicatePCDDataResponse)

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.CommonsHTTPTransportSender  - SOAP Action
from messageContext : (urn:ihe:pcd:2010:CommunicatePCDDataResponse)

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.OMOutputFormat  - Start getContentType: OMOutputFormat [
mimeBoundary =null rootContentId=null doOptimize=false doingSWA=false
isSOAP11=false charSetEncoding=UTF-8 xmlVersion=null contentType=null
ignoreXmlDeclaration=false autoCloseWriter=true actionProperty=null
optimizedThreshold=0]

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.OMOutputFormat  - getContentType= {application/soap+xml}
OMOutputFormat [ mimeBoundary =null rootContentId=null doOptimize=false
doingSWA=false isSOAP11=false charSetEncoding=UTF-8 xmlVersion=null
contentType=application/soap+xml ignoreXmlDeclaration=false
autoCloseWriter=true actionProperty=null optimizedThreshold=0]

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter  - contentType from the
OMOutputFormat =application/soap+xml

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter  - contentType returned
=application/soap+xml; charset=UTF-8;
action="urn:ihe:pcd:2010:CommunicatePCDDataResponse"

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter  - start writeTo()

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter  -   preserve=false

2012-09-29 10:32:58,929 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter  -   isOptimized=false

2012-09-29 10:32:58,930 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter  -   isDoingSWA=false
BR>(I thought this might be secure web addressing but it’s
attachment-related)

2012-09-29 10:32:58,930 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter  - Creating MTOMXMLStreamWriter

2012-09-29 10:32:58,930 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter  - OutputStream =class
java.io.BufferedOutputStream

2012-09-29 10:32:58,930 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter  - OMFormat = OMOutputFormat [
mimeBoundary =null rootContentId=null doOptimize=false doingSWA=false
isSOAP11=false charSetEncoding=UTF-8 xmlVersion=null
contentType=application/soap+xml ignoreXmlDeclaration=false
autoCloseWriter=true actionProperty=null optimizedThreshold=0]

2012-09-29 10:32:58,930 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter  - preserveAttachments = false

2012-09-29 10:32:58,930 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.util.StAXUtils  - XMLStreamWriter is
org.apache.axiom.util.stax.dialect.Woodstox3StreamWriterWrapper

2012-09-29 10:32:58,931 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter  - Calling
MTOMXMLStreamWriter.flush

2012-09-29 10:32:58,932 [http-nio-8443-exec-6] DEBUG
org.apache.axiom.om.impl.MTOMXMLStreamWriter  - close

2012-09-29 10:32:58,933 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.http.SOAPMessageFormatter  - end writeTo()

2012-09-29 10:32:58,933 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.TransportUtils  - Found RequestResponseTransport
setting response written

2012-09-29 10:32:58,933 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "Security"

2012-09-29 10:32:58,933 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'Apache Rampart outflow handler' in Phase
'Security'

2012-09-29 10:32:58,933 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SecurityOutHandler' in Phase 'Security'

2012-09-29 10:32:58,933 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "MessageOut"

2012-09-29 10:32:58,933 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'AddressingOutHandler' in Phase 'MessageOut'

2012-09-29 10:32:58,934 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "PolicyDetermination"

2012-09-29 10:32:58,934 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "RMPhase"

2012-09-29 10:32:58,934 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SandeshaOutHandler' in Phase 'RMPhase'

2012-09-29 10:32:58,934 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "OperationOutPhase"

2012-09-29 10:32:58,934 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'DispatchOperationHandler' in Phase
'OperationOutPhase'

2012-09-29 10:32:58,934 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "soapmonitorPhase"

2012-09-29 10:32:58,934 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=8822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'null' in Phase 'soapmonitorPhase'

2012-09-29 10:32:58,937 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "soapmonitorPhase"

2012-09-29 10:32:58,937 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'null' in Phase 'soapmonitorPhase'

2012-09-29 10:32:58,937 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "OperationInPhase"

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'MustUnderstandChecker' in Phase
'OperationInPhase'

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "RMPhase"

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SandeshaInHandler' in Phase 'RMPhase'

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "Dispatch"

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'Post dispatch security verification handler' in
Phase 'Dispatch'

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'MustUnderstandValidationDispatcher' in Phase
'Dispatch'

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'GenericProviderDispatcher' in Phase 'Dispatch'

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'HTTPLocationBasedDispatcher' in Phase 'Dispatch'

2012-09-29 10:32:58,938 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'AddressingValidationHandler' in Phase 'Dispatch'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SOAPMessageBodyBasedDispatcher' in Phase
'Dispatch'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'RequestURIOperationDispatcher' in Phase
'Dispatch'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SOAPActionBasedDispatcher' in Phase 'Dispatch'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'RequestURIBasedDispatcher' in Phase 'Dispatch'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SandeshaGlobalInHandler' in Phase 'Dispatch'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "PreDispatch"

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "Security"

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SecurityInHandler' in Phase 'Security'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'Apache Rampart inflow handler' in Phase
'Security'

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "Addressing"

2012-09-29 10:32:58,939 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'AddressingBasedDispatcher' in Phase 'Addressing'

2012-09-29 10:32:58,940 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SequenceIDDispatcher' in Phase 'Addressing'

2012-09-29 10:32:58,940 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'AddressingInHandler' in Phase 'Addressing'

2012-09-29 10:32:58,940 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() in Phase "Transport"

2012-09-29 10:32:58,940 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'MessageContextCorrectionHandler' in Phase
'Transport'

2012-09-29 10:32:58,940 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'SOAPActionBasedDispatcher' in Phase 'Transport'

2012-09-29 10:32:58,940 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.engine.Phase  - [MessageContext:
logID=9822d3077c839197f171571e512483d3de4cfec10c57a816] Invoking
flowComplete() for Handler 'RequestURIBasedDispatcher' in Phase 'Transport'

2012-09-29 10:32:58,940 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.TransportUtils  - Found RequestResponseTransport
returning isResponseWritten()

2012-09-29 10:32:58,941 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.TransportUtils  - Entering deleteAttachments()

2012-09-29 10:32:58,941 [http-nio-8443-exec-6] DEBUG
org.apache.axis2.transport.TransportUtils  - Exiting deleteAttachments()

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse –fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can’t find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client’s response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don’t understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don’t understand the ‘scope’ parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I’ll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that’s in Axis2 which I can’t get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It’s
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do…and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité

 

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it’s a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12


RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Okay,

I didn't mean to imply that the behavior was wrong, I just needed to know
what I needed to do. Since the namespace is in the standard I should be able
to hardcode one.

Brian

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Tuesday, October 02, 2012 8:33 AM
To: java-dev@axis.apache.org
Subject: Re: No headers in response

On Tue, Oct 2, 2012 at 2:01 PM, Brian Reinhold
<br...@lampreynetworks.com> wrote:
> Martin,
>
>
>
> How do I get an attribute from an OMElement? This OMElement is one of 
> the addressing elements. When I try:
>
>
>
>                 QName qname = new QName("mustUnderstand");
>
>                 String mustUnderstand = 
> soapHeaderBlock.getAttributeValue(qname);
>
>                 if(mustUnderstand != null && 
> (mustUnderstand.contains("1")
> || mustUnderstand.contains("true")))
>
>                 {
>
>
> messageContext.setProperty(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
> "true");
>
>                 }
>
>
>
> Just gives me null for the String 'mustUnderstand' from 
> soapHeaderBlock.getAttributeValue(qname). Yet debugging shows the 
> 'mustUnderstand' attribute as a local name. How can this be so 
> absurdly difficult?

The result is correct because the mustUnderstand attribute has a namespace,
but you are querying for an attribute with local name mustUnderstand and no
namespace.

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org



-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5305 - Release Date: 10/02/12


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5305 - Release Date: 10/02/12


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: No headers in response

Posted by Andreas Veithen <an...@gmail.com>.
On Tue, Oct 2, 2012 at 2:01 PM, Brian Reinhold
<br...@lampreynetworks.com> wrote:
> Martin,
>
>
>
> How do I get an attribute from an OMElement? This OMElement is one of the
> addressing elements. When I try:
>
>
>
>                 QName qname = new QName("mustUnderstand");
>
>                 String mustUnderstand =
> soapHeaderBlock.getAttributeValue(qname);
>
>                 if(mustUnderstand != null && (mustUnderstand.contains("1")
> || mustUnderstand.contains("true")))
>
>                 {
>
>
> messageContext.setProperty(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
> "true");
>
>                 }
>
>
>
> Just gives me null for the String ‘mustUnderstand’ from
> soapHeaderBlock.getAttributeValue(qname). Yet debugging shows the
> ‘mustUnderstand’ attribute as a local name. How can this be so absurdly
> difficult?

The result is correct because the mustUnderstand attribute has a
namespace, but you are querying for an attribute with local name
mustUnderstand and no namespace.

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Martin,

 

How do I get an attribute from an OMElement? This OMElement is one of the
addressing elements. When I try:

 

                QName qname = new QName("mustUnderstand");

                String mustUnderstand =
soapHeaderBlock.getAttributeValue(qname);

                if(mustUnderstand != null && (mustUnderstand.contains("1")
|| mustUnderstand.contains("true")))

                {

 
messageContext.setProperty(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS,
"true");

                }

 

Just gives me null for the String 'mustUnderstand' from
soapHeaderBlock.getAttributeValue(qname). Yet debugging shows the
'mustUnderstand' attribute as a local name. How can this be so absurdly
difficult?

 

Brian

 

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 11:50 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 





 

 

I am still blocked by being unable to install axis2 which eliminates running
any of the tests. In the mean time I am trying to see if I can exert some
control in my service. I am using the

 

public void startUp(ConfigurationContext arg0, AxisService arg1)

MG>so in the concrete class sample.servicelifecycle.LibraryLifecycle 
MG>String tempDir = System.getProperty("java.io.tmpdir");
            File tempFile = new File(tempDir);
            File libFile = new File(tempFile, "library.xml");

MG>you *could* configure your own context by assigning libFile to your own
axis2.xml

 

method in my service and maybe from there I can exert some control over the
behavior. The ideal solution is, of course, to be able to get maven to
succeed in the axis2 install so I could add it to my axiom, rampart, and
wss4j projects. Having the source code is a GREAT advantage when debugging!
(It also helps a great deal learning how the apache system works.) With
axis2 added I could get at the MessageContext which, for now, is a black box

 

MG>I have installed all of axis2-1.6.2 into my local maven repository but it
was a long slog thru the modules folder

MG>

08/29/2012  10:11 AM    <DIR>          transport
08/29/2012  10:11 AM    <DIR>          soapmonitor
08/29/2012  10:11 AM    <DIR>          distribution
08/29/2012  10:12 AM    <DIR>          samples
08/29/2012  10:13 AM    <DIR>          parent
08/29/2012  10:13 AM    <DIR>          resource-bundle
08/29/2012  10:13 AM    <DIR>          kernel
08/29/2012  10:14 AM    <DIR>          codegen
08/29/2012  10:15 AM    <DIR>          java2wsdl
08/29/2012  10:15 AM    <DIR>          jaxbri
08/29/2012  10:15 AM    <DIR>          saaj
08/29/2012  03:28 PM    <DIR>          metadata
08/29/2012  03:29 PM    <DIR>          testutils
08/29/2012  03:29 PM    <DIR>          xmlbeans
08/29/2012  03:29 PM    <DIR>          json
08/29/2012  03:29 PM    <DIR>          mtompolicy
08/29/2012  03:29 PM    <DIR>          spring
08/29/2012  03:29 PM    <DIR>          osgi
08/29/2012  05:07 PM    <DIR>          corba
09/01/2012  09:21 PM    <DIR>          webapp
09/03/2012  08:26 AM    <DIR>          clustering
09/03/2012  11:35 AM    <DIR>          jaxws
09/05/2012  07:35 PM    <DIR>          jaxws-integration
09/05/2012  08:01 PM    <DIR>          .
09/05/2012  08:01 PM    <DIR>          ..
09/05/2012  08:01 PM    <DIR>          lib
09/11/2012  12:42 PM    <DIR>          fastinfoset
09/11/2012  03:46 PM    <DIR>          jibx
09/14/2012  11:30 AM    <DIR>          integration
09/20/2012  09:30 AM    <DIR>          tool
09/21/2012  01:41 PM    <DIR>          adb-codegen
09/21/2012  01:43 PM    <DIR>          scripting
09/21/2012  01:48 PM    <DIR>          mex
09/21/2012  01:48 PM    <DIR>          mtompolicy-mar
09/21/2012  01:48 PM    <DIR>          ping
09/21/2012  01:49 PM    <DIR>          jaxws-mar
09/23/2012  09:38 AM    <DIR>          adb
09/27/2012  08:38 PM    <DIR>          addressing

 

MG>the most problematic module was integration with the package phase
incessant executions of ServiceClient
org.apache.axis2.client.ServiceClient.sendReceive MG>(which are never
stopped) but causes the next execution to be refused when a re- bind error
happens..here is an example

 <testcase time="5.413"
classname="org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest"
name="testEchoXMLSync">
    <error message="Connection refused: connect"
type="org.apache.axis2.AxisFault">org.apache.axis2.AxisFault: Connection
refused: connect
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithC
ommons(CommonsHTTPTransportSender.java:404)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTT
PTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperatio
n.java:406)
    at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisO
peration.java:229)
    at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
    at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
    at
org.apache.axis2.mtom.EchoRawMTOMLoadTest.testEchoXMLSync(EchoRawMTOMLoadTes
t.java:123)
    at
org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest.testEchoXMLSync(EchoRawMT
OMFileCacheLoadTest.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.extensions.TestSetup.run(TestSetup.java:27)
    at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83
)
    at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62
)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(Ab
stractDirectoryTestSuite.java:140)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractD
irectoryTestSuite.java:127)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireB
ooter.java:350)
    at
org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:242)
    at
org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:
492)
    at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPl
uginManager.java:107)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:2
09)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:1
53)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:1
45)
    at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Life
cycleModuleBuilder.java:84)
    at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Life
cycleModuleBuilder.java:59)
    at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(Lif
ecycleStarter.java:183)
    at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarte
r.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.ja
va:290)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.
java:409)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.net.ConnectException: Connection refused: connect

 

MG>this has nothing to do with maven deploy but the inability of the
maven-surefire-plugin testcase to not release the previous connection handle

MG> i think its time to invoke maven-surefire-plugin skipTests
<http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#skipTe
sts> 


Is it a bug that the SOAPMonitor cannot (or does not) display the headers in
the response? Knowing that would have saved me (and you) a number of days! I
can't thank you enough for your help.

MG>im sure we can think of something

 

Brian

MG>Martin

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 8:23 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

 

So there are two problems:

1.       The SOAPMonitor has a bug. For some reason the response frame
(outgoing messages) does not show the headers (the request frame does).

MG>i use SOAPUI

http://www.soapui.org/

 

2.       The SOAP message being generated by Rampart is not adding the
'mustUnderstand' attribute to the addressing headers (though it IS being
added to the security header)

MG>run this test from
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest

    @Test
    public void testMustUnderstandSupport() throws Exception
    {
        org.apache.axis2.context.ConfigurationContext
cfgCtx=org.apache.axis2.context.ConfigurationContextFactory.createEmptyConfi
gurationContext();
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx="+cfgCtx);
        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setProperty(org.apache.axis2.addressing.AddressingConstants.ADD_MUST
_UNDERSTAND_TO_ADDRESSING_HEADERS, //"addMustUnderstandToAddressingHeaders";
                           Boolean.TRUE);
 
System.out.println("AddressingOutHanderTest::testMustUnderstandSupport
msgCtx="+msgCtxt);
//msgContext applies to both <wsa:From and <wsa:To and <wsa:MessageID nodes
so expect soapenv:mustUnderstand="1" in all these cases

        org.apache.axis2.addressing.EndpointReference epr = new
org.apache.axis2.addressing.EndpointReference("http://www.from.org/service/"
);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);

//notice the absence of URL in QName assigment which will cause no namespace
qualification
        epr.addReferenceParameter(new
javax.xml.namespace.QName("Reference2"),"Value 200");
        msgCtxt.setFrom(epr);
         //at this point <wsa:From node will have EPR address and Reference2

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.to.org/service/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        epr.addReferenceParameter(
                new  javax.xml.namespace.QName("http://reference.org",
"Reference4", "myRef"),
                "Value 400");
 //notice the inclusion of a new URL into the QName this will differentiate
itself from being included in the <wsa:To and included as a 'separate'param
        epr.addReferenceParameter(
                new javax.xml.namespace.QName("http://reference.org",
"Reference3", "myRef"),
                "Value 300");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
about to MsgCtxtx.setTo(epr) where epr="+epr);
        msgCtxt.setTo(epr);
        msgCtxt.setProperty(WS_ADDRESSING_VERSION,
//WSAddressingVersion
                            Submission.WSA_NAMESPACE);
//"http://www.w3.org/2005/08/addressing"

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.replyTo.org/servic
e/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        msgCtxt.setReplyTo(epr);

        msgCtxt.setMessageID("123456-7890");
        msgCtxt.setWSAAction("http://www.actions.org/action");

        org.apache.axis2.addressing.RelatesTo relatesTo = new
org.apache.axis2.addressing.RelatesTo(
                "http://www.relatesTo.org/service/", "TestRelation");
        msgCtxt.addRelatesTo(relatesTo);

 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler="+outHandler);
        outHandler.invoke(msgCtxt);

        XMLUnit.setIgnoreWhitespace(true);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()="+msgCtxt.getEnvelope().toString());
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
                TestUtil.getOMBuilder("mustUnderstandTest.xml")
                        .getDocumentElement().toString());
    }

MG>

 this is the output you *should* get with the mustUnderstand attribute

 

AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader
cfgCtx=org.apache.axis2.context.ConfigurationContext@1ee29820
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx=org.apache.axis2.context.ConfigurationContext@70e35d5
AddressingOutHanderTest::testMustUnderstandSupport msgCtx=[MessageContext:
logID=6a6951b0cd4e2d6123890cb57bb150383474dbf0511a4018]
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.from.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport about to
MsgCtxtx.setTo(epr) where epr=Address: http://www.to.org/service/, Reference
Parameters: {{http://reference.org}Reference3=<myRef:Reference3
xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>,
{http://reference.org}Reference4=<myRef:Reference4
xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>}
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.replyTo.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()=
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <myRef:Reference3 xmlns:myRef="http://reference.org">Value
300</myRef:Reference3>
        <myRef:Reference4 xmlns:myRef="http://reference.org">Value
400</myRef:Reference4>
        <wsa:To soapenv:mustUnderstand="1">http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:ReplyTo soapenv:mustUnderstand="1">
            <wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address> </wsa:Address>
        </wsa:ReplyTo>
        <wsa:From soapenv:mustUnderstand="1">
            <wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address> </wsa:Address>
            <wsa:ReferenceParameters>
                <Reference2>Value 200</Reference2>
            </wsa:ReferenceParameters>
        </wsa:From>
        <wsa:MessageID
soapenv:mustUnderstand="1">123456-7890</wsa:MessageID>
        <wsa:Action soapenv:mustUnderstand="1">http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:RelatesTo RelationshipType="TestRelation"
soapenv:mustUnderstand="1">http://www.relatesTo.org/service/
<http://www.relatesTo.org/service/%3c/wsa:RelatesTo> </wsa:RelatesTo>
    </soapenv:Header><soapenv:Body />
</soapenv:Envelope>

 

MG>

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Believe it or not it may be fine. It's the SOAP monitor not showing the
headers on the response side. It shows them on the send side, but not the
response. Since I am on a local host I can't use wireshark which would have
solved the issue. This I need to do because my client in one case is giving
an error about the header but in the other case it isn't (I see the headers
returned). But the SOAP monitor shows no headers in either case on the
response. ARRG!

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse -fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can't find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client's response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don't understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don't understand the 'scope' parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I'll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that's in Axis2 which I can't get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It's
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do.and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi ?s Bizalmass?gi kinyilatkoztat?s/Verzicht und
Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?

 

Ez az ?zenet bizalmas.  Ha nem ?n az akinek sz?nva volt, akkor k?rj?k, hogy
jelentse azt nek?nk vissza. Semmif?le tov?bb?t?sa vagy m?solat?nak k?sz?t?se
nem megengedett.  Ez az ?zenet csak ismeret cser?t szolg?l ?s semmif?le jogi
alkalmazhat?s?ga sincs.  Mivel az electronikus ?zenetek k?nnyen
megv?ltoztathat?ak, ez?rt minket semmi felel?s?g nem terhelhet ezen ?zenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it's a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12


RE: No headers in response (BUG)

Posted by Martin Gainty <mg...@hotmail.com>.
 if the SOAPHeaders were never populated in Service Client in the first place (then the headers ArrayList wont contain MUST_UNDERSTAND or any other attribute)
here in ServiceClient
 public void sendRobust(QName operation, OMElement elem) throws AxisFault {
        MessageContext mc = new MessageContext();
        fillSOAPEnvelope(mc, elem);
//at this point headers should be filled with SOAPHeaderBlock
        OperationClient mepClient = createClient(operation);
        mepClient.addMessageContext(mc);
        mepClient.execute(true);
    }

//which calls fillSOAPEnveloper with the aforementioned MessageContext and the xmlPayload
  private void fillSOAPEnvelope(MessageContext messageContext, OMElement xmlPayload)
            throws AxisFault {
        messageContext.setServiceContext(serviceContext);
        SOAPFactory soapFactory = getSOAPFactory();
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        if (xmlPayload != null) {
            envelope.getBody().addChild(xmlPayload);
        }
        addHeadersToEnvelope(envelope);
        messageContext.setEnvelope(envelope);
    }

//which calls addHeadersToEnvelope with the envelope (previously constructed from SOAPFactory)
 public void addHeadersToEnvelope(SOAPEnvelope envelope) {
        if (headers != null) {
            SOAPHeader soapHeader = envelope.getHeader();
            for (Object header : headers) {
                soapHeader.addChild((OMElement)header);
            }
        }
    }

 / /where do the headers come from..they are added with addHeader(OMElement) or addHeader(SOAPHeaderBlock) ..note the difference!
   /**
     * Add an arbitrary XML element as a header to be sent with outgoing messages.
     * @param header header to be sent (non-<code>null</code>)
     */
    public void addHeader(OMElement header) {
 / /at this point the attributes of MUST_UNDERSTAND_PROPERTY are lost
        if (headers == null) {
            headers = new ArrayList<OMElement>();
        }
        headers.add(header);
    }

    /**
     * Add SOAP Header to be sent with outgoing messages.
     * @param header header to be sent (non-<code>null</code>)
     */
    public void addHeader(SOAPHeaderBlock header) {
        if (headers == null) {
            headers = new ArrayList<OMElement>();
 / /wrong...we cannot use an ArrayList<OMElement> to contain ArrayList<SOAPHeaderBlock>
        }
/ / MUST_UNDERSTAND_PROPERTY is lost ..there is no way to retrieve from headers array
        headers.add(header);
    }

noting the difference of OMElement and SOAPHeaderBlock
public interface SOAPHeaderBlock extends OMSourcedElement {   
    /**
     * A SOAPHeaderBlock may be represented as an unexpanded OMSourcedElement.
     * In such cases, the underlying OMDataSource may have a property that contains
     * the value of the ROLE/ACTOR, RELAY or MUST_UNDERSTAND setting.
     */
    public String ROLE_PROPERTY = "org.apache.axiom.soap.SOAPHeader.ROLE";
    public String RELAY_PROPERTY = "org.apache.axiom.soap.SOAPHeader.RELAY";
    public String MUST_UNDERSTAND_PROPERTY = "org.apache.axiom.soap.SOAPHeader.MUST_UNDERSTAND";
...
}
so the downcast of SOAPHeaderBlock to OMElement to fit into ArrayList<OMElement> loses MUST_UNDERSTAND_PROPERTY
the ArrayList<OMElement> needs to be ArrayList<SOAPHeaderBlock>

this is not good and needs to be rectified ASAP

do you want to file JIRA or should i?

...thanks for pointing out this bug brian...
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Mon, 1 Oct 2012 13:24:28 -0400

Martin, All the items mentioned below are in place in the axis2.xml in the place as you have indicated below.  So as I understand it when a message is received it begins its progression through the flows.The dispatch phase sends the message off to various routines to perform tasks. One of these tasks is the MustUnderstandValidationDispatcherHere it gets a little fuzzy but I guess this check must fail in some sense because of support software requirementsThus one has an additional check as an operation element after the dispatch phases are all done. When this final check is done we are still in the in-phase. Should I assume that the MessageContext at this point would indicate support for mustUnderstand? It SHOULD as I understand the spec if the In-phase message indicate support for the mustUnderstand attribute (which is does). However what is interesting is the creation of the response. There is code that generates a response MessageContext based upon the Inflow MessageContext. mustUnderstand WILL be done if boolean addMustUnderstandAttribute = msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);returns true.  Looking at the code it is a little hard to follow. ?It deserves a trace. I cannot find the place where the property is set to true in the outbound message context based upon the inbound message context. Is there a means of obtaining the MessageContext object in my service? Brian  From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Monday, October 01, 2012 10:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response services.xml contains some optional <operation name="*"> tags such as

<service name="">
    <description>
        This is a testing servi ce , to test the system is working or not
    </description>
    <parameter name="ServiceClass">org.apache.axis2.sample.echo.EchoImpl</parameter>
    <operation name="echoString">

//take a look at THIS later on in org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher defined in axis2.xml
<InFlow>
    <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>

//and the org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher.java invoke method
    public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
        AxisService axisService = msgctx.getAxisService();
        AxisOperation axisOperation = msgctx.getAxisOperation();
        
        if (log.isDebugEnabled()) {
            log.debug("JAXWS MustUnderstandValidationDispatcher.invoke on AxisService " 
                      + axisService
                      + "; AxisOperation " + axisOperation);
        }
        // REVIEW: This will only check do the mustUnderstand checking if the operation is null
        // That is because JAXWS compliance requires we throw a mustUnderstand fault even if the operation is
        // invalid.  If the operation is valid, then further mustUnderstand processing will be done
        // by the JAXWS MustUnderstandChecker handler. 
        if (axisService != null && axisOperation == null) {
            checkMustUnderstand(msgctx);
        }
        return InvocationResponse.CONTINUE;
    }

in axis2.xml AFTER the dispatch phase you're going to need a MustUnderstandChecker class e.g.
    <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>

make sense ?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessi. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni.

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Mon, 1 Oct 2012 06:54:17 -0400Martin,By using the command sequence mvn -DskipTests=true install eclipse:eclipse I was able to get the axis2 project installed. Now I am able to step through the addition of the addressing headers to the out message. From here it is clear that only the ‘use optional headers’ option is read from the configuration of the addressing module in the axis2.xml file. The ‘add must understand’ condition is read from the MessageContext object. That is what I would expect. Axis2 should read the incoming message and see the mustUnderstand attribute set to true and automatically set the property in the MessageContext object of the outgoing response to true so that         boolean addMustUnderstandAttribute = msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS); in the ‘doInvoke()’ method in the AddressingOutHandler would return true.  But it returns false. So the question is why. Is there something that I could possibly do in the service.xml that would cause this error? One parameter I do not understand in the configuration guide is the scope. It is described as scope: (Optional Attribute) The time period during which runtime information of the deployed services will be available. Scope is of several types- "application", "soapsession", "transportsession", "request". The default value (if you don't enter any value) will be "request" The runtime information will be available? I have no idea what that means. I have the scope set to “application”, but  I think I tried removing it and going with the default but it made no difference. Then I am also using the ServiceLifeCycle (to initialize data at startup). The callbacks I must implement have two parameters startUp(ConfigurationContext arg0, AxisService arg1) both of which are null according to the debugger but I don’t believe the debugger. Startup issue likely. There is a note that some optional attribute has to be added to the service.xml in the ServiceLifeCycle javadoc and I believe it is the class attribute in the service element. In the on line configuration documentation there is the statementThe full qualified name of the service lifecycle implementation class.Which happens to be the same as the parameter ServiceClass.  My service.xml looks as follows: <serviceGroup>    <service name="DeviceObservationConsumerSecure" class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver">        <module ref="addressing" />        <module ref="sandesha2" />        <module ref="rampart" />        <messageReceivers>            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>        </messageReceivers>        <parameter name="ServiceClass">com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver</parameter>        <parameter name="useOriginalwsdl">true</parameter>        <parameter name="modifyUserWSDLPortAddress">true</parameter>        <operation name="CommunicatePCDData" mep="http://www.w3.org/ns/wsdl/in-out" namespace="urn:ihe:pcd:dec:2010">            <actionMapping>urn:ihe:pcd:2010:CommunicatePCDData</actionMapping>            <outputActionMapping>urn:ihe:pcd:2010:CommunicatePCDDataResponse</outputActionMapping>        </operation>          <wsp:Policy wsu:Id="TLS_SAML2.0"              xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"              xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"              xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"              xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">       <wsp:ExactlyOne> … All the policy stuff … The settings of the wsdl parameters have no effect on the addressing behavior. Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 11:50 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response    I am still blocked by being unable to install axis2 which eliminates running any of the tests. In the mean time I am trying to see if I can exert some control in my service. I am using the public void startUp(ConfigurationContext arg0, AxisService arg1)MG>so in the concrete class sample.servicelifecycle.LibraryLifecycle 
MG>String tempDir = System.getProperty("java.io.tmpdir");
            File tempFile = new File(tempDir);
            File libFile = new File(tempFile, "library.xml");MG>you *could* configure your own context by assigning libFile to your own axis2.xml method in my service and maybe from there I can exert some control over the behavior. The ideal solution is, of course, to be able to get maven to succeed in the axis2 install so I could add it to my axiom, rampart, and wss4j projects. Having the source code is a GREAT advantage when debugging! (It also helps a great deal learning how the apache system works.) With axis2 added I could get at the MessageContext which, for now, is a black box MG>I have installed all of axis2-1.6.2 into my local maven repository but it was a long slog thru the modules folderMG>08/29/2012  10:11 AM    <DIR>          transport
08/29/2012  10:11 AM    <DIR>          soapmonitor
08/29/2012  10:11 AM    <DIR>          distribution
08/29/2012  10:12 AM    <DIR>          samples
08/29/2012  10:13 AM    <DIR>          parent
08/29/2012  10:13 AM    <DIR>          resource-bundle
08/29/2012  10:13 AM    <DIR>          kernel
08/29/2012  10:14 AM    <DIR>          codegen
08/29/2012  10:15 AM    <DIR>          java2wsdl
08/29/2012  10:15 AM    <DIR>          jaxbri
08/29/2012  10:15 AM    <DIR>          saaj
08/29/2012  03:28 PM    <DIR>          metadata
08/29/2012  03:29 PM    <DIR>          testutils
08/29/2012  03:29 PM    <DIR>          xmlbeans
08/29/2012  03:29 PM    <DIR>          json
08/29/2012  03:29 PM    <DIR>          mtompolicy
08/29/2012  03:29 PM    <DIR>          spring
08/29/2012  03:29 PM    <DIR>          osgi
08/29/2012  05:07 PM    <DIR>          corba
09/01/2012  09:21 PM    <DIR>          webapp
09/03/2012  08:26 AM    <DIR>          clustering
09/03/2012  11:35 AM    <DIR>          jaxws
09/05/2012  07:35 PM    <DIR>          jaxws-integration
09/05/2012  08:01 PM    <DIR>          .
09/05/2012  08:01 PM    <DIR>          ..
09/05/2012  08:01 PM    <DIR>          lib
09/11/2012  12:42 PM    <DIR>          fastinfoset
09/11/2012  03:46 PM    <DIR>          jibx
09/14/2012  11:30 AM    <DIR>          integration
09/20/2012  09:30 AM    <DIR>          tool
09/21/2012  01:41 PM    <DIR>          adb-codegen
09/21/2012  01:43 PM    <DIR>          scripting
09/21/2012  01:48 PM    <DIR>          mex
09/21/2012  01:48 PM    <DIR>          mtompolicy-mar
09/21/2012  01:48 PM    <DIR>          ping
09/21/2012  01:49 PM    <DIR>          jaxws-mar
09/23/2012  09:38 AM    <DIR>          adb
09/27/2012  08:38 PM    <DIR>          addressing MG>the most problematic module was integration with the package phase incessant executions of ServiceClient  org.apache.axis2.client.ServiceClient.sendReceive MG>(which are never stopped) but causes the next execution to be refused when a re- bind error happens..here is an example <testcase time="5.413" classname="org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest" name="testEchoXMLSync">
    <error message="Connection refused: connect" type="org.apache.axis2.AxisFault">org.apache.axis2.AxisFault: Connection refused: connect
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
    at org.apache.axis2.mtom.EchoRawMTOMLoadTest.testEchoXMLSync(EchoRawMTOMLoadTest.java:123)
    at org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest.testEchoXMLSync(EchoRawMTOMFileCacheLoadTest.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.extensions.TestSetup.run(TestSetup.java:27)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
    at org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:242)
    at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:492)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.net.ConnectException: Connection refused: connect MG>this has nothing to do with maven deploy but the inability of the maven-surefire-plugin testcase to not release the previous connection handleMG> i think its time to invoke maven-surefire-plugin skipTests
Is it a bug that the SOAPMonitor cannot (or does not) display the headers in the response? Knowing that would have saved me (and you) a number of days! I can't thank you enough for your help.MG>im sure we can think of something BrianMG>Martin From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 8:23 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response  So there are two problems:1.       The SOAPMonitor has a bug. For some reason the response frame (outgoing messages) does not show the headers (the request frame does).MG>i use SOAPUIhttp://www.soapui.org/ 2.       The SOAP message being generated by Rampart is not adding the 'mustUnderstand' attribute to the addressing headers (though it IS being added to the security header)MG>run this test from org.apache.axis2.handlers.addressing.AddressingOutHandlerTest    @Test
    public void testMustUnderstandSupport() throws Exception
    {
        org.apache.axis2.context.ConfigurationContext cfgCtx=org.apache.axis2.context.ConfigurationContextFactory.createEmptyConfigurationContext();
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport cfgCtx="+cfgCtx);
        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setProperty(org.apache.axis2.addressing.AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS, //"addMustUnderstandToAddressingHeaders";
                           Boolean.TRUE);
        System.out.println("AddressingOutHanderTest::testMustUnderstandSupport msgCtx="+msgCtxt);
//msgContext applies to both <wsa:From and <wsa:To and <wsa:MessageID nodes so expect soapenv:mustUnderstand="1" in all these cases

        org.apache.axis2.addressing.EndpointReference epr = new org.apache.axis2.addressing.EndpointReference("http://www.from.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);

//notice the absence of URL in QName assigment which will cause no namespace qualification
        epr.addReferenceParameter(new javax.xml.namespace.QName("Reference2"),"Value 200");
        msgCtxt.setFrom(epr);
         //at this point <wsa:From node will have EPR address and Reference2

        epr = new org.apache.axis2.addressing.EndpointReference("http://www.to.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);
        epr.addReferenceParameter(
                new  javax.xml.namespace.QName("http://reference.org", "Reference4", "myRef"),
                "Value 400");
 //notice the inclusion of a new URL into the QName this will differentiate itself from being included in the <wsa:To and included as a 'separate'param
        epr.addReferenceParameter(
                new javax.xml.namespace.QName("http://reference.org", "Reference3", "myRef"),
                "Value 300");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport about to MsgCtxtx.setTo(epr) where epr="+epr);
        msgCtxt.setTo(epr);
        msgCtxt.setProperty(WS_ADDRESSING_VERSION,             //WSAddressingVersion
                            Submission.WSA_NAMESPACE);         //"http://www.w3.org/2005/08/addressing"

        epr = new org.apache.axis2.addressing.EndpointReference("http://www.replyTo.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);
        msgCtxt.setReplyTo(epr);

        msgCtxt.setMessageID("123456-7890");
        msgCtxt.setWSAAction("http://www.actions.org/action");

        org.apache.axis2.addressing.RelatesTo relatesTo = new org.apache.axis2.addressing.RelatesTo(
                "http://www.relatesTo.org/service/", "TestRelation");
        msgCtxt.addRelatesTo(relatesTo);

        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport outHandler.invoke(msgCtxt) where outHandler="+outHandler);
        outHandler.invoke(msgCtxt);

        XMLUnit.setIgnoreWhitespace(true);
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport msgCtxt.getEnvelope().toString()="+msgCtxt.getEnvelope().toString());
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
                TestUtil.getOMBuilder("mustUnderstandTest.xml")
                        .getDocumentElement().toString());
    }MG> this is the output you *should* get with the mustUnderstand attribute AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader epr=Address: http://www.to.org/service/
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader cfgCtx=org.apache.axis2.context.ConfigurationContext@1ee29820
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport cfgCtx=org.apache.axis2.context.ConfigurationContext@70e35d5
AddressingOutHanderTest::testMustUnderstandSupport msgCtx=[MessageContext: logID=6a6951b0cd4e2d6123890cb57bb150383474dbf0511a4018]
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.from.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.to.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport about to MsgCtxtx.setTo(epr) where epr=Address: http://www.to.org/service/, Reference Parameters: {{http://reference.org}Reference3=<myRef:Reference3 xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>, {http://reference.org}Reference4=<myRef:Reference4 xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>}
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.replyTo.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport outHandler.invoke(msgCtxt) where outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport msgCtxt.getEnvelope().toString()=
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <myRef:Reference3 xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>
        <myRef:Reference4 xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>
        <wsa:To soapenv:mustUnderstand="1">http://www.to.org/service/</wsa:To>
        <wsa:ReplyTo soapenv:mustUnderstand="1">
            <wsa:Address>http://www.replyTo.org/service/</wsa:Address>
        </wsa:ReplyTo>
        <wsa:From soapenv:mustUnderstand="1">
            <wsa:Address>http://www.from.org/service/</wsa:Address>
            <wsa:ReferenceParameters>
                <Reference2>Value 200</Reference2>
            </wsa:ReferenceParameters>
        </wsa:From>
        <wsa:MessageID soapenv:mustUnderstand="1">123456-7890</wsa:MessageID>
        <wsa:Action soapenv:mustUnderstand="1">http://www.actions.org/action</wsa:Action>
        <wsa:RelatesTo RelationshipType="TestRelation" soapenv:mustUnderstand="1">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header><soapenv:Body />
</soapenv:Envelope> MG> From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Believe it or not it may be fine. It's the SOAP monitor not showing the headers on the response side. It shows them on the send side, but not the response. Since I am on a local host I can't use wireshark which would have solved the issue. This I need to do because my client in one case is giving an error about the header but in the other case it isn't (I see the headers returned). But the SOAP monitor shows no headers in either case on the response. ARRG! From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response I added those lines of code to the xml and it had no effect. I think the only way I am going to be able to address this is to step through the axis routines and see where the header (both addressing and security) created by rampart is stripped. I am using Eclipse, and to do this requires the remote debugging option. I could parse through source if I had a jar with source (I could make one of those if I could get mvn eclipse:eclipse -fn to work).In the meantime I do have a 1.5.1 based distribution that IS working; the headers ARE being received. Can't find the differences yet in the services and axis2 xml configuration files. From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response if header suppresssion is specific to addressing then this is what is gating you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam = msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                log.debug(
                        "The AddressingInHandler has been disabled. No further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES = "disableAddressingForOutMessages";
        Object o = msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or not.
            // Get default value from module.xml or axis2.xml files
            param = msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, MODULE_NAME, handlerDesc);
            disableAddressing =
                msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
                    JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400Oh, sorry! The entire header. So in the SOAPMonitor and the client's response all one receives is <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">    <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> But I am glad to know that it is there. There are so many possible settings in the xmls that I don't understand it could be something very innocent.Having or removing this text from the axis2.xml makes no difference on the behavior (the addressing module IS present):     <!--Configuring module , providing parameters for modules whether they refer or not-->    <moduleConfig name="addressing">        <parameter name="includeOptionalHeaders">true</parameter>                                <parameter name="required">true</parameter>    </moduleConfig> In the service xml I don't understand the 'scope' parameter in the service declaration: service name="DeviceObservationConsumerSecure" scope="application" class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver" The policy is in the service xml. But according to the axis2 documentation nothing I do in the service.xml affects the addressing; this can only be controlled at the global level in the axis2.xml. Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400Martin, I was able to trace into the Rampart code during the building of the response and the response is built correctly.In the build() method of the org.apache.rampart.MessageBuilder  it looks as follows: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="true">                  <wsu:Timestamp wsu:Id="TS-9">                              <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>                            <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>                  </wsu:Timestamp>    </wsse:Security>    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>    <wsa:ReplyTo>      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>    </wsa:ReplyTo>    <wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>    <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>  </soapenv:Header>  <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> The correct headers for BOTH addressing and security are present. However, I have still been unable to get the Axis2 maven to work correctly and cannot step into the Axis2 routines which follow. So something happens in Axis2 that strips away that header. Any idea what might allow the header to be removed? Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response Yes..I always hardcoded those values in the descriptor...but the maven-mar-plugin should reconfigure axis2.xml to include  <module ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400Martin, I'll take a look at the Rampart checks but I am also having a problem with no ws-addressing in the response and that's in Axis2 which I can't get loaded because of maven problems. I do see success in the older versions (1.5.1). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400Martin, This looks like client side testing. I have no problem on the client. It's my service whose response has no headers. The client is much easier to deal with as one tends to use code and for that there is great help from Eclipse and javadoc. The service, on the other hand, one usually has to use xml to control all behaviors and that is very difficult (difficult in the sense one has no idea what, for example, the possible parameters, elements, attributes, etc. are and what they do.and no help from Eclipse like there is with code). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to reconstruct our mustUnderstand later on
        String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results = engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd, rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned  on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
                        inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq = (String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq)) {
            try {
                
                String cancelAction = TrustUtil.getWSTNamespace(rmd.getWstVersion()) + RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt = msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if (Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey = RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId = (String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd, tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element) rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode = rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode, (Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(), config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi ?s Bizalmass?gi kinyilatkoztat?s/Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit? Ez az ?zenet bizalmas.  Ha nem ?n az akinek sz?nva volt, akkor k?rj?k, hogy jelentse azt nek?nk vissza. Semmif?le tov?bb?t?sa vagy m?solat?nak k?sz?t?se nem megengedett.  Ez az ?zenet csak ismeret cser?t szolg?l ?s semmif?le jogi alkalmazhat?s?ga sincs.  Mivel az electronikus ?zenetek k?nnyen megv?ltoztathat?ak, ez?rt minket semmi felel?s?g nem terhelhet ezen ?zenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400Martin, I tried that as well and the response still came back with no headers. Somehow the STS service manages to get a header in the response (missing must understand in the addressing); but it's a start.  Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Hi Brian
i'll take the last question.. from axis2.xml i assume you have included optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new java.io.File(System.getProperty("basedir",".") + "/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx =org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing module should now be true

        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);        
        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(), org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTest.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/</wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action</wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400 I am re-opening a question I saw no answer to asked in this forum quite a while  ago. In the STS service requesting a SMAL20 token the response is okay.But in the service that needs to have the SAML20 token, the response has no headers at all. This is in spite of the must understand setting in the client headers in both the addressing and security part. Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the <parameter name="includeOptionalHeaders">true</parameter> in the service.xml does not help (though that is what I used programmatically on the client side to generate the correct addressing headers).Is this a bug or what am I doing wrong in the configuration? Thanks, Brian ReinholdNo virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12 		 	   		  

RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Martin,

 

All the items mentioned below are in place in the axis2.xml in the place as
you have indicated below. 

 

So as I understand it when a message is received it begins its progression
through the flows.

The dispatch phase sends the message off to various routines to perform
tasks. One of these tasks is the MustUnderstandValidationDispatcher

Here it gets a little fuzzy but I guess this check must fail in some sense
because of support software requirements

Thus one has an additional check as an operation element after the dispatch
phases are all done.

 

When this final check is done we are still in the in-phase. Should I assume
that the MessageContext at this point would indicate support for
mustUnderstand? It SHOULD as I understand the spec if the In-phase message
indicate support for the mustUnderstand attribute (which is does).

 

However what is interesting is the creation of the response. There is code
that generates a response MessageContext based upon the Inflow
MessageContext. mustUnderstand WILL be done if 

boolean addMustUnderstandAttribute =
msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);

returns true. 

 

Looking at the code it is a little hard to follow.  It deserves a trace. I
cannot find the place where the property is set to true in the outbound
message context based upon the inbound message context.

 

Is there a means of obtaining the MessageContext object in my service?

 

Brian

 

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Monday, October 01, 2012 10:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

services.xml contains some optional <operation name="*"> tags such as

<service name="">
    <description>
        This is a testing servi ce , to test the system is working or not
    </description>
    <parameter
name="ServiceClass">org.apache.axis2.sample.echo.EchoImpl</parameter>
    <operation name="echoString">

//take a look at THIS later on in
org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
defined in axis2.xml
<InFlow>
    <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>

//and the
org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher.java
invoke method
    public InvocationResponse invoke(MessageContext msgctx) throws AxisFault
{
        AxisService axisService = msgctx.getAxisService();
        AxisOperation axisOperation = msgctx.getAxisOperation();
        
        if (log.isDebugEnabled()) {
            log.debug("JAXWS MustUnderstandValidationDispatcher.invoke on
AxisService " 
                      + axisService
                      + "; AxisOperation " + axisOperation);
        }
        // REVIEW: This will only check do the mustUnderstand checking if
the operation is null
        // That is because JAXWS compliance requires we throw a
mustUnderstand fault even if the operation is
        // invalid.  If the operation is valid, then further mustUnderstand
processing will be done
        // by the JAXWS MustUnderstandChecker handler. 
        if (axisService != null && axisOperation == null) {
            checkMustUnderstand(msgctx);
        }
        return InvocationResponse.CONTINUE;
    }

in axis2.xml AFTER the dispatch phase you're going to need a
MustUnderstandChecker class e.g.
    <!--   After Postdispatch phase module author or service author can add
any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>

make sense ?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessi. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.





  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Mon, 1 Oct 2012 06:54:17 -0400

Martin,

By using the command sequence

 

mvn -DskipTests=true install eclipse:eclipse

 

I was able to get the axis2 project installed. Now I am able to step through
the addition of the addressing headers to the out message. From here it is
clear that only the ‘use optional headers’ option is read from the
configuration of the addressing module in the axis2.xml file. The ‘add must
understand’ condition is read from the MessageContext object. That is what I
would expect. Axis2 should read the incoming message and see the
mustUnderstand attribute set to true and automatically set the property in
the MessageContext object of the outgoing response to true so that

 

        boolean addMustUnderstandAttribute =
msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);

 

in the ‘doInvoke()’ method in the AddressingOutHandler would return true.
But it returns false.

 

So the question is why. Is there something that I could possibly do in the
service.xml that would cause this error? One parameter I do not understand
in the configuration guide is the scope. It is described as

 

scope: (Optional Attribute) The time period during which runtime information
of the deployed services will be available. Scope is of several types-
"application", "soapsession", "transportsession", "request". The default
value (if you don't enter any value) will be "request"

 

The runtime information will be available? I have no idea what that means. I
have the scope set to “application”, but  I think I tried removing it and
going with the default but it made no difference.

 

Then I am also using the ServiceLifeCycle (to initialize data at startup).
The callbacks I must implement have two parameters
startUp(ConfigurationContext arg0, AxisService arg1) both of which are null
according to the debugger but I don’t believe the debugger. Startup issue
likely. There is a note that some optional attribute has to be added to the
service.xml in the ServiceLifeCycle javadoc and I believe it is the class
attribute in the service element. In the on line configuration documentation
there is the statement

The full qualified name of the service lifecycle implementation class.

Which happens to be the same as the parameter ServiceClass. 

 

My service.xml looks as follows:

 

<serviceGroup>

    <service name="DeviceObservationConsumerSecure"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver">

        <module ref="addressing" />

        <module ref="sandesha2" />

        <module ref="rampart" />

        <messageReceivers>

            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

        </messageReceivers>

        <parameter
name="ServiceClass">com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceive
r</parameter>

        <parameter name="useOriginalwsdl">true</parameter>

        <parameter name="modifyUserWSDLPortAddress">true</parameter>

        <operation name="CommunicatePCDData"
mep="http://www.w3.org/ns/wsdl/in-out" namespace="urn:ihe:pcd:dec:2010">

 
<actionMapping>urn:ihe:pcd:2010:CommunicatePCDData</actionMapping>

 
<outputActionMapping>urn:ihe:pcd:2010:CommunicatePCDDataResponse</outputActi
onMapping>

        </operation>

        

  <wsp:Policy wsu:Id="TLS_SAML2.0"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd"

              xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"

              xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"

 
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">

       <wsp:ExactlyOne> … All the policy stuff …

 

The settings of the wsdl parameters have no effect on the addressing
behavior.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 11:50 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

 

 

 

I am still blocked by being unable to install axis2 which eliminates running
any of the tests. In the mean time I am trying to see if I can exert some
control in my service. I am using the

 

public void startUp(ConfigurationContext arg0, AxisService arg1)

MG>so in the concrete class sample.servicelifecycle.LibraryLifecycle 
MG>String tempDir = System.getProperty("java.io.tmpdir");
            File tempFile = new File(tempDir);
            File libFile = new File(tempFile, "library.xml");

MG>you *could* configure your own context by assigning libFile to your own
axis2.xml

 

method in my service and maybe from there I can exert some control over the
behavior. The ideal solution is, of course, to be able to get maven to
succeed in the axis2 install so I could add it to my axiom, rampart, and
wss4j projects. Having the source code is a GREAT advantage when debugging!
(It also helps a great deal learning how the apache system works.) With
axis2 added I could get at the MessageContext which, for now, is a black box

 

MG>I have installed all of axis2-1.6.2 into my local maven repository but it
was a long slog thru the modules folder

MG>

08/29/2012  10:11 AM    <DIR>          transport
08/29/2012  10:11 AM    <DIR>          soapmonitor
08/29/2012  10:11 AM    <DIR>          distribution
08/29/2012  10:12 AM    <DIR>          samples
08/29/2012  10:13 AM    <DIR>          parent
08/29/2012  10:13 AM    <DIR>          resource-bundle
08/29/2012  10:13 AM    <DIR>          kernel
08/29/2012  10:14 AM    <DIR>          codegen
08/29/2012  10:15 AM    <DIR>          java2wsdl
08/29/2012  10:15 AM    <DIR>          jaxbri
08/29/2012  10:15 AM    <DIR>          saaj
08/29/2012  03:28 PM    <DIR>          metadata
08/29/2012  03:29 PM    <DIR>          testutils
08/29/2012  03:29 PM    <DIR>          xmlbeans
08/29/2012  03:29 PM    <DIR>          json
08/29/2012  03:29 PM    <DIR>          mtompolicy
08/29/2012  03:29 PM    <DIR>          spring
08/29/2012  03:29 PM    <DIR>          osgi
08/29/2012  05:07 PM    <DIR>          corba
09/01/2012  09:21 PM    <DIR>          webapp
09/03/2012  08:26 AM    <DIR>          clustering
09/03/2012  11:35 AM    <DIR>          jaxws
09/05/2012  07:35 PM    <DIR>          jaxws-integration
09/05/2012  08:01 PM    <DIR>          .
09/05/2012  08:01 PM    <DIR>          ..
09/05/2012  08:01 PM    <DIR>          lib
09/11/2012  12:42 PM    <DIR>          fastinfoset
09/11/2012  03:46 PM    <DIR>          jibx
09/14/2012  11:30 AM    <DIR>          integration
09/20/2012  09:30 AM    <DIR>          tool
09/21/2012  01:41 PM    <DIR>          adb-codegen
09/21/2012  01:43 PM    <DIR>          scripting
09/21/2012  01:48 PM    <DIR>          mex
09/21/2012  01:48 PM    <DIR>          mtompolicy-mar
09/21/2012  01:48 PM    <DIR>          ping
09/21/2012  01:49 PM    <DIR>          jaxws-mar
09/23/2012  09:38 AM    <DIR>          adb
09/27/2012  08:38 PM    <DIR>          addressing

 

MG>the most problematic module was integration with the package phase
incessant executions of ServiceClient
org.apache.axis2.client.ServiceClient.sendReceive MG>(which are never
stopped) but causes the next execution to be refused when a re- bind error
happens..here is an example

 <testcase time="5.413"
classname="org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest"
name="testEchoXMLSync">
    <error message="Connection refused: connect"
type="org.apache.axis2.AxisFault">org.apache.axis2.AxisFault: Connection
refused: connect
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithC
ommons(CommonsHTTPTransportSender.java:404)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTT
PTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperatio
n.java:406)
    at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisO
peration.java:229)
    at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
    at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
    at
org.apache.axis2.mtom.EchoRawMTOMLoadTest.testEchoXMLSync(EchoRawMTOMLoadTes
t.java:123)
    at
org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest.testEchoXMLSync(EchoRawMT
OMFileCacheLoadTest.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.extensions.TestSetup.run(TestSetup.java:27)
    at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83
)
    at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62
)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(Ab
stractDirectoryTestSuite.java:140)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractD
irectoryTestSuite.java:127)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireB
ooter.java:350)
    at
org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:242)
    at
org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:
492)
    at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPl
uginManager.java:107)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:2
09)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:1
53)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:1
45)
    at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Life
cycleModuleBuilder.java:84)
    at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Life
cycleModuleBuilder.java:59)
    at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(Lif
ecycleStarter.java:183)
    at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarte
r.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.ja
va:290)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.
java:409)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.net.ConnectException: Connection refused: connect

 

MG>this has nothing to do with maven deploy but the inability of the
maven-surefire-plugin testcase to not release the previous connection handle

MG> i think its time to invoke maven-surefire-plugin skipTests
<http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#skipTe
sts> 


Is it a bug that the SOAPMonitor cannot (or does not) display the headers in
the response? Knowing that would have saved me (and you) a number of days! I
can't thank you enough for your help.

MG>im sure we can think of something

 

Brian

MG>Martin

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 8:23 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

 

So there are two problems:

1.       The SOAPMonitor has a bug. For some reason the response frame
(outgoing messages) does not show the headers (the request frame does).

MG>i use SOAPUI

http://www.soapui.org/

 

2.       The SOAP message being generated by Rampart is not adding the
'mustUnderstand' attribute to the addressing headers (though it IS being
added to the security header)

MG>run this test from
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest

    @Test
    public void testMustUnderstandSupport() throws Exception
    {
        org.apache.axis2.context.ConfigurationContext
cfgCtx=org.apache.axis2.context.ConfigurationContextFactory.createEmptyConfi
gurationContext();
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx="+cfgCtx);
        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setProperty(org.apache.axis2.addressing.AddressingConstants.ADD_MUST
_UNDERSTAND_TO_ADDRESSING_HEADERS, //"addMustUnderstandToAddressingHeaders";
                           Boolean.TRUE);
 
System.out.println("AddressingOutHanderTest::testMustUnderstandSupport
msgCtx="+msgCtxt);
//msgContext applies to both <wsa:From and <wsa:To and <wsa:MessageID nodes
so expect soapenv:mustUnderstand="1" in all these cases

        org.apache.axis2.addressing.EndpointReference epr = new
org.apache.axis2.addressing.EndpointReference("http://www.from.org/service/"
);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);

//notice the absence of URL in QName assigment which will cause no namespace
qualification
        epr.addReferenceParameter(new
javax.xml.namespace.QName("Reference2"),"Value 200");
        msgCtxt.setFrom(epr);
         //at this point <wsa:From node will have EPR address and Reference2

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.to.org/service/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        epr.addReferenceParameter(
                new  javax.xml.namespace.QName("http://reference.org",
"Reference4", "myRef"),
                "Value 400");
 //notice the inclusion of a new URL into the QName this will differentiate
itself from being included in the <wsa:To and included as a 'separate'param
        epr.addReferenceParameter(
                new javax.xml.namespace.QName("http://reference.org",
"Reference3", "myRef"),
                "Value 300");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
about to MsgCtxtx.setTo(epr) where epr="+epr);
        msgCtxt.setTo(epr);
        msgCtxt.setProperty(WS_ADDRESSING_VERSION,
//WSAddressingVersion
                            Submission.WSA_NAMESPACE);
//"http://www.w3.org/2005/08/addressing"

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.replyTo.org/servic
e/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        msgCtxt.setReplyTo(epr);

        msgCtxt.setMessageID("123456-7890");
        msgCtxt.setWSAAction("http://www.actions.org/action");

        org.apache.axis2.addressing.RelatesTo relatesTo = new
org.apache.axis2.addressing.RelatesTo(
                "http://www.relatesTo.org/service/", "TestRelation");
        msgCtxt.addRelatesTo(relatesTo);

 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler="+outHandler);
        outHandler.invoke(msgCtxt);

        XMLUnit.setIgnoreWhitespace(true);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()="+msgCtxt.getEnvelope().toString());
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
                TestUtil.getOMBuilder("mustUnderstandTest.xml")
                        .getDocumentElement().toString());
    }

MG>

 this is the output you *should* get with the mustUnderstand attribute

 

AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader
cfgCtx=org.apache.axis2.context.ConfigurationContext@1ee29820
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx=org.apache.axis2.context.ConfigurationContext@70e35d5
AddressingOutHanderTest::testMustUnderstandSupport msgCtx=[MessageContext:
logID=6a6951b0cd4e2d6123890cb57bb150383474dbf0511a4018]
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.from.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport about to
MsgCtxtx.setTo(epr) where epr=Address: http://www.to.org/service/, Reference
Parameters: {{http://reference.org}Reference3=<myRef:Reference3
xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>,
{http://reference.org}Reference4=<myRef:Reference4
xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>}
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.replyTo.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()=
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <myRef:Reference3 xmlns:myRef="http://reference.org">Value
300</myRef:Reference3>
        <myRef:Reference4 xmlns:myRef="http://reference.org">Value
400</myRef:Reference4>
        <wsa:To soapenv:mustUnderstand="1">http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:ReplyTo soapenv:mustUnderstand="1">
            <wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address> </wsa:Address>
        </wsa:ReplyTo>
        <wsa:From soapenv:mustUnderstand="1">
            <wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address> </wsa:Address>
            <wsa:ReferenceParameters>
                <Reference2>Value 200</Reference2>
            </wsa:ReferenceParameters>
        </wsa:From>
        <wsa:MessageID
soapenv:mustUnderstand="1">123456-7890</wsa:MessageID>
        <wsa:Action soapenv:mustUnderstand="1">http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:RelatesTo RelationshipType="TestRelation"
soapenv:mustUnderstand="1">http://www.relatesTo.org/service/
<http://www.relatesTo.org/service/%3c/wsa:RelatesTo> </wsa:RelatesTo>
    </soapenv:Header><soapenv:Body />
</soapenv:Envelope>

 

MG>

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Believe it or not it may be fine. It's the SOAP monitor not showing the
headers on the response side. It shows them on the send side, but not the
response. Since I am on a local host I can't use wireshark which would have
solved the issue. This I need to do because my client in one case is giving
an error about the header but in the other case it isn't (I see the headers
returned). But the SOAP monitor shows no headers in either case on the
response. ARRG!

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse -fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can't find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client's response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don't understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don't understand the 'scope' parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I'll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that's in Axis2 which I can't get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It's
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do.and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi ?s Bizalmass?gi kinyilatkoztat?s/Verzicht und
Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?

 

Ez az ?zenet bizalmas.  Ha nem ?n az akinek sz?nva volt, akkor k?rj?k, hogy
jelentse azt nek?nk vissza. Semmif?le tov?bb?t?sa vagy m?solat?nak k?sz?t?se
nem megengedett.  Ez az ?zenet csak ismeret cser?t szolg?l ?s semmif?le jogi
alkalmazhat?s?ga sincs.  Mivel az electronikus ?zenetek k?nnyen
megv?ltoztathat?ak, ez?rt minket semmi felel?s?g nem terhelhet ezen ?zenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it's a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12


RE: No headers in response

Posted by Martin Gainty <mg...@hotmail.com>.
services.xml contains some optional <operation name="*"> tags such as

<service name="">
    <description>
        This is a testing servi ce , to test the system is working or not
    </description>
    <parameter name="ServiceClass">org.apache.axis2.sample.echo.EchoImpl</parameter>
    <operation name="echoString">

//take a look at THIS later on in org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher defined in axis2.xml
<InFlow>
    <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>

//and the org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher.java invoke method
    public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
        AxisService axisService = msgctx.getAxisService();
        AxisOperation axisOperation = msgctx.getAxisOperation();
        
        if (log.isDebugEnabled()) {
            log.debug("JAXWS MustUnderstandValidationDispatcher.invoke on AxisService " 
                      + axisService
                      + "; AxisOperation " + axisOperation);
        }
        // REVIEW: This will only check do the mustUnderstand checking if the operation is null
        // That is because JAXWS compliance requires we throw a mustUnderstand fault even if the operation is
        // invalid.  If the operation is valid, then further mustUnderstand processing will be done
        // by the JAXWS MustUnderstandChecker handler. 
        if (axisService != null && axisOperation == null) {
            checkMustUnderstand(msgctx);
        }
        return InvocationResponse.CONTINUE;
    }

in axis2.xml AFTER the dispatch phase you're going to need a MustUnderstandChecker class e.g.
    <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>

make sense ?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessi. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Mon, 1 Oct 2012 06:54:17 -0400

Martin,By using the command sequence mvn -DskipTests=true install eclipse:eclipse I was able to get the axis2 project installed. Now I am able to step through the addition of the addressing headers to the out message. From here it is clear that only the ‘use optional headers’ option is read from the configuration of the addressing module in the axis2.xml file. The ‘add must understand’ condition is read from the MessageContext object. That is what I would expect. Axis2 should read the incoming message and see the mustUnderstand attribute set to true and automatically set the property in the MessageContext object of the outgoing response to true so that         boolean addMustUnderstandAttribute = msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS); in the ‘doInvoke()’ method in the AddressingOutHandler would return true.  But it returns false. So the question is why. Is there something that I could possibly do in the service.xml that would cause this error? One parameter I do not understand in the configuration guide is the scope. It is described as scope: (Optional Attribute) The time period during which runtime information of the deployed services will be available. Scope is of several types- "application", "soapsession", "transportsession", "request". The default value (if you don't enter any value) will be "request" The runtime information will be available? I have no idea what that means. I have the scope set to “application”, but  I think I tried removing it and going with the default but it made no difference. Then I am also using the ServiceLifeCycle (to initialize data at startup). The callbacks I must implement have two parameters startUp(ConfigurationContext arg0, AxisService arg1) both of which are null according to the debugger but I don’t believe the debugger. Startup issue likely. There is a note that some optional attribute has to be added to the service.xml in the ServiceLifeCycle javadoc and I believe it is the class attribute in the service element. In the on line configuration documentation there is the statementThe full qualified name of the service lifecycle implementation class.Which happens to be the same as the parameter ServiceClass.  My service.xml looks as follows: <serviceGroup>    <service name="DeviceObservationConsumerSecure" class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver">        <module ref="addressing" />        <module ref="sandesha2" />        <module ref="rampart" />        <messageReceivers>            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>        </messageReceivers>        <parameter name="ServiceClass">com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver</parameter>        <parameter name="useOriginalwsdl">true</parameter>        <parameter name="modifyUserWSDLPortAddress">true</parameter>        <operation name="CommunicatePCDData" mep="http://www.w3.org/ns/wsdl/in-out" namespace="urn:ihe:pcd:dec:2010">            <actionMapping>urn:ihe:pcd:2010:CommunicatePCDData</actionMapping>            <outputActionMapping>urn:ihe:pcd:2010:CommunicatePCDDataResponse</outputActionMapping>        </operation>          <wsp:Policy wsu:Id="TLS_SAML2.0"              xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"              xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"              xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"              xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">       <wsp:ExactlyOne> … All the policy stuff … The settings of the wsdl parameters have no effect on the addressing behavior. Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 11:50 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response 

  I am still blocked by being unable to install axis2 which eliminates running any of the tests. In the mean time I am trying to see if I can exert some control in my service. I am using the public void startUp(ConfigurationContext arg0, AxisService arg1)MG>so in the concrete class sample.servicelifecycle.LibraryLifecycle 
MG>String tempDir = System.getProperty("java.io.tmpdir");
            File tempFile = new File(tempDir);
            File libFile = new File(tempFile, "library.xml");MG>you *could* configure your own context by assigning libFile to your own axis2.xml method in my service and maybe from there I can exert some control over the behavior. The ideal solution is, of course, to be able to get maven to succeed in the axis2 install so I could add it to my axiom, rampart, and wss4j projects. Having the source code is a GREAT advantage when debugging! (It also helps a great deal learning how the apache system works.) With axis2 added I could get at the MessageContext which, for now, is a black box MG>I have installed all of axis2-1.6.2 into my local maven repository but it was a long slog thru the modules folderMG>08/29/2012  10:11 AM    <DIR>          transport
08/29/2012  10:11 AM    <DIR>          soapmonitor
08/29/2012  10:11 AM    <DIR>          distribution
08/29/2012  10:12 AM    <DIR>          samples
08/29/2012  10:13 AM    <DIR>          parent
08/29/2012  10:13 AM    <DIR>          resource-bundle
08/29/2012  10:13 AM    <DIR>          kernel
08/29/2012  10:14 AM    <DIR>          codegen
08/29/2012  10:15 AM    <DIR>          java2wsdl
08/29/2012  10:15 AM    <DIR>          jaxbri
08/29/2012  10:15 AM    <DIR>          saaj
08/29/2012  03:28 PM    <DIR>          metadata
08/29/2012  03:29 PM    <DIR>          testutils
08/29/2012  03:29 PM    <DIR>          xmlbeans
08/29/2012  03:29 PM    <DIR>          json
08/29/2012  03:29 PM    <DIR>          mtompolicy
08/29/2012  03:29 PM    <DIR>          spring
08/29/2012  03:29 PM    <DIR>          osgi
08/29/2012  05:07 PM    <DIR>          corba
09/01/2012  09:21 PM    <DIR>          webapp
09/03/2012  08:26 AM    <DIR>          clustering
09/03/2012  11:35 AM    <DIR>          jaxws
09/05/2012  07:35 PM    <DIR>          jaxws-integration
09/05/2012  08:01 PM    <DIR>          .
09/05/2012  08:01 PM    <DIR>          ..
09/05/2012  08:01 PM    <DIR>          lib
09/11/2012  12:42 PM    <DIR>          fastinfoset
09/11/2012  03:46 PM    <DIR>          jibx
09/14/2012  11:30 AM    <DIR>          integration
09/20/2012  09:30 AM    <DIR>          tool
09/21/2012  01:41 PM    <DIR>          adb-codegen
09/21/2012  01:43 PM    <DIR>          scripting
09/21/2012  01:48 PM    <DIR>          mex
09/21/2012  01:48 PM    <DIR>          mtompolicy-mar
09/21/2012  01:48 PM    <DIR>          ping
09/21/2012  01:49 PM    <DIR>          jaxws-mar
09/23/2012  09:38 AM    <DIR>          adb
09/27/2012  08:38 PM    <DIR>          addressing MG>the most problematic module was integration with the package phase incessant executions of ServiceClient  org.apache.axis2.client.ServiceClient.sendReceive MG>(which are never stopped) but causes the next execution to be refused when a re- bind error happens..here is an example <testcase time="5.413" classname="org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest" name="testEchoXMLSync">
    <error message="Connection refused: connect" type="org.apache.axis2.AxisFault">org.apache.axis2.AxisFault: Connection refused: connect
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
    at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
    at org.apache.axis2.mtom.EchoRawMTOMLoadTest.testEchoXMLSync(EchoRawMTOMLoadTest.java:123)
    at org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest.testEchoXMLSync(EchoRawMTOMFileCacheLoadTest.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.extensions.TestSetup.run(TestSetup.java:27)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
    at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
    at org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:242)
    at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:492)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.net.ConnectException: Connection refused: connect MG>this has nothing to do with maven deploy but the inability of the maven-surefire-plugin testcase to not release the previous connection handleMG> i think its time to invoke maven-surefire-plugin skipTests
Is it a bug that the SOAPMonitor cannot (or does not) display the headers in the response? Knowing that would have saved me (and you) a number of days! I can't thank you enough for your help.MG>im sure we can think of something BrianMG>Martin From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 8:23 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response  So there are two problems:1.       The SOAPMonitor has a bug. For some reason the response frame (outgoing messages) does not show the headers (the request frame does).MG>i use SOAPUIhttp://www.soapui.org/ 2.       The SOAP message being generated by Rampart is not adding the 'mustUnderstand' attribute to the addressing headers (though it IS being added to the security header)MG>run this test from org.apache.axis2.handlers.addressing.AddressingOutHandlerTest    @Test
    public void testMustUnderstandSupport() throws Exception
    {
        org.apache.axis2.context.ConfigurationContext cfgCtx=org.apache.axis2.context.ConfigurationContextFactory.createEmptyConfigurationContext();
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport cfgCtx="+cfgCtx);
        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setProperty(org.apache.axis2.addressing.AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS, //"addMustUnderstandToAddressingHeaders";
                           Boolean.TRUE);
        System.out.println("AddressingOutHanderTest::testMustUnderstandSupport msgCtx="+msgCtxt);
//msgContext applies to both <wsa:From and <wsa:To and <wsa:MessageID nodes so expect soapenv:mustUnderstand="1" in all these cases

        org.apache.axis2.addressing.EndpointReference epr = new org.apache.axis2.addressing.EndpointReference("http://www.from.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);

//notice the absence of URL in QName assigment which will cause no namespace qualification
        epr.addReferenceParameter(new javax.xml.namespace.QName("Reference2"),"Value 200");
        msgCtxt.setFrom(epr);
         //at this point <wsa:From node will have EPR address and Reference2

        epr = new org.apache.axis2.addressing.EndpointReference("http://www.to.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);
        epr.addReferenceParameter(
                new  javax.xml.namespace.QName("http://reference.org", "Reference4", "myRef"),
                "Value 400");
 //notice the inclusion of a new URL into the QName this will differentiate itself from being included in the <wsa:To and included as a 'separate'param
        epr.addReferenceParameter(
                new javax.xml.namespace.QName("http://reference.org", "Reference3", "myRef"),
                "Value 300");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport about to MsgCtxtx.setTo(epr) where epr="+epr);
        msgCtxt.setTo(epr);
        msgCtxt.setProperty(WS_ADDRESSING_VERSION,             //WSAddressingVersion
                            Submission.WSA_NAMESPACE);         //"http://www.w3.org/2005/08/addressing"

        epr = new org.apache.axis2.addressing.EndpointReference("http://www.replyTo.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);
        msgCtxt.setReplyTo(epr);

        msgCtxt.setMessageID("123456-7890");
        msgCtxt.setWSAAction("http://www.actions.org/action");

        org.apache.axis2.addressing.RelatesTo relatesTo = new org.apache.axis2.addressing.RelatesTo(
                "http://www.relatesTo.org/service/", "TestRelation");
        msgCtxt.addRelatesTo(relatesTo);

        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport outHandler.invoke(msgCtxt) where outHandler="+outHandler);
        outHandler.invoke(msgCtxt);

        XMLUnit.setIgnoreWhitespace(true);
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport msgCtxt.getEnvelope().toString()="+msgCtxt.getEnvelope().toString());
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
                TestUtil.getOMBuilder("mustUnderstandTest.xml")
                        .getDocumentElement().toString());
    }MG> this is the output you *should* get with the mustUnderstand attribute AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader epr=Address: http://www.to.org/service/
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader cfgCtx=org.apache.axis2.context.ConfigurationContext@1ee29820
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport cfgCtx=org.apache.axis2.context.ConfigurationContext@70e35d5
AddressingOutHanderTest::testMustUnderstandSupport msgCtx=[MessageContext: logID=6a6951b0cd4e2d6123890cb57bb150383474dbf0511a4018]
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.from.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.to.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport about to MsgCtxtx.setTo(epr) where epr=Address: http://www.to.org/service/, Reference Parameters: {{http://reference.org}Reference3=<myRef:Reference3 xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>, {http://reference.org}Reference4=<myRef:Reference4 xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>}
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.replyTo.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport outHandler.invoke(msgCtxt) where outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport msgCtxt.getEnvelope().toString()=
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <myRef:Reference3 xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>
        <myRef:Reference4 xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>
        <wsa:To soapenv:mustUnderstand="1">http://www.to.org/service/</wsa:To>
        <wsa:ReplyTo soapenv:mustUnderstand="1">
            <wsa:Address>http://www.replyTo.org/service/</wsa:Address>
        </wsa:ReplyTo>
        <wsa:From soapenv:mustUnderstand="1">
            <wsa:Address>http://www.from.org/service/</wsa:Address>
            <wsa:ReferenceParameters>
                <Reference2>Value 200</Reference2>
            </wsa:ReferenceParameters>
        </wsa:From>
        <wsa:MessageID soapenv:mustUnderstand="1">123456-7890</wsa:MessageID>
        <wsa:Action soapenv:mustUnderstand="1">http://www.actions.org/action</wsa:Action>
        <wsa:RelatesTo RelationshipType="TestRelation" soapenv:mustUnderstand="1">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header><soapenv:Body />
</soapenv:Envelope> MG> From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Believe it or not it may be fine. It's the SOAP monitor not showing the headers on the response side. It shows them on the send side, but not the response. Since I am on a local host I can't use wireshark which would have solved the issue. This I need to do because my client in one case is giving an error about the header but in the other case it isn't (I see the headers returned). But the SOAP monitor shows no headers in either case on the response. ARRG! From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response I added those lines of code to the xml and it had no effect. I think the only way I am going to be able to address this is to step through the axis routines and see where the header (both addressing and security) created by rampart is stripped. I am using Eclipse, and to do this requires the remote debugging option. I could parse through source if I had a jar with source (I could make one of those if I could get mvn eclipse:eclipse -fn to work).In the meantime I do have a 1.5.1 based distribution that IS working; the headers ARE being received. Can't find the differences yet in the services and axis2 xml configuration files. From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response if header suppresssion is specific to addressing then this is what is gating you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam = msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                log.debug(
                        "The AddressingInHandler has been disabled. No further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES = "disableAddressingForOutMessages";
        Object o = msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or not.
            // Get default value from module.xml or axis2.xml files
            param = msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, MODULE_NAME, handlerDesc);
            disableAddressing =
                msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
                    JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400Oh, sorry! The entire header. So in the SOAPMonitor and the client's response all one receives is <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">    <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> But I am glad to know that it is there. There are so many possible settings in the xmls that I don't understand it could be something very innocent.Having or removing this text from the axis2.xml makes no difference on the behavior (the addressing module IS present):     <!--Configuring module , providing parameters for modules whether they refer or not-->    <moduleConfig name="addressing">        <parameter name="includeOptionalHeaders">true</parameter>                                <parameter name="required">true</parameter>    </moduleConfig> In the service xml I don't understand the 'scope' parameter in the service declaration: service name="DeviceObservationConsumerSecure" scope="application" class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver" The policy is in the service xml. But according to the axis2 documentation nothing I do in the service.xml affects the addressing; this can only be controlled at the global level in the axis2.xml. Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400Martin, I was able to trace into the Rampart code during the building of the response and the response is built correctly.In the build() method of the org.apache.rampart.MessageBuilder  it looks as follows: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="true">                  <wsu:Timestamp wsu:Id="TS-9">                              <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>                            <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>                  </wsu:Timestamp>    </wsse:Security>    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>    <wsa:ReplyTo>      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>    </wsa:ReplyTo>    <wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>    <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>  </soapenv:Header>  <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> The correct headers for BOTH addressing and security are present. However, I have still been unable to get the Axis2 maven to work correctly and cannot step into the Axis2 routines which follow. So something happens in Axis2 that strips away that header. Any idea what might allow the header to be removed? Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response Yes..I always hardcoded those values in the descriptor...but the maven-mar-plugin should reconfigure axis2.xml to include  <module ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400Martin, I'll take a look at the Rampart checks but I am also having a problem with no ws-addressing in the response and that's in Axis2 which I can't get loaded because of maven problems. I do see success in the older versions (1.5.1). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400Martin, This looks like client side testing. I have no problem on the client. It's my service whose response has no headers. The client is much easier to deal with as one tends to use code and for that there is great help from Eclipse and javadoc. The service, on the other hand, one usually has to use xml to control all behaviors and that is very difficult (difficult in the sense one has no idea what, for example, the possible parameters, elements, attributes, etc. are and what they do.and no help from Eclipse like there is with code). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to reconstruct our mustUnderstand later on
        String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results = engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd, rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned  on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
                        inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq = (String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq)) {
            try {
                
                String cancelAction = TrustUtil.getWSTNamespace(rmd.getWstVersion()) + RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt = msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if (Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey = RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId = (String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd, tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element) rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode = rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode, (Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(), config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi ?s Bizalmass?gi kinyilatkoztat?s/Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit? Ez az ?zenet bizalmas.  Ha nem ?n az akinek sz?nva volt, akkor k?rj?k, hogy jelentse azt nek?nk vissza. Semmif?le tov?bb?t?sa vagy m?solat?nak k?sz?t?se nem megengedett.  Ez az ?zenet csak ismeret cser?t szolg?l ?s semmif?le jogi alkalmazhat?s?ga sincs.  Mivel az electronikus ?zenetek k?nnyen megv?ltoztathat?ak, ez?rt minket semmi felel?s?g nem terhelhet ezen ?zenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400Martin, I tried that as well and the response still came back with no headers. Somehow the STS service manages to get a header in the response (missing must understand in the addressing); but it's a start.  Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Hi Brian
i'll take the last question.. from axis2.xml i assume you have included optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new java.io.File(System.getProperty("basedir",".") + "/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx =org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing module should now be true

        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);        
        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(), org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTest.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/</wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action</wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400 I am re-opening a question I saw no answer to asked in this forum quite a while  ago. In the STS service requesting a SMAL20 token the response is okay.But in the service that needs to have the SAML20 token, the response has no headers at all. This is in spite of the must understand setting in the client headers in both the addressing and security part. Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the <parameter name="includeOptionalHeaders">true</parameter> in the service.xml does not help (though that is what I used programmatically on the client side to generate the correct addressing headers).Is this a bug or what am I doing wrong in the configuration? Thanks, Brian ReinholdNo virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12 		 	   		  

RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Martin,

By using the command sequence

 

mvn -DskipTests=true install eclipse:eclipse

 

I was able to get the axis2 project installed. Now I am able to step through
the addition of the addressing headers to the out message. From here it is
clear that only the 'use optional headers' option is read from the
configuration of the addressing module in the axis2.xml file. The 'add must
understand' condition is read from the MessageContext object. That is what I
would expect. Axis2 should read the incoming message and see the
mustUnderstand attribute set to true and automatically set the property in
the MessageContext object of the outgoing response to true so that

 

        boolean addMustUnderstandAttribute =
msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);

 

in the 'doInvoke()' method in the AddressingOutHandler would return true.
But it returns false.

 

So the question is why. Is there something that I could possibly do in the
service.xml that would cause this error? One parameter I do not understand
in the configuration guide is the scope. It is described as

 

scope: (Optional Attribute) The time period during which runtime information
of the deployed services will be available. Scope is of several types-
"application", "soapsession", "transportsession", "request". The default
value (if you don't enter any value) will be "request"

 

The runtime information will be available? I have no idea what that means. I
have the scope set to "application", but  I think I tried removing it and
going with the default but it made no difference.

 

Then I am also using the ServiceLifeCycle (to initialize data at startup).
The callbacks I must implement have two parameters
startUp(ConfigurationContext arg0, AxisService arg1) both of which are null
according to the debugger but I don't believe the debugger. Startup issue
likely. There is a note that some optional attribute has to be added to the
service.xml in the ServiceLifeCycle javadoc and I believe it is the class
attribute in the service element. In the on line configuration documentation
there is the statement

The full qualified name of the service lifecycle implementation class.

Which happens to be the same as the parameter ServiceClass. 

 

My service.xml looks as follows:

 

<serviceGroup>

    <service name="DeviceObservationConsumerSecure"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver">

        <module ref="addressing" />

        <module ref="sandesha2" />

        <module ref="rampart" />

        <messageReceivers>

            <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

        </messageReceivers>

        <parameter
name="ServiceClass">com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceive
r</parameter>

        <parameter name="useOriginalwsdl">true</parameter>

        <parameter name="modifyUserWSDLPortAddress">true</parameter>

        <operation name="CommunicatePCDData"
mep="http://www.w3.org/ns/wsdl/in-out" namespace="urn:ihe:pcd:dec:2010">

 
<actionMapping>urn:ihe:pcd:2010:CommunicatePCDData</actionMapping>

 
<outputActionMapping>urn:ihe:pcd:2010:CommunicatePCDDataResponse</outputActi
onMapping>

        </operation>

        

  <wsp:Policy wsu:Id="TLS_SAML2.0"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd"

              xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"

              xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"

 
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">

       <wsp:ExactlyOne> . All the policy stuff .

 

The settings of the wsdl parameters have no effect on the addressing
behavior.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 11:50 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 





 

 

I am still blocked by being unable to install axis2 which eliminates running
any of the tests. In the mean time I am trying to see if I can exert some
control in my service. I am using the

 

public void startUp(ConfigurationContext arg0, AxisService arg1)

MG>so in the concrete class sample.servicelifecycle.LibraryLifecycle 
MG>String tempDir = System.getProperty("java.io.tmpdir");
            File tempFile = new File(tempDir);
            File libFile = new File(tempFile, "library.xml");

MG>you *could* configure your own context by assigning libFile to your own
axis2.xml

 

method in my service and maybe from there I can exert some control over the
behavior. The ideal solution is, of course, to be able to get maven to
succeed in the axis2 install so I could add it to my axiom, rampart, and
wss4j projects. Having the source code is a GREAT advantage when debugging!
(It also helps a great deal learning how the apache system works.) With
axis2 added I could get at the MessageContext which, for now, is a black box

 

MG>I have installed all of axis2-1.6.2 into my local maven repository but it
was a long slog thru the modules folder

MG>

08/29/2012  10:11 AM    <DIR>          transport
08/29/2012  10:11 AM    <DIR>          soapmonitor
08/29/2012  10:11 AM    <DIR>          distribution
08/29/2012  10:12 AM    <DIR>          samples
08/29/2012  10:13 AM    <DIR>          parent
08/29/2012  10:13 AM    <DIR>          resource-bundle
08/29/2012  10:13 AM    <DIR>          kernel
08/29/2012  10:14 AM    <DIR>          codegen
08/29/2012  10:15 AM    <DIR>          java2wsdl
08/29/2012  10:15 AM    <DIR>          jaxbri
08/29/2012  10:15 AM    <DIR>          saaj
08/29/2012  03:28 PM    <DIR>          metadata
08/29/2012  03:29 PM    <DIR>          testutils
08/29/2012  03:29 PM    <DIR>          xmlbeans
08/29/2012  03:29 PM    <DIR>          json
08/29/2012  03:29 PM    <DIR>          mtompolicy
08/29/2012  03:29 PM    <DIR>          spring
08/29/2012  03:29 PM    <DIR>          osgi
08/29/2012  05:07 PM    <DIR>          corba
09/01/2012  09:21 PM    <DIR>          webapp
09/03/2012  08:26 AM    <DIR>          clustering
09/03/2012  11:35 AM    <DIR>          jaxws
09/05/2012  07:35 PM    <DIR>          jaxws-integration
09/05/2012  08:01 PM    <DIR>          .
09/05/2012  08:01 PM    <DIR>          ..
09/05/2012  08:01 PM    <DIR>          lib
09/11/2012  12:42 PM    <DIR>          fastinfoset
09/11/2012  03:46 PM    <DIR>          jibx
09/14/2012  11:30 AM    <DIR>          integration
09/20/2012  09:30 AM    <DIR>          tool
09/21/2012  01:41 PM    <DIR>          adb-codegen
09/21/2012  01:43 PM    <DIR>          scripting
09/21/2012  01:48 PM    <DIR>          mex
09/21/2012  01:48 PM    <DIR>          mtompolicy-mar
09/21/2012  01:48 PM    <DIR>          ping
09/21/2012  01:49 PM    <DIR>          jaxws-mar
09/23/2012  09:38 AM    <DIR>          adb
09/27/2012  08:38 PM    <DIR>          addressing

 

MG>the most problematic module was integration with the package phase
incessant executions of ServiceClient
org.apache.axis2.client.ServiceClient.sendReceive MG>(which are never
stopped) but causes the next execution to be refused when a re- bind error
happens..here is an example

 <testcase time="5.413"
classname="org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest"
name="testEchoXMLSync">
    <error message="Connection refused: connect"
type="org.apache.axis2.AxisFault">org.apache.axis2.AxisFault: Connection
refused: connect
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithC
ommons(CommonsHTTPTransportSender.java:404)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTT
PTransportSender.java:231)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperatio
n.java:406)
    at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisO
peration.java:229)
    at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
    at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
    at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
    at
org.apache.axis2.mtom.EchoRawMTOMLoadTest.testEchoXMLSync(EchoRawMTOMLoadTes
t.java:123)
    at
org.apache.axis2.mtom.EchoRawMTOMFileCacheLoadTest.testEchoXMLSync(EchoRawMT
OMFileCacheLoadTest.java:67)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
    at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.extensions.TestSetup.run(TestSetup.java:27)
    at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83
)
    at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62
)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(Ab
stractDirectoryTestSuite.java:140)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractD
irectoryTestSuite.java:127)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireB
ooter.java:350)
    at
org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:242)
    at
org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:
492)
    at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPl
uginManager.java:107)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:2
09)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:1
53)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:1
45)
    at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Life
cycleModuleBuilder.java:84)
    at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Life
cycleModuleBuilder.java:59)
    at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(Lif
ecycleStarter.java:183)
    at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarte
r.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.ja
va:290)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.
java:409)
    at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.net.ConnectException: Connection refused: connect

 

MG>this has nothing to do with maven deploy but the inability of the
maven-surefire-plugin testcase to not release the previous connection handle

MG> i think its time to invoke maven-surefire-plugin skipTests
<http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#skipTe
sts> 


Is it a bug that the SOAPMonitor cannot (or does not) display the headers in
the response? Knowing that would have saved me (and you) a number of days! I
can't thank you enough for your help.

MG>im sure we can think of something

 

Brian

MG>Martin

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 8:23 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

 

So there are two problems:

1.       The SOAPMonitor has a bug. For some reason the response frame
(outgoing messages) does not show the headers (the request frame does).

MG>i use SOAPUI

http://www.soapui.org/

 

2.       The SOAP message being generated by Rampart is not adding the
'mustUnderstand' attribute to the addressing headers (though it IS being
added to the security header)

MG>run this test from
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest

    @Test
    public void testMustUnderstandSupport() throws Exception
    {
        org.apache.axis2.context.ConfigurationContext
cfgCtx=org.apache.axis2.context.ConfigurationContextFactory.createEmptyConfi
gurationContext();
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx="+cfgCtx);
        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setProperty(org.apache.axis2.addressing.AddressingConstants.ADD_MUST
_UNDERSTAND_TO_ADDRESSING_HEADERS, //"addMustUnderstandToAddressingHeaders";
                           Boolean.TRUE);
 
System.out.println("AddressingOutHanderTest::testMustUnderstandSupport
msgCtx="+msgCtxt);
//msgContext applies to both <wsa:From and <wsa:To and <wsa:MessageID nodes
so expect soapenv:mustUnderstand="1" in all these cases

        org.apache.axis2.addressing.EndpointReference epr = new
org.apache.axis2.addressing.EndpointReference("http://www.from.org/service/"
);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);

//notice the absence of URL in QName assigment which will cause no namespace
qualification
        epr.addReferenceParameter(new
javax.xml.namespace.QName("Reference2"),"Value 200");
        msgCtxt.setFrom(epr);
         //at this point <wsa:From node will have EPR address and Reference2

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.to.org/service/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        epr.addReferenceParameter(
                new  javax.xml.namespace.QName("http://reference.org",
"Reference4", "myRef"),
                "Value 400");
 //notice the inclusion of a new URL into the QName this will differentiate
itself from being included in the <wsa:To and included as a 'separate'param
        epr.addReferenceParameter(
                new javax.xml.namespace.QName("http://reference.org",
"Reference3", "myRef"),
                "Value 300");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
about to MsgCtxtx.setTo(epr) where epr="+epr);
        msgCtxt.setTo(epr);
        msgCtxt.setProperty(WS_ADDRESSING_VERSION,
//WSAddressingVersion
                            Submission.WSA_NAMESPACE);
//"http://www.w3.org/2005/08/addressing"

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.replyTo.org/servic
e/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        msgCtxt.setReplyTo(epr);

        msgCtxt.setMessageID("123456-7890");
        msgCtxt.setWSAAction("http://www.actions.org/action");

        org.apache.axis2.addressing.RelatesTo relatesTo = new
org.apache.axis2.addressing.RelatesTo(
                "http://www.relatesTo.org/service/", "TestRelation");
        msgCtxt.addRelatesTo(relatesTo);

 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler="+outHandler);
        outHandler.invoke(msgCtxt);

        XMLUnit.setIgnoreWhitespace(true);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()="+msgCtxt.getEnvelope().toString());
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
                TestUtil.getOMBuilder("mustUnderstandTest.xml")
                        .getDocumentElement().toString());
    }

MG>

 this is the output you *should* get with the mustUnderstand attribute

 

AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader
cfgCtx=org.apache.axis2.context.ConfigurationContext@1ee29820
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx=org.apache.axis2.context.ConfigurationContext@70e35d5
AddressingOutHanderTest::testMustUnderstandSupport msgCtx=[MessageContext:
logID=6a6951b0cd4e2d6123890cb57bb150383474dbf0511a4018]
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.from.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport about to
MsgCtxtx.setTo(epr) where epr=Address: http://www.to.org/service/, Reference
Parameters: {{http://reference.org}Reference3=<myRef:Reference3
xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>,
{http://reference.org}Reference4=<myRef:Reference4
xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>}
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.replyTo.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()=
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <myRef:Reference3 xmlns:myRef="http://reference.org">Value
300</myRef:Reference3>
        <myRef:Reference4 xmlns:myRef="http://reference.org">Value
400</myRef:Reference4>
        <wsa:To soapenv:mustUnderstand="1">http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:ReplyTo soapenv:mustUnderstand="1">
            <wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address> </wsa:Address>
        </wsa:ReplyTo>
        <wsa:From soapenv:mustUnderstand="1">
            <wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address> </wsa:Address>
            <wsa:ReferenceParameters>
                <Reference2>Value 200</Reference2>
            </wsa:ReferenceParameters>
        </wsa:From>
        <wsa:MessageID
soapenv:mustUnderstand="1">123456-7890</wsa:MessageID>
        <wsa:Action soapenv:mustUnderstand="1">http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:RelatesTo RelationshipType="TestRelation"
soapenv:mustUnderstand="1">http://www.relatesTo.org/service/
<http://www.relatesTo.org/service/%3c/wsa:RelatesTo> </wsa:RelatesTo>
    </soapenv:Header><soapenv:Body />
</soapenv:Envelope>

 

MG>

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Believe it or not it may be fine. It's the SOAP monitor not showing the
headers on the response side. It shows them on the send side, but not the
response. Since I am on a local host I can't use wireshark which would have
solved the issue. This I need to do because my client in one case is giving
an error about the header but in the other case it isn't (I see the headers
returned). But the SOAP monitor shows no headers in either case on the
response. ARRG!

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse -fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can't find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client's response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don't understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don't understand the 'scope' parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I'll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that's in Axis2 which I can't get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It's
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do.and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi ?s Bizalmass?gi kinyilatkoztat?s/Verzicht und
Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?

 

Ez az ?zenet bizalmas.  Ha nem ?n az akinek sz?nva volt, akkor k?rj?k, hogy
jelentse azt nek?nk vissza. Semmif?le tov?bb?t?sa vagy m?solat?nak k?sz?t?se
nem megengedett.  Ez az ?zenet csak ismeret cser?t szolg?l ?s semmif?le jogi
alkalmazhat?s?ga sincs.  Mivel az electronikus ?zenetek k?nnyen
megv?ltoztathat?ak, ez?rt minket semmi felel?s?g nem terhelhet ezen ?zenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it's a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12


RE: No headers in response

Posted by Martin Gainty <mg...@hotmail.com>.




 		 	   		  

RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Martin,

 

I am still blocked by being unable to install axis2 which eliminates running
any of the tests. In the mean time I am trying to see if I can exert some
control in my service. I am using the

 

public void startUp(ConfigurationContext arg0, AxisService arg1)

 

method in my service and maybe from there I can exert some control over the
behavior. The ideal solution is, of course, to be able to get maven to
succeed in the axis2 install so I could add it to my axiom, rampart, and
wss4j projects. Having the source code is a GREAT advantage when debugging!
(It also helps a great deal learning how the apache system works.) With
axis2 added I could get at the MessageContext which, for now, is a black
box.

 

Is it a bug that the SOAPMonitor cannot (or does not) display the headers in
the response? Knowing that would have saved me (and you) a number of days! I
can't thank you enough for your help.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Sunday, September 30, 2012 8:23 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

 

So there are two problems:

1.       The SOAPMonitor has a bug. For some reason the response frame
(outgoing messages) does not show the headers (the request frame does).

MG>i use SOAPUI

http://www.soapui.org/

 

2.       The SOAP message being generated by Rampart is not adding the
'mustUnderstand' attribute to the addressing headers (though it IS being
added to the security header)

MG>run this test from
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest

    @Test
    public void testMustUnderstandSupport() throws Exception
    {
        org.apache.axis2.context.ConfigurationContext
cfgCtx=org.apache.axis2.context.ConfigurationContextFactory.createEmptyConfi
gurationContext();
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx="+cfgCtx);
        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setProperty(org.apache.axis2.addressing.AddressingConstants.ADD_MUST
_UNDERSTAND_TO_ADDRESSING_HEADERS, //"addMustUnderstandToAddressingHeaders";
                           Boolean.TRUE);
 
System.out.println("AddressingOutHanderTest::testMustUnderstandSupport
msgCtx="+msgCtxt);
//msgContext applies to both <wsa:From and <wsa:To and <wsa:MessageID nodes
so expect soapenv:mustUnderstand="1" in all these cases

        org.apache.axis2.addressing.EndpointReference epr = new
org.apache.axis2.addressing.EndpointReference("http://www.from.org/service/"
);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);

//notice the absence of URL in QName assigment which will cause no namespace
qualification
        epr.addReferenceParameter(new
javax.xml.namespace.QName("Reference2"),"Value 200");
        msgCtxt.setFrom(epr);
         //at this point <wsa:From node will have EPR address and Reference2

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.to.org/service/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        epr.addReferenceParameter(
                new  javax.xml.namespace.QName("http://reference.org",
"Reference4", "myRef"),
                "Value 400");
 //notice the inclusion of a new URL into the QName this will differentiate
itself from being included in the <wsa:To and included as a 'separate'param
        epr.addReferenceParameter(
                new javax.xml.namespace.QName("http://reference.org",
"Reference3", "myRef"),
                "Value 300");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
about to MsgCtxtx.setTo(epr) where epr="+epr);
        msgCtxt.setTo(epr);
        msgCtxt.setProperty(WS_ADDRESSING_VERSION,
//WSAddressingVersion
                            Submission.WSA_NAMESPACE);
//"http://www.w3.org/2005/08/addressing"

        epr = new
org.apache.axis2.addressing.EndpointReference("http://www.replyTo.org/servic
e/");
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
epr="+epr);
        msgCtxt.setReplyTo(epr);

        msgCtxt.setMessageID("123456-7890");
        msgCtxt.setWSAAction("http://www.actions.org/action");

        org.apache.axis2.addressing.RelatesTo relatesTo = new
org.apache.axis2.addressing.RelatesTo(
                "http://www.relatesTo.org/service/", "TestRelation");
        msgCtxt.addRelatesTo(relatesTo);

 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler="+outHandler);
        outHandler.invoke(msgCtxt);

        XMLUnit.setIgnoreWhitespace(true);
 
System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()="+msgCtxt.getEnvelope().toString());
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
                TestUtil.getOMBuilder("mustUnderstandTest.xml")
                        .getDocumentElement().toString());
    }

MG>

 this is the output you *should* get with the mustUnderstand attribute

 

AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader
cfgCtx=org.apache.axis2.context.ConfigurationContext@1ee29820
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
cfgCtx=org.apache.axis2.context.ConfigurationContext@70e35d5
AddressingOutHanderTest::testMustUnderstandSupport msgCtx=[MessageContext:
logID=6a6951b0cd4e2d6123890cb57bb150383474dbf0511a4018]
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.from.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.to.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport about to
MsgCtxtx.setTo(epr) where epr=Address: http://www.to.org/service/, Reference
Parameters: {{http://reference.org}Reference3=<myRef:Reference3
xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>,
{http://reference.org}Reference4=<myRef:Reference4
xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>}
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address:
http://www.replyTo.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport
outHandler.invoke(msgCtxt) where outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport
msgCtxt.getEnvelope().toString()=
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <myRef:Reference3 xmlns:myRef="http://reference.org">Value
300</myRef:Reference3>
        <myRef:Reference4 xmlns:myRef="http://reference.org">Value
400</myRef:Reference4>
        <wsa:To soapenv:mustUnderstand="1">http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:ReplyTo soapenv:mustUnderstand="1">
            <wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address> </wsa:Address>
        </wsa:ReplyTo>
        <wsa:From soapenv:mustUnderstand="1">
            <wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address> </wsa:Address>
            <wsa:ReferenceParameters>
                <Reference2>Value 200</Reference2>
            </wsa:ReferenceParameters>
        </wsa:From>
        <wsa:MessageID
soapenv:mustUnderstand="1">123456-7890</wsa:MessageID>
        <wsa:Action soapenv:mustUnderstand="1">http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:RelatesTo RelationshipType="TestRelation"
soapenv:mustUnderstand="1">http://www.relatesTo.org/service/
<http://www.relatesTo.org/service/%3c/wsa:RelatesTo> </wsa:RelatesTo>
    </soapenv:Header><soapenv:Body />
</soapenv:Envelope>

 

MG>

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Believe it or not it may be fine. It's the SOAP monitor not showing the
headers on the response side. It shows them on the send side, but not the
response. Since I am on a local host I can't use wireshark which would have
solved the issue. This I need to do because my client in one case is giving
an error about the header but in the other case it isn't (I see the headers
returned). But the SOAP monitor shows no headers in either case on the
response. ARRG!

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse -fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can't find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client's response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don't understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don't understand the 'scope' parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I'll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that's in Axis2 which I can't get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It's
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do.and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi ?s Bizalmass?gi kinyilatkoztat?s/Verzicht und
Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?

 

Ez az ?zenet bizalmas.  Ha nem ?n az akinek sz?nva volt, akkor k?rj?k, hogy
jelentse azt nek?nk vissza. Semmif?le tov?bb?t?sa vagy m?solat?nak k?sz?t?se
nem megengedett.  Ez az ?zenet csak ismeret cser?t szolg?l ?s semmif?le jogi
alkalmazhat?s?ga sincs.  Mivel az electronikus ?zenetek k?nnyen
megv?ltoztathat?ak, ez?rt minket semmi felel?s?g nem terhelhet ezen ?zenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it's a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le
destinataire pr?vu, nous te demandons avec bont? que pour satisfaire
informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie
de ceci est interdite. Ce message sert ? l'information seulement et n'aura
pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email
peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter
aucune responsabilit? pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12


RE: No headers in response

Posted by Martin Gainty <mg...@hotmail.com>.


So there are two problems:1.       The SOAPMonitor has a bug. For some reason the response frame (outgoing messages) does not show the headers (the request frame does).MG>i use SOAPUIhttp://www.soapui.org/

2.       The SOAP message being generated by Rampart is not adding the ‘mustUnderstand’ attribute to the addressing headers (though it IS being added to the security header)

MG>run this test from org.apache.axis2.handlers.addressing.AddressingOutHandlerTest
    @Test
    public void testMustUnderstandSupport() throws Exception
    {
        org.apache.axis2.context.ConfigurationContext cfgCtx=org.apache.axis2.context.ConfigurationContextFactory.createEmptyConfigurationContext();
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport cfgCtx="+cfgCtx);
        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setProperty(org.apache.axis2.addressing.AddressingConstants.ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS, //"addMustUnderstandToAddressingHeaders";
                           Boolean.TRUE);
        System.out.println("AddressingOutHanderTest::testMustUnderstandSupport msgCtx="+msgCtxt);
//msgContext applies to both <wsa:From and <wsa:To and <wsa:MessageID nodes so expect soapenv:mustUnderstand="1" in all these cases

        org.apache.axis2.addressing.EndpointReference epr = new org.apache.axis2.addressing.EndpointReference("http://www.from.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);

//notice the absence of URL in QName assigment which will cause no namespace qualification
        epr.addReferenceParameter(new javax.xml.namespace.QName("Reference2"),"Value 200");
        msgCtxt.setFrom(epr);
         //at this point <wsa:From node will have EPR address and Reference2

        epr = new org.apache.axis2.addressing.EndpointReference("http://www.to.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);
        epr.addReferenceParameter(
                new  javax.xml.namespace.QName("http://reference.org", "Reference4", "myRef"),
                "Value 400");
 //notice the inclusion of a new URL into the QName this will differentiate itself from being included in the <wsa:To and included as a 'separate'param
        epr.addReferenceParameter(
                new javax.xml.namespace.QName("http://reference.org", "Reference3", "myRef"),
                "Value 300");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport about to MsgCtxtx.setTo(epr) where epr="+epr);
        msgCtxt.setTo(epr);
        msgCtxt.setProperty(WS_ADDRESSING_VERSION,             //WSAddressingVersion
                            Submission.WSA_NAMESPACE);         //"http://www.w3.org/2005/08/addressing"

        epr = new org.apache.axis2.addressing.EndpointReference("http://www.replyTo.org/service/");
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport epr="+epr);
        msgCtxt.setReplyTo(epr);

        msgCtxt.setMessageID("123456-7890");
        msgCtxt.setWSAAction("http://www.actions.org/action");

        org.apache.axis2.addressing.RelatesTo relatesTo = new org.apache.axis2.addressing.RelatesTo(
                "http://www.relatesTo.org/service/", "TestRelation");
        msgCtxt.addRelatesTo(relatesTo);

        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport outHandler.invoke(msgCtxt) where outHandler="+outHandler);
        outHandler.invoke(msgCtxt);

        XMLUnit.setIgnoreWhitespace(true);
        System.out.println("AddressingOutHandlerTest::testMustUnderstandSupport msgCtxt.getEnvelope().toString()="+msgCtxt.getEnvelope().toString());
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
                TestUtil.getOMBuilder("mustUnderstandTest.xml")
                        .getDocumentElement().toString());
    }MG>

 this is the output you *should* get with the mustUnderstand attribute
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader epr=Address: http://www.to.org/service/
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testAddToSOAPHeader cfgCtx=org.apache.axis2.context.ConfigurationContext@1ee29820
AddressingOutHandlerTest::setUp outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport cfgCtx=org.apache.axis2.context.ConfigurationContext@70e35d5
AddressingOutHanderTest::testMustUnderstandSupport msgCtx=[MessageContext: logID=6a6951b0cd4e2d6123890cb57bb150383474dbf0511a4018]
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.from.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.to.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport about to MsgCtxtx.setTo(epr) where epr=Address: http://www.to.org/service/, Reference Parameters: {{http://reference.org}Reference3=<myRef:Reference3 xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>, {http://reference.org}Reference4=<myRef:Reference4 xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>}
AddressingOutHandlerTest::testMustUnderstandSupport epr=Address: http://www.replyTo.org/service/
AddressingOutHandlerTest::testMustUnderstandSupport outHandler.invoke(msgCtxt) where outHandler=DefaultHandler
AddressingOutHandlerTest::testMustUnderstandSupport msgCtxt.getEnvelope().toString()=
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
        <myRef:Reference3 xmlns:myRef="http://reference.org">Value 300</myRef:Reference3>
        <myRef:Reference4 xmlns:myRef="http://reference.org">Value 400</myRef:Reference4>
        <wsa:To soapenv:mustUnderstand="1">http://www.to.org/service/</wsa:To>
        <wsa:ReplyTo soapenv:mustUnderstand="1">
            <wsa:Address>http://www.replyTo.org/service/</wsa:Address>
        </wsa:ReplyTo>
        <wsa:From soapenv:mustUnderstand="1">
            <wsa:Address>http://www.from.org/service/</wsa:Address>
            <wsa:ReferenceParameters>
                <Reference2>Value 200</Reference2>
            </wsa:ReferenceParameters>
        </wsa:From>
        <wsa:MessageID soapenv:mustUnderstand="1">123456-7890</wsa:MessageID>
        <wsa:Action soapenv:mustUnderstand="1">http://www.actions.org/action</wsa:Action>
        <wsa:RelatesTo RelationshipType="TestRelation" soapenv:mustUnderstand="1">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header><soapenv:Body />
</soapenv:Envelope>
 MG>
 From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Believe it or not it may be fine. It’s the SOAP monitor not showing the headers on the response side. It shows them on the send side, but not the response. Since I am on a local host I can’t use wireshark which would have solved the issue. This I need to do because my client in one case is giving an error about the header but in the other case it isn’t (I see the headers returned). But the SOAP monitor shows no headers in either case on the response. ARRG! From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response I added those lines of code to the xml and it had no effect. I think the only way I am going to be able to address this is to step through the axis routines and see where the header (both addressing and security) created by rampart is stripped. I am using Eclipse, and to do this requires the remote debugging option. I could parse through source if I had a jar with source (I could make one of those if I could get mvn eclipse:eclipse –fn to work).In the meantime I do have a 1.5.1 based distribution that IS working; the headers ARE being received. Can’t find the differences yet in the services and axis2 xml configuration files. From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response if header suppresssion is specific to addressing then this is what is gating you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam = msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                log.debug(
                        "The AddressingInHandler has been disabled. No further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES = "disableAddressingForOutMessages";
        Object o = msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or not.
            // Get default value from module.xml or axis2.xml files
            param = msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, MODULE_NAME, handlerDesc);
            disableAddressing =
                msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
                    JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400Oh, sorry! The entire header. So in the SOAPMonitor and the client’s response all one receives is <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">    <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> But I am glad to know that it is there. There are so many possible settings in the xmls that I don’t understand it could be something very innocent.Having or removing this text from the axis2.xml makes no difference on the behavior (the addressing module IS present):     <!--Configuring module , providing parameters for modules whether they refer or not-->    <moduleConfig name="addressing">        <parameter name="includeOptionalHeaders">true</parameter>                                <parameter name="required">true</parameter>    </moduleConfig> In the service xml I don’t understand the ‘scope’ parameter in the service declaration: service name="DeviceObservationConsumerSecure" scope="application" class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver" The policy is in the service xml. But according to the axis2 documentation nothing I do in the service.xml affects the addressing; this can only be controlled at the global level in the axis2.xml. Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400Martin, I was able to trace into the Rampart code during the building of the response and the response is built correctly.In the build() method of the org.apache.rampart.MessageBuilder  it looks as follows: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="true">                  <wsu:Timestamp wsu:Id="TS-9">                              <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>                            <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>                  </wsu:Timestamp>    </wsse:Security>    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>    <wsa:ReplyTo>      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>    </wsa:ReplyTo>    <wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>    <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>  </soapenv:Header>  <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> The correct headers for BOTH addressing and security are present. However, I have still been unable to get the Axis2 maven to work correctly and cannot step into the Axis2 routines which follow. So something happens in Axis2 that strips away that header. Any idea what might allow the header to be removed? Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response Yes..I always hardcoded those values in the descriptor...but the maven-mar-plugin should reconfigure axis2.xml to include  <module ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400Martin, I’ll take a look at the Rampart checks but I am also having a problem with no ws-addressing in the response and that’s in Axis2 which I can’t get loaded because of maven problems. I do see success in the older versions (1.5.1). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400Martin, This looks like client side testing. I have no problem on the client. It’s my service whose response has no headers. The client is much easier to deal with as one tends to use code and for that there is great help from Eclipse and javadoc. The service, on the other hand, one usually has to use xml to control all behaviors and that is very difficult (difficult in the sense one has no idea what, for example, the possible parameters, elements, attributes, etc. are and what they do…and no help from Eclipse like there is with code). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to reconstruct our mustUnderstand later on
        String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results = engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd, rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned  on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
                        inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq = (String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq)) {
            try {
                
                String cancelAction = TrustUtil.getWSTNamespace(rmd.getWstVersion()) + RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt = msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if (Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey = RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId = (String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd, tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element) rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode = rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode, (Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(), config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi ?s Bizalmass?gi kinyilatkoztat?s/Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit? Ez az ?zenet bizalmas.  Ha nem ?n az akinek sz?nva volt, akkor k?rj?k, hogy jelentse azt nek?nk vissza. Semmif?le tov?bb?t?sa vagy m?solat?nak k?sz?t?se nem megengedett.  Ez az ?zenet csak ismeret cser?t szolg?l ?s semmif?le jogi alkalmazhat?s?ga sincs.  Mivel az electronikus ?zenetek k?nnyen megv?ltoztathat?ak, ez?rt minket semmi felel?s?g nem terhelhet ezen ?zenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400Martin, I tried that as well and the response still came back with no headers. Somehow the STS service manages to get a header in the response (missing must understand in the addressing); but it’s a start.  Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Hi Brian
i'll take the last question.. from axis2.xml i assume you have included optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new java.io.File(System.getProperty("basedir",".") + "/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx =org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing module should now be true

        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);        
        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(), org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTest.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/</wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action</wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de d?ni et de confidentialit?
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut ?tre privil?gi?. Si vous n'?tes pas le destinataire pr?vu, nous te demandons avec bont? que pour satisfaire informez l'exp?diteur. N'importe quelle diffusion non autoris?e ou la copie de ceci est interdite. Ce message sert ? l'information seulement et n'aura pas n'importe quel effet l?galement obligatoire. ?tant donn? que les email peuvent facilement ?tre sujets ? la manipulation, nous ne pouvons accepter aucune responsabilit? pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400 I am re-opening a question I saw no answer to asked in this forum quite a while  ago. In the STS service requesting a SMAL20 token the response is okay.But in the service that needs to have the SAML20 token, the response has no headers at all. This is in spite of the must understand setting in the client headers in both the addressing and security part. Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the <parameter name="includeOptionalHeaders">true</parameter> in the service.xml does not help (though that is what I used programmatically on the client side to generate the correct addressing headers).Is this a bug or what am I doing wrong in the configuration? Thanks, Brian ReinholdNo virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12 		 	   		  

Re: No headers in response

Posted by Andreas Veithen <an...@gmail.com>.
Since the soapmonitorPhase is only used by the SOAP monitor, it should
be possible to safely move the phase to the end of the list.

Andreas

On Sun, Sep 30, 2012 at 10:01 PM, Brian Reinhold
<br...@lampreynetworks.com> wrote:
> Andreas,
>
> It is possible to move the monitor to another phase? After all, in the
> Rampart module I DO see the entire header, security AND addressing, (it has
> not been encrypted yet). It certainly caught me by surprise that the headers
> were not shown. To be honest with you until just recently I was not really
> looking at the responses ... the main interest is getting the data to the
> service using secure SAML. (My goal is eventually to learn how to support
> trusted third-party SAML tokens using Rampart which may require coding
> updates.)
>
> Brian
>
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: Sunday, September 30, 2012 2:19 PM
> To: java-dev@axis.apache.org
> Subject: Re: No headers in response
>
>> 1.       The SOAPMonitor has a bug. For some reason the response frame
>> (outgoing messages) does not show the headers (the request frame does).
>
> It's actually not a bug. To understand why, look at the following part of
> axis2.xml (I'm showing the content of the default axis2.xml file here;
> your's likely looks similar):
>
>     <phaseOrder type="OutFlow">
>         <!--      user can add his own phases to this area  -->
>         <phase name="soapmonitorPhase"/>
>         <phase name="OperationOutPhase"/>
>         <!--system predefined phase-->
>         <!--these phase will run irrespective of the service-->
>         <phase name="RMPhase"/>
>         <phase name="PolicyDetermination"/>
>         <phase name="MessageOut"/>
>         <phase name="Security"/>
>     </phaseOrder>
>
> The SOAP monitor uses a handler that is placed at the beginning of the
> handler chain (for outgoing messages). In particular it is executed before
> the Security phase. That is why you can't see the security headers.
>
> Andreas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Andreas,

It is possible to move the monitor to another phase? After all, in the
Rampart module I DO see the entire header, security AND addressing, (it has
not been encrypted yet). It certainly caught me by surprise that the headers
were not shown. To be honest with you until just recently I was not really
looking at the responses ... the main interest is getting the data to the
service using secure SAML. (My goal is eventually to learn how to support
trusted third-party SAML tokens using Rampart which may require coding
updates.)

Brian

-----Original Message-----
From: Andreas Veithen [mailto:andreas.veithen@gmail.com] 
Sent: Sunday, September 30, 2012 2:19 PM
To: java-dev@axis.apache.org
Subject: Re: No headers in response

> 1.       The SOAPMonitor has a bug. For some reason the response frame
> (outgoing messages) does not show the headers (the request frame does).

It's actually not a bug. To understand why, look at the following part of
axis2.xml (I'm showing the content of the default axis2.xml file here;
your's likely looks similar):

    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>

The SOAP monitor uses a handler that is placed at the beginning of the
handler chain (for outgoing messages). In particular it is executed before
the Security phase. That is why you can't see the security headers.

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5300 - Release Date: 09/30/12


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Re: No headers in response

Posted by Andreas Veithen <an...@gmail.com>.
> 1.       The SOAPMonitor has a bug. For some reason the response frame
> (outgoing messages) does not show the headers (the request frame does).

It's actually not a bug. To understand why, look at the following part
of axis2.xml (I'm showing the content of the default axis2.xml file
here; your's likely looks similar):

    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>

The SOAP monitor uses a handler that is placed at the beginning of the
handler chain (for outgoing messages). In particular it is executed
before the Security phase. That is why you can't see the security
headers.

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
So there are two problems:

1.       The SOAPMonitor has a bug. For some reason the response frame
(outgoing messages) does not show the headers (the request frame does).

2.       The SOAP message being generated by Rampart is not adding the
‘mustUnderstand’ attribute to the addressing headers (though it IS being
added to the security header)

 

‘2’ is causing the client to report an error

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 2:21 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Believe it or not it may be fine. It’s the SOAP monitor not showing the
headers on the response side. It shows them on the send side, but not the
response. Since I am on a local host I can’t use wireshark which would have
solved the issue. This I need to do because my client in one case is giving
an error about the header but in the other case it isn’t (I see the headers
returned). But the SOAP monitor shows no headers in either case on the
response. ARRG!

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse –fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can’t find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client’s response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don’t understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don’t understand the ‘scope’ parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I’ll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that’s in Axis2 which I can’t get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It’s
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do…and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité

 

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it’s a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5299 - Release Date: 09/29/12


RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Believe it or not it may be fine. It’s the SOAP monitor not showing the
headers on the response side. It shows them on the send side, but not the
response. Since I am on a local host I can’t use wireshark which would have
solved the issue. This I need to do because my client in one case is giving
an error about the header but in the other case it isn’t (I see the headers
returned). But the SOAP monitor shows no headers in either case on the
response. ARRG!

 

From: Brian Reinhold [mailto:brianreinhold@lampreynetworks.com] 
Sent: Saturday, September 29, 2012 10:26 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse –fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can’t find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client’s response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don’t understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don’t understand the ‘scope’ parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I’ll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that’s in Axis2 which I can’t get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It’s
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do…and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité

 

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it’s a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5298 - Release Date: 09/29/12


RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
I added those lines of code to the xml and it had no effect. I think the
only way I am going to be able to address this is to step through the axis
routines and see where the header (both addressing and security) created by
rampart is stripped. I am using Eclipse, and to do this requires the remote
debugging option. I could parse through source if I had a jar with source (I
could make one of those if I could get mvn eclipse:eclipse –fn to work).

In the meantime I do have a 1.5.1 based distribution that IS working; the
headers ARE being received. Can’t find the differences yet in the services
and axis2 xml configuration files.

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 8:13 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

if header suppresssion is specific to addressing then this is what is gating
you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam =
msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
{
                log.debug(
                        "The AddressingInHandler has been disabled. No
further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing
temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being
send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES =
"disableAddressingForOutMessages";
        Object o =
msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or
not.
            // Get default value from module.xml or axis2.xml files
            param =
msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
MODULE_NAME, handlerDesc);
            disableAddressing =
 
msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
 
JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled())
{
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing
headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">false</parameter>
        <parameter name="disableAddressingForOutMessages">false</parameter>
    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.





  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client’s response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don’t understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don’t understand the ‘scope’ parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I’ll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that’s in Axis2 which I can’t get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It’s
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do…and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité

 

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it’s a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12


RE: No headers in response

Posted by Martin Gainty <mg...@hotmail.com>.
if header suppresssion is specific to addressing then this is what is gating you (excerpted from axis2.xml)
    <module ref="addressing"/>    

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="disableAddressingForInMessages">true</parameter>
        <parameter name="disableAddressingForOutMessages">true</parameter>
    </moduleConfig>

AddressingInHandler.java::shouldInvoke
 //Determine if we want to ignore addressing headers. This parameter must
        //be retrieved from the message context because it's value can vary 
  //DISABLE_ADDRESSING_FOR_IN_MESSAGES="disableAddressingForInMessages";
        Parameter disableParam = msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);   
        String value = Utils.getParameterValue(disableParam);
        if (JavaUtils.isTrueExplicitly(value)) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                log.debug(
                        "The AddressingInHandler has been disabled. No further processing will take place.");
            }
            return false;         
        }

        // if there are no headers put a flag to disable addressing temporary
        SOAPHeader header = msgContext.getEnvelope().getHeader();
        return header != null;

//BUT if the addressing parameters ARE coming into the service and not being send out in the response this is what you're up against

AddressingOutHandler::shouldInvoke
   public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
        Parameter param = null;
        boolean disableAddressing = false;
        //DISABLE_ADDRESSING_FOR_OUT_MESSAGES = "disableAddressingForOutMessages";
        Object o = msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (o == null || !(o instanceof Boolean)) {
            //determine whether outbound addressing has been disabled or not.
            // Get default value from module.xml or axis2.xml files
            param = msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, MODULE_NAME, handlerDesc);
            disableAddressing =
                msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
                    JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
        } else {
            disableAddressing = (Boolean) o;
        }

        if (disableAddressing) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(msgContext.getLogIDString() +
                        " Addressing is disabled. Not adding WS-Addressing headers.");
            }
            return false;
        }

make sure both parameters are set to false
  <!--Configuring module , providing parameters for modules whether they refer or not-->

    <moduleConfig name="addressing">

        <parameter name="disableAddressingForInMessages">false</parameter>

        <parameter name="disableAddressingForOutMessages">false</parameter>

    </moduleConfig>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Sat, 29 Sep 2012 06:41:44 -0400

Oh, sorry! The entire header. So in the SOAPMonitor and the client’s response all one receives is <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">    <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> But I am glad to know that it is there. There are so many possible settings in the xmls that I don’t understand it could be something very innocent.Having or removing this text from the axis2.xml makes no difference on the behavior (the addressing module IS present):     <!--Configuring module , providing parameters for modules whether they refer or not-->    <moduleConfig name="addressing">        <parameter name="includeOptionalHeaders">true</parameter>                                <parameter name="required">true</parameter>    </moduleConfig> In the service xml I don’t understand the ‘scope’ parameter in the service declaration: service name="DeviceObservationConsumerSecure" scope="application" class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver" The policy is in the service xml. But according to the axis2 documentation nothing I do in the service.xml affects the addressing; this can only be controlled at the global level in the axis2.xml. Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400Martin, I was able to trace into the Rampart code during the building of the response and the response is built correctly.In the build() method of the org.apache.rampart.MessageBuilder  it looks as follows: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="true">                  <wsu:Timestamp wsu:Id="TS-9">                              <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>                            <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>                  </wsu:Timestamp>    </wsse:Security>    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>    <wsa:ReplyTo>      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>    </wsa:ReplyTo>    <wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>    <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>  </soapenv:Header>  <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> The correct headers for BOTH addressing and security are present. However, I have still been unable to get the Axis2 maven to work correctly and cannot step into the Axis2 routines which follow. So something happens in Axis2 that strips away that header. Any idea what might allow the header to be removed? Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response Yes..I always hardcoded those values in the descriptor...but the maven-mar-plugin should reconfigure axis2.xml to include  <module ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400Martin, I’ll take a look at the Rampart checks but I am also having a problem with no ws-addressing in the response and that’s in Axis2 which I can’t get loaded because of maven problems. I do see success in the older versions (1.5.1). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400Martin, This looks like client side testing. I have no problem on the client. It’s my service whose response has no headers. The client is much easier to deal with as one tends to use code and for that there is great help from Eclipse and javadoc. The service, on the other hand, one usually has to use xml to control all behaviors and that is very difficult (difficult in the sense one has no idea what, for example, the possible parameters, elements, attributes, etc. are and what they do…and no help from Eclipse like there is with code). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to reconstruct our mustUnderstand later on
        String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results = engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd, rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned  on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
                        inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq = (String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq)) {
            try {
                
                String cancelAction = TrustUtil.getWSTNamespace(rmd.getWstVersion()) + RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt = msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if (Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey = RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId = (String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd, tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element) rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode = rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode, (Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(), config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400Martin, I tried that as well and the response still came back with no headers. Somehow the STS service manages to get a header in the response (missing must understand in the addressing); but it’s a start.  Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Hi Brian
i'll take the last question.. from axis2.xml i assume you have included optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new java.io.File(System.getProperty("basedir",".") + "/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx =org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing module should now be true

        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);        
        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(), org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTest.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/</wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action</wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400 I am re-opening a question I saw no answer to asked in this forum quite a while  ago. In the STS service requesting a SMAL20 token the response is okay.But in the service that needs to have the SAML20 token, the response has no headers at all. This is in spite of the must understand setting in the client headers in both the addressing and security part. Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the <parameter name="includeOptionalHeaders">true</parameter> in the service.xml does not help (though that is what I used programmatically on the client side to generate the correct addressing headers).Is this a bug or what am I doing wrong in the configuration? Thanks, Brian ReinholdNo virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12 		 	   		  

RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Oh, sorry!

 

The entire header. So in the SOAPMonitor and the client’s response all one
receives is

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

But I am glad to know that it is there. There are so many possible settings
in the xmls that I don’t understand it could be something very innocent.

Having or removing this text from the axis2.xml makes no difference on the
behavior (the addressing module IS present):

 

    <!--Configuring module , providing parameters for modules whether they
refer or not-->

    <moduleConfig name="addressing">

        <parameter name="includeOptionalHeaders">true</parameter>

                                <parameter name="required">true</parameter>

    </moduleConfig>

 

In the service xml I don’t understand the ‘scope’ parameter in the service
declaration:

 

service name="DeviceObservationConsumerSecure" scope="application"
class="com.lnihealth.wan.receiver.binding.axis2.Axis2WanReceiver"

 

The policy is in the service xml.

 

But according to the axis2 documentation nothing I do in the service.xml
affects the addressing; this can only be controlled at the global level in
the axis2.xml.

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Saturday, September 29, 2012 6:22 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.





  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:To> </wsa:To>

    <wsa:ReplyTo>

      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous
<http://www.w3.org/2005/08/addressing/anonymous%3c/wsa:Address>
</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I’ll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that’s in Axis2 which I can’t get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It’s
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do…and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité

 

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it’s a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12


RE: No headers in response

Posted by Martin Gainty <mg...@hotmail.com>.
can you be specific on which specific header is being stripped

thanks,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.


From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 19:32:22 -0400

Martin, I was able to trace into the Rampart code during the building of the response and the response is built correctly.In the build() method of the org.apache.rampart.MessageBuilder  it looks as follows: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soapenv:mustUnderstand="true">                  <wsu:Timestamp wsu:Id="TS-9">                               <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>                            <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>                  </wsu:Timestamp>    </wsse:Security>    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>    <wsa:ReplyTo>      <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>    </wsa:ReplyTo>    <wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>    <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>  </soapenv:Header>  <soapenv:Body>    <pcd:CommunicatePCDDataResponse xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64||||20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL|||||IHE PCD ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&#xd;    </pcd:CommunicatePCDDataResponse>  </soapenv:Body></soapenv:Envelope> The correct headers for BOTH addressing and security are present. However, I have still been unable to get the Axis2 maven to work correctly and cannot step into the Axis2 routines which follow. So something happens in Axis2 that strips away that header. Any idea what might allow the header to be removed? Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response Yes..I always hardcoded those values in the descriptor...but the maven-mar-plugin should reconfigure axis2.xml to include  <module ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400Martin, I’ll take a look at the Rampart checks but I am also having a problem with no ws-addressing in the response and that’s in Axis2 which I can’t get loaded because of maven problems. I do see success in the older versions (1.5.1). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400Martin, This looks like client side testing. I have no problem on the client. It’s my service whose response has no headers. The client is much easier to deal with as one tends to use code and for that there is great help from Eclipse and javadoc. The service, on the other hand, one usually has to use xml to control all behaviors and that is very difficult (difficult in the sense one has no idea what, for example, the possible parameters, elements, attributes, etc. are and what they do…and no help from Eclipse like there is with code). Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to reconstruct our mustUnderstand later on
        String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results = engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd, rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned  on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx = opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
                        inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq = (String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq)) {
            try {
                
                String cancelAction = TrustUtil.getWSTNamespace(rmd.getWstVersion()) + RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt = msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if (Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey = RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId = (String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd, tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element) rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode = rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode, (Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(), config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400Martin, I tried that as well and the response still came back with no headers. Somehow the STS service manages to get a header in the response (missing must understand in the addressing); but it’s a start.  Brian From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response Hi Brian
i'll take the last question.. from axis2.xml i assume you have included optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
                     class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new java.io.File(System.getProperty("basedir",".") + "/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx =org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing module should now be true

        msgCtxt = cfgCtx.createMessageContext();
        msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);        
        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(), org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTest.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/</wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action</wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.relatesTo.org/service/</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400 I am re-opening a question I saw no answer to asked in this forum quite a while  ago. In the STS service requesting a SMAL20 token the response is okay.But in the service that needs to have the SAML20 token, the response has no headers at all. This is in spite of the must understand setting in the client headers in both the addressing and security part. Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the <parameter name="includeOptionalHeaders">true</parameter> in the service.xml does not help (though that is what I used programmatically on the client side to generate the correct addressing headers).Is this a bug or what am I doing wrong in the configuration? Thanks, Brian ReinholdNo virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12 		 	   		  

RE: No headers in response

Posted by Brian Reinhold <br...@lampreynetworks.com>.
Martin,

 

I was able to trace into the Rampart code during the building of the
response and the response is built correctly.

In the build() method of the org.apache.rampart.MessageBuilder  it looks as
follows:

 

<?xml version='1.0' encoding='utf-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

  <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"

 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd" soapenv:mustUnderstand="true">

                  <wsu:Timestamp wsu:Id="TS-9">          

                    <wsu:Created>2012-09-28T23:00:17.294Z</wsu:Created>


                    <wsu:Expires>2012-09-28T23:05:17.294Z</wsu:Expires>

                  </wsu:Timestamp>

    </wsse:Security>

    <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>

    <wsa:ReplyTo>

 
<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>

    </wsa:ReplyTo>

 
<wsa:MessageID>urn:uuid:700b9fba-531a-4e21-a815-1449a5477239</wsa:MessageID>

    <wsa:Action>urn:ihe:pcd:2010:CommunicatePCDDataResponse</wsa:Action>

    <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">urn:uuid:5deab
184-febf-42b0-9a14-b710318aea66</wsa:RelatesTo>

  </soapenv:Header>

  <soapenv:Body>

    <pcd:CommunicatePCDDataResponse
xmlns:pcd="urn:ihe:pcd:dec:2010">MSH|^~\&amp;|LNI^0b0e0e0f0d0e0a0d^EUI-64|||
|20120928184929.279-0500||ACK^R01^ACK|00320120928184924226|P|2.6|||NE|AL||||
|IHE PCD
ORU-R012006^HL7^2.16.840.1.113883.9.n.m^HL7&#xd;MSA|AA|00320120928184924226&
#xd;

    </pcd:CommunicatePCDDataResponse>

  </soapenv:Body>

</soapenv:Envelope>

 

The correct headers for BOTH addressing and security are present.

 

However, I have still been unable to get the Axis2 maven to work correctly
and cannot step into the Axis2 routines which follow. So something happens
in Axis2 that strips away that header. Any idea what might allow the header
to be removed?

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 5:28 PM
To: java-dev@axis.apache.org; users@maven.apache.org
Subject: RE: No headers in response

 

Yes..I always hardcoded those values in the descriptor...but the
maven-mar-plugin should reconfigure axis2.xml to include  <module
ref="addressing"/> 
and any associated module specific parameters

cross posting to maven-users

feel free to go ahead and post your question
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.





  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 14:40:14 -0400

Martin,

 

I’ll take a look at the Rampart checks but I am also having a problem with
no ws-addressing in the response and that’s in Axis2 which I can’t get
loaded because of maven problems. I do see success in the older versions
(1.5.1).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Friday, September 28, 2012 10:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

these are the (secure) headers that are supported by xmlsoap securitypolicy
http://schemas.xmlsoap.org/ws/2005/07/securitypolicy

if you dont see the secure header defined in this xsd then Rampart (or any
other securitypolicy implementor) does'nt implement it
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Fri, 28 Sep 2012 04:42:48 -0400

Martin,

 

This looks like client side testing. I have no problem on the client. It’s
my service whose response has no headers. The client is much easier to deal
with as one tends to use code and for that there is great help from Eclipse
and javadoc. The service, on the other hand, one usually has to use xml to
control all behaviors and that is very difficult (difficult in the sense one
has no idea what, for example, the possible parameters, elements,
attributes, etc. are and what they do…and no help from Eclipse like there is
with code).

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 10:59 PM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

try it like this
         MessageContext ctx = getMsgCtx12();

//none of these tests contain mustUnderstand attribute so we will need to
reconstruct our mustUnderstand later on
        String policyXml =
"test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
        Policy policy = loadPolicy(policyXml);

        ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);

        MessageBuilder builder = new MessageBuilder();
        builder.build(ctx);

        // Building the SOAP envelope from the OMElement
        buildSOAPEnvelope(ctx);

        RampartEngine engine = new RampartEngine();
        List<org.apache.ws.security.WSSecurityEngineResult> results =
engine.process(ctx);

MG>notice that inside org.apache.rampart.MessageBuilder we have
RampartMessageData build() method *which has access to the security Headers*

  public void build(MessageContext msgCtx) throws WSSPolicyException,
            RampartException, WSSecurityException, AxisFault {
        Axis2Util.useDOOM(true);
        RampartMessageData rmd = new RampartMessageData(msgCtx, true);
        
        
        RampartPolicyData rpd = rmd.getPolicyData();
        if(rpd == null || isSecurityValidationFault(msgCtx) || 
                !RampartUtil.isSecHeaderRequired(rpd,
rmd.isInitiator(),false)) {
            
            Document doc = rmd.getDocument();
            WSSecHeader secHeader = rmd.getSecHeader();
MG>start mods...         check here to make sure mustUnderstand is turned
on 
           if(secHeader!=null) && (secHeader.getMustUnderstand()==true)
           {
MG>normal
           }
           else
{
MG>remove the bad one ,reconstruct WSSecHeader and add to RampartMessageData
            if ( secHeader != null ) {
                secHeader.removeSecurityHeader(doc);
            }
           secHeader = new WSSecHeader("actor",true);
           rmd.setSecHeader(secHeader);    
      }
MG>end mods MG

            return;
        }
        
        //Copy the RECV_RESULTS if available
        if(!rmd.isInitiator()) {
            OperationContext opCtx = msgCtx.getOperationContext();
            MessageContext inMsgCtx;
            if(opCtx != null && 
                    (inMsgCtx =
opCtx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)) != null) {
                msgCtx.setProperty(WSHandlerConstants.RECV_RESULTS, 
 
inMsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS));
            }
        }
        
        
        String isCancelreq =
(String)msgCtx.getProperty(RampartMessageData.CANCEL_REQUEST);
        if(isCancelreq != null && Constants.VALUE_TRUE.equals(isCancelreq))
{
            try {
                
                String cancelAction =
TrustUtil.getWSTNamespace(rmd.getWstVersion()) +
RahasConstants.RST_ACTION_CANCEL_SCT;
                //Set action
                msgCtx.getOptions().setAction(cancelAction);
                
                //Change the wsa:Action header
                String wsaNs = Final.WSA_NAMESPACE;
                Object addressingVersionFromCurrentMsgCtxt =
msgCtx.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
                if
(Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)) {
                    wsaNs = Submission.WSA_NAMESPACE;
                }
                OMElement header = msgCtx.getEnvelope().getHeader();
                if(header != null) {
                    OMElement actionElem = header.getFirstChildWithName(new
QName(wsaNs, AddressingConstants.WSA_ACTION));
                    if(actionElem != null) {
                        actionElem.setText(cancelAction);
                    }
                }
                
                //set payload to a cancel request
                String ctxIdKey =
RampartUtil.getContextIdentifierKey(msgCtx);
                String tokenId =
(String)RampartUtil.getContextMap(msgCtx).get(ctxIdKey);
                
                if(tokenId != null && RampartUtil.isTokenValid(rmd,
tokenId)) {
                    OMElement bodyElem = msgCtx.getEnvelope().getBody();
                    OMElement child = bodyElem.getFirstElement();
                    SecurityContextToken sct = new SecurityContextToken(
                            (Element)
rmd.getTokenStorage().getToken(tokenId)
                                    .getToken());
                    OMElement newChild = TrustUtil.createCancelRequest(sct
                            .getIdentifier(), rmd.getWstVersion());
                    Element newDomChild = XMLUtils.toDOM(newChild);
                    Node importedNode =
rmd.getDocument().importNode((Element) newDomChild, true);
                    ((Element) bodyElem).replaceChild(importedNode,
(Element) child);
                } else {
                    throw new RampartException("tokenToBeCancelledInvalid");
                }
                
            } catch (Exception e) {
                e.printStackTrace();
                throw new RampartException("errorInTokenCancellation");
            }
        }
        
       if(rpd.isTransportBinding()) {
           log.debug("Building transport binding");
           TransportBindingBuilder building = new TransportBindingBuilder();
           building.build(rmd);
        } else if(rpd.isSymmetricBinding()) {
           log.debug("Building SymmetricBinding");
           SymmetricBindingBuilder builder = new SymmetricBindingBuilder();
           builder.build(rmd);
        } else {
            AsymmetricBindingBuilder builder = new
AsymmetricBindingBuilder();
            builder.build(rmd);
        }
       
       //TODO remove following check, we don't need this check here as we do
a check to see whether 
       // security header required 
       
       Document doc = rmd.getDocument();
       WSSecHeader secHeader = rmd.getSecHeader();
       
       if ( secHeader != null && secHeader.isEmpty(doc) ) {
           secHeader.removeSecurityHeader(doc);
       }
        got

       /*
        * Checking whether MTOMSerializable is there. If so set
optimizeElement.
        * */
        if(rpd.isMTOMSerialize()){
            msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
            OptimizePartsConfig config= rpd.getOptimizePartsConfig();
            if(config != null){
                MessageOptimizer.optimize(msgCtx.getEnvelope(),
config.getExpressions(), config.getNamespaces());
            }
        }
    }
//end RampartMessageData build method

// download wss4j and and make mod to low access to mustunderstand
// http://ws.apache.org/wss4j/source-repository.html
public class WSSecHeader {
    private String actor = null;

    private boolean mustunderstand = true;
//accessor that werner forgot
    public boolean getMustUnderstand() { return this.mustunderstand; }
...
}
compile and package with maven pom.xml

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité

 

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: RE: No headers in response
Date: Thu, 27 Sep 2012 19:11:27 -0400

Martin,

 

I tried that as well and the response still came back with no headers.
Somehow the STS service manages to get a header in the response (missing
must understand in the addressing); but it’s a start. 

 

Brian

 

From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, September 27, 2012 9:30 AM
To: java-dev@axis.apache.org
Subject: RE: No headers in response

 

Hi Brian
i'll take the last question.. from axis2.xml i assume you have included
optional Headers
axis2.xml contains:
 <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>

run this test where
axis2-IncludeOptionalHeadersTrue.xml contains

<axisconfig name="AxisJava2.0">
    <!-- Comment this to disable Addressing -->
    <module ref="addressing"/>

    <!--Configuring module , providing parameters for modules whether they
refer or not-->
    <moduleConfig name="addressing">
        <parameter name="includeOptionalHeaders">true</parameter>
    </moduleConfig>
    
    <!-- ================================================= -->
    <!-- Phases  -->
    <!-- ================================================= -->
    <phaseOrder type="InFlow">
        <!--  System predefined phases       -->
        <phase name="Transport">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
                <order phase="Transport"/>
            </handler>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
                <order phase="Transport"/>
            </handler>
        </phase>
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--  System predefined phases       -->
        <!--   After Postdispatch phase module author or service author can
add any phase he want      -->
        <phase name="OperationInPhase">
            <handler name="MustUnderstandChecker"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
                <order phase="OperationInPhase"/>
            </handler>
        </phase>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutPhase"/>
        <!--system predefined phase-->
        <!--these phase will run irrespective of the service-->
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
    <phaseOrder type="InFaultFlow">
        <phase name="Addressing">
            <handler name="AddressingBasedDispatcher"
 
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
                <order phase="Addressing"/>
            </handler>
        </phase>
        <phase name="Security"/>
        <phase name="PreDispatch"/>
        <phase name="Dispatch"
class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
 
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
 
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
            <handler name="HTTPLocationBasedDispatcher"
 
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
            <handler name="GenericProviderDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
            <handler name="MustUnderstandValidationDispatcher"
 
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher
"/>
        </phase>
        <phase name="RMPhase"/>
        <!--      user can add his own phases to this area  -->
        <phase name="OperationInFaultPhase"/>
        <phase name="soapmonitorPhase"/>
    </phaseOrder>
    <phaseOrder type="OutFaultFlow">
        <!--      user can add his own phases to this area  -->
        <phase name="soapmonitorPhase"/>
        <phase name="OperationOutFaultPhase"/>
        <phase name="RMPhase"/>
        <phase name="PolicyDetermination"/>
        <phase name="MessageOut"/>
        <phase name="Security"/>
    </phaseOrder>
</axisconfig>

//now run the TestCase
org.apache.axis2.handlers.addressing.AddressingOutHandlerTest.java:
        java.io.File configFile = new
java.io.File(System.getProperty("basedir",".") +
"/test-resources/axis2-IncludeOptionalHeadersTrue.xml");
        org.apache.axis2.context.ConfigurationContext cfgCtx
=org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCon
textFromFileSystem("target/test-classes",configFile.getAbsolutePath());
//<parameter name="includeOptionalHeaders">true</parameter> in addressing
module should now be true

        msgCtxt = cfgCtx.createMessageContext();
 
msgCtxt.setEnvelope(OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope(
));
        msgCtxt.setTo(new EndpointReference("http://www.to.org/service/"));
        msgCtxt.setFrom(new
EndpointReference("http://www.from.org/service/"));
        msgCtxt.setReplyTo(new
EndpointReference("http://www.replyTo.org/service/"));
        msgCtxt.setFaultTo(new
EndpointReference("http://www.faultTo.org/service/"));
        msgCtxt.setWSAAction("http://www.actions.org/action");
        msgCtxt.setMessageID("123456-7890");
        msgCtxt.addRelatesTo(new
RelatesTo("http://www.relatesTo.org/service/"));
        msgCtxt.setProperty(WS_ADDRESSING_VERSION, Final.WSA_NAMESPACE);

        outHandler.invoke(msgCtxt);
        org.custommonkey.xmlunit.XMLUnit.setIgnoreWhitespace(true);
        assertXMLEqual(msgCtxt.getEnvelope().toString(),
org.apache.axis2.handlers.util.TestUtil.getOMBuilder("withOptionalHeadersTes
t.xml").getDocumentElement().toString());   

//msgCtxt.getEnvelope().toString() should be IDENTICAL to contents of
withOptionalHeadersTest.xml shown here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:To>http://www.to.org/service/
<http://www.to.org/service/%3c/wsa:To> </wsa:To>
        <wsa:From><wsa:Address>http://www.from.org/service/
<http://www.from.org/service/%3c/wsa:Address%3e%3c/wsa:From>
</wsa:Address></wsa:From>
        <wsa:ReplyTo><wsa:Address>http://www.replyTo.org/service/
<http://www.replyTo.org/service/%3c/wsa:Address%3e%3c/wsa:ReplyTo>
</wsa:Address></wsa:ReplyTo>
        <wsa:FaultTo><wsa:Address>http://www.faultTo.org/service/
<http://www.faultTo.org/service/%3c/wsa:Address%3e%3c/wsa:FaultTo>
</wsa:Address></wsa:FaultTo>
        <wsa:Action>http://www.actions.org/action
<http://www.actions.org/action%3c/wsa:Action> </wsa:Action>
        <wsa:MessageID>123456-7890</wsa:MessageID>
        <wsa:RelatesTo
RelationshipType="http://www.w3.org/2005/08/addressing/reply">http://www.rel
atesTo.org/service/ <http://www.relatesTo.org/service/%3c/wsa:RelatesTo>
</wsa:RelatesTo>
    </soapenv:Header>
    <soapenv:Body />
</soapenv:Envelope>

is this not the case?
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
dient lediglich dem Austausch von Informationen und entfaltet keine
rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.

 

  _____  

From: brianreinhold@lampreynetworks.com
To: java-dev@axis.apache.org
Subject: No headers in response
Date: Thu, 27 Sep 2012 07:35:07 -0400

 I am re-opening a question I saw no answer to asked in this forum quite a
while  ago. 

In the STS service requesting a SMAL20 token the response is okay.

But in the service that needs to have the SAML20 token, the response has no
headers at all. This is in spite of the must understand setting in the
client headers in both the addressing and security part.

 

Everything is 1.6.2; rampart, axis2, and axiom is 1.2.14.  Adding the
<parameter name="includeOptionalHeaders">true</parameter> in the service.xml
does not help (though that is what I used programmatically on the client
side to generate the correct addressing headers).

Is this a bug or what am I doing wrong in the configuration?

 

Thanks,

 

Brian Reinhold

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5294 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5295 - Release Date: 09/27/12

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2221 / Virus Database: 2441/5296 - Release Date: 09/28/12