You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ROSSILLE Samuel <sa...@cgi.com> on 2007/11/02 10:37:15 UTC

RE: Axis2: howto handle custom mustUnderstand Headers

Hi

No, you must not change the MustUnderstandChecker.

You must add a handler that will process your custom header. You have two things to do:

1/ Write the handler class

The simplest way to do so is to write a class that extends the AbstratHandler provider by Axis (look up in the API docs for fully qualified name). Override the invoke method. In it's body you will proceed the header the way you have to.
Return InvocationResponse.CONTINUE if the header is OK, InvocationResponse.ABORT in other cases.

2/ Declare your handler class in axis configuration.

Edit the conf/axis2.xml file, and declare your handler in the inflow declaration (tag <phaseOrder type="InFlow">), where the comments tells you to do it , like thos for example:

after the comment like this:

<!--   After Postdispatch phase module author or service author can add any phase he want      -->
<!-- Samuel Rossille -->
	<phase name="myCustomPhase">
		<handler name="myCustomHandler" 				class="org.example.MyCustomHandler"/>
      </phase>


Tell me if you need more help.

Regards,

Samuel Rossille
-----Message d'origine-----
De : robert.celar@gmail.com [mailto:robert.celar@gmail.com] 
Envoyé : jeudi 1 novembre 2007 16:57
À : ROSSILLE Samuel
Objet : RE: Axis2: howto handle custom mustUnderstand Headers

Hi Samuel,

I saw your response in the newsgroup below. I still don't quite understand how to configure it. Did you modify the MustUnderstandChecker or did you extend the class and put the code in below? If the latter, did you then configure that class in the axis2.xml handlers? Is there a document that talks about this?

Thanks in advance for all your help,

Thanks,
Rob

ROSSILLE Samuel wrote:
> 
> Hi
> 
> messageContext.getEnvelope().getHeader().examineAllHeaderBlocks()
> gives you an Iterator over all the SOAPHeaderBlock of the message
> 
> hb.getMustUnderstand()
> tells you if a the SOAPHeaderBlock hb must be understood.
> 
> hb.setProcessed()
> tells Axis that your program understands a the SOAPHeaderBlock hb and has
> correctly completed it's processing. 
> 
> Regards
> Samuel Rossille
> 
> -----Message d'origine-----
> De : Andreas Schultz [mailto:andreas.schultz@gmail.com] 
> Envoyé : mardi 16 octobre 2007 15:54
> À : axis-user@ws.apache.org
> Objet : Axis2: howto handle custom mustUnderstand Headers
> 
> Hi all,
> 
> I need to handle custom header fields that have the mustUnderstand
> attribute set to true(1).
> Currently such an invocation triggers a fault:
> org.apache.axis2.AxisFault: Must Understand check failed for header : MyID
> 
> Searching the maillinglist has turned up a references to a
> MustUnderstandChecker, but i don't understand how i tell it what
> header elements are supported.
> 
> Is there a magic trick to tell axis which headers my service likes?
> 
> Regards
> Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 
Quoted from: 
http://www.nabble.com/Axis2%3A-howto-handle-custom-mustUnderstand-Headers-tf4634363.html#a13235540

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


RE: Axis2: howto handle custom mustUnderstand Headers

Posted by ROSSILLE Samuel <sa...@cgi.com>.
Erratum:

Return InvocationResponse.CONTINUE if the header is OK, 

return InvocationResponse.ABORT if you want Axis to ignore the request.

Throw an Exception if you want the client to receive a SOAP Fault


-----Message d'origine-----
De : ROSSILLE Samuel [mailto:samuel.rossille@cgi.com] 
Envoyé : vendredi 2 novembre 2007 10:37
À : axis-user@ws.apache.org
Cc : robert.celar@gmail.com
Objet : RE: Axis2: howto handle custom mustUnderstand Headers

Hi

No, you must not change the MustUnderstandChecker.

You must add a handler that will process your custom header. You have two things to do:

1/ Write the handler class

The simplest way to do so is to write a class that extends the AbstratHandler provider by Axis (look up in the API docs for fully qualified name). Override the invoke method. In it's body you will proceed the header the way you have to.
Return InvocationResponse.CONTINUE if the header is OK, InvocationResponse.ABORT in other cases.

2/ Declare your handler class in axis configuration.

Edit the conf/axis2.xml file, and declare your handler in the inflow declaration (tag <phaseOrder type="InFlow">), where the comments tells you to do it , like thos for example:

after the comment like this:

<!--   After Postdispatch phase module author or service author can add any phase he want      -->
<!-- Samuel Rossille -->
	<phase name="myCustomPhase">
		<handler name="myCustomHandler" 				class="org.example.MyCustomHandler"/>
      </phase>


Tell me if you need more help.

Regards,

Samuel Rossille
-----Message d'origine-----
De : robert.celar@gmail.com [mailto:robert.celar@gmail.com] 
Envoyé : jeudi 1 novembre 2007 16:57
À : ROSSILLE Samuel
Objet : RE: Axis2: howto handle custom mustUnderstand Headers

Hi Samuel,

I saw your response in the newsgroup below. I still don't quite understand how to configure it. Did you modify the MustUnderstandChecker or did you extend the class and put the code in below? If the latter, did you then configure that class in the axis2.xml handlers? Is there a document that talks about this?

Thanks in advance for all your help,

Thanks,
Rob

ROSSILLE Samuel wrote:
> 
> Hi
> 
> messageContext.getEnvelope().getHeader().examineAllHeaderBlocks()
> gives you an Iterator over all the SOAPHeaderBlock of the message
> 
> hb.getMustUnderstand()
> tells you if a the SOAPHeaderBlock hb must be understood.
> 
> hb.setProcessed()
> tells Axis that your program understands a the SOAPHeaderBlock hb and has
> correctly completed it's processing. 
> 
> Regards
> Samuel Rossille
> 
> -----Message d'origine-----
> De : Andreas Schultz [mailto:andreas.schultz@gmail.com] 
> Envoyé : mardi 16 octobre 2007 15:54
> À : axis-user@ws.apache.org
> Objet : Axis2: howto handle custom mustUnderstand Headers
> 
> Hi all,
> 
> I need to handle custom header fields that have the mustUnderstand
> attribute set to true(1).
> Currently such an invocation triggers a fault:
> org.apache.axis2.AxisFault: Must Understand check failed for header : MyID
> 
> Searching the maillinglist has turned up a references to a
> MustUnderstandChecker, but i don't understand how i tell it what
> header elements are supported.
> 
> Is there a magic trick to tell axis which headers my service likes?
> 
> Regards
> Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 
Quoted from: 
http://www.nabble.com/Axis2%3A-howto-handle-custom-mustUnderstand-Headers-tf4634363.html#a13235540

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

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