aspose file tools*
The moose likes Web Services and the fly likes Passing an Object from Application to Handler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Passing an Object from Application to Handler" Watch "Passing an Object from Application to Handler" New topic
Author

Passing an Object from Application to Handler

Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Hi,

I've been googling and trying many possible approaches to do to pass an object from an application (skeleton) to the handler using Axis2 with no luck I don't know if what I'm doing is actually correct. For brevity, below is only the logic of what I've done.

Skeleton (aar):


Handler (mar): --> OutFlow



If the above logic is incorrect, can anyone please tell me how I should go about it?

Many thanks in advance.
[ May 08, 2008: Message edited by: Freddy Wong ]

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Where are you setting the property? Remember a new service instance is created for every incoming request and each service instance would have its own message context. So your would have to set the property in the web service method before the method returns.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

I'm setting it in the web service method. It seems that I need to set it in the ServiceContext. This code below is now working.

Web Service Method:


Handler:


According to JavaDoc for ServiceContext
"Well this is never clearly defined, what it does or the life-cycle. So do NOT use this as it might not live up to your expectation.". I'm a bit scared to use it even though it's working as what I'm expecting.

Do you think what I'm doing is correct? Thanks.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Freddy Wong:
Do you think what I'm doing is correct?


If this article is anything to go by I would look into the OperationContext.

It seems that before you may have been setting the property on the MessageContext for the incoming message - not the outgoing one.

MessageContext has a getOperationContext() method. OperationContext can return a Hashmap of MessageContexts with getMessageContexts() or even retrieve a specific message context if you know the label.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Sorry for the late reply. Aha.. that's probably what I need. I'll take a look into that. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing an Object from Application to Handler