5

Could you please explain what exactly the method getHeaders from SOAPHandler interface is supposed to do?

http://docs.oracle.com/javaee/5/api/javax/xml/ws/handler/soap/SOAPHandler.html#getHeaders%28%29

I'm not sure if it creates additional headers or if it should just tell the runtime which headers the message should have.

I've been sweeping the internet looking for detailed information but I couldn't find any. I think is is so basic and obvious that no documentation is needed LOL :-)

Thanks

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
danflu
  • 325
  • 8
  • 25

2 Answers2

6

The description you're looking for can be found in the JAX-WS 2.2 spec in the section titled, "10.2.1 SOAP mustUnderstand Processing". Inbound messages require an additional processing step that occurs before the start of normal handler processing. Basically, the set of QName instances returned from getHeaders allows the handler to contribute to the full set of SOAP headers that a node understands (the other contributors to the full set are documented in the spec). If an inbound SOAP header contains the mustUnderstand attribute with a value of 1 or true, then an exception will be generated if that header can't be marked as understood.

kschneid
  • 5,626
  • 23
  • 31
-2

EDIT: Apparently I was wrong and after reading further I must agree, therefore please ignore this.

A SOAP message is a HTTP request. HTTP requests can have number of different headers as a part of the message (e.g. in SOAP 1.1 there was a header called SOAPAction, which could contain the name of the service and operation). The getHeaders function returns the list of all the headers QNames that came with the request, so in case of previous example, you would get a list that would contain element of value "SOAPAction".

Xargos
  • 633
  • 8
  • 19
  • But since the request came from an outside agent and the getHeaders method is implemented by me, how can I know previously the complete list of QNames that came with the request ? What why I need to implement it ? I don't understand the reason why it exist in the first place. – danflu Aug 06 '13 at 12:46
  • Another question: is there any semantic difference between the implementation of the getHeaders method in the client soaphandler and the getHeaders implementation in the server soaphandler supposing a request / response message exchange pattern ( where the client is the source ) ? – danflu Aug 06 '13 at 13:10
  • 1
    Down-voted because this has nothing to do with HTTP nor HTTP headers, a SOAP message is not required to use HTTP as a transport, and the description of what `getHeaders` returns is wrong. – kschneid Aug 06 '13 at 15:17