This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes unable to understand how to use actor or role SOAP Header attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "unable to understand how to use actor or role SOAP Header attribute" Watch "unable to understand how to use actor or role SOAP Header attribute" New topic
Author

unable to understand how to use actor or role SOAP Header attribute

khan gul
Ranch Hand

Joined: Jan 27, 2011
Posts: 30
Hi,
SOAP actor or role definition is: Actor or Role is a global attribute can be used to indicate the recipient of a header element. The value of the SOAP actor attribute is a URI. The special URI "http://schemas.xmlsoap.org/soap/actor/next" indicates that the header element is intended for the very first SOAP application that processes the message. This is similar to the hop-by-hop scope model represented by the Connection header field in HTTP.

With this definition, does it mean that if I set a URI for the Actor, the next hop will be the application that have the same URI?, for example: if I set the Actor to "http://www.abc.com/", then only the application at this address will be the next hop for the SOAP Message? if this is not correct, then how the SOAP message will determine the next hop?

regards,
khan
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
No, the next "hop" is not specified by the actor or role attribute.
The actor or role attribute specifies which node in the chain of nodes leading up to the ultimate receiver that should, or must, process the header block.
If there is no node in the chain with the specified actor or role, then the header block will never be processed.
Which node is the next in the chain is configured using other means.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
khan gul
Ranch Hand

Joined: Jan 27, 2011
Posts: 30
Thanks for the reply,
My next question on the same topic is how you specify or define the chain of nodes? How the soap message knows which is the next in hop for it?
regards,
khan
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
The SOAP message does not know, but the nodes has to know.
It can be done in different ways, for instance in a configuration file etc etc. This depends on the implementation of the node.
Best wishes!
khan gul
Ranch Hand

Joined: Jan 27, 2011
Posts: 30
Thanks Ivan,
I tried my best but could find a single example online or in a book that explains how to setup nodes for SOAP. Do you know any example ? or any book or any online material that can explain this?
The other question I have in my mind if an Intermediatary node failed to understand a mustUnderstand header block how can it send back Fault to the previous node in the chain?

Thanks for all your help.

regards,
khan
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
khan gul wrote:I tried my best but could find a single example online or in a book that explains how to setup nodes for SOAP. Do you know any example ? or any book or any online material that can explain this?

No, I haven't seen any examples either, but it shouldn't be hard to create one yourself.
Create a web service that accepts a request, extracts the request parameters and, using the extracted request parameters, sends a request to another web service. When the response arrives, the result becomes the result of the received request. Headers can be inspected and processed using a handler.

The other question I have in my mind if an Intermediatary node failed to understand a mustUnderstand header block how can it send back Fault to the previous node in the chain?

Either generate a SOAP fault message or throw an exceptions (assuming you are using JAX-WS).
Note that, as described above, the intermediary may forward the request synchronously.
Best wishes!
khan gul
Ranch Hand

Joined: Jan 27, 2011
Posts: 30
Thanks for the reply Ivan,
I understand what you said and its pretty straight forward to send a SOAP message to an intermediate node and then that node further send it to another node say ultimate receiver to get the result and then send back the final result back. I have following questions on such style:

1. Based on this there is no way the sender can target a header specifically for the ultimate receiver. As for the sender the ultimate receiver is the indeed the intermediate node.
2. Is it correct that even a header is set to Must Understand attribute to true and is targeted with actor value for ultimate receiver, still the intermediate node that failed to understand or is not the ultimate node, can process or remove the whole header and add completed different header and a completely new body before sending it to next node or ultimate receiver? In other words by simply setting the header with a actor value targeting for ultimate node, will not guarantee that that header cannot be read or tampered or removed by any intermediate node?

regards,
khan
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
1. A sender can indeed target a header specifically for the ultimate receiver by using the special role name http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver.
There also are a couple of other special role names, such as "next" and "none".
Reference: http://www.w3.org/TR/soap12-part1/#soaproles
2. Yes, there is nothing except the Code of the Good SOAP Node that stops a node from removing any header.
The processing of headers are recommendations set up by various specifications. Of course it is possible to write code that do not adhere to these recommendations.
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to understand how to use actor or role SOAP Header attribute
 
Similar Threads
Best book for SCDJWS
How could this handler get a role ?
How to identify particular handler with an actor value?
Handler soap-role and soap-header
routing using actor attribute