• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Order of Handlers on Server Side

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have configured my handlers.xml like this :


<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
<handler-chain>
<handler>
<handler-class>fromjava.server.MyHandler1</handler-class>
</handler>
<handler>
<handler-class>fromjava.server.MyHandler2</handler-class>
</handler>
<handler>
<handler-class>fromjava.server.MyHandler3</handler-class>
</handler>
</handler-chain>
</handler-chains>



I sent a request from Client side and in each of the handler's handleMessage(SOAPMessageContext smc) , I am printing the output to a file like :


//MyHandler1.java
try {
FileWriter fw = new FileWriter(f,true);
if((Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY) == true)
fw.write("MyHandler1 Outgoing *********");
else
fw.write("MyHandler1 Incoming *********");
fw.close();
} catch (IOException e) {
e.printStackTrace();
}


//MyHandler2.java
try {
FileWriter fw = new FileWriter(f,true);
if((Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY) == true)
fw.write("MyHandler2 Outgoing *********");
else
fw.write("MyHandler2 Incoming *********");
fw.close();
} catch (IOException e) {
e.printStackTrace();
}


//MyHandler3.java
try {
FileWriter fw = new FileWriter(f,true);
if((Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY) == true)
fw.write("MyHandler3 Outgoing *********");
else
fw.write("MyHandler3 Incoming *********");
fw.close();
} catch (IOException e) {
e.printStackTrace();
}



I sent a request from Client side and the file produces this output.

MyHandler3 Incoming *********
MyHandler2 Incoming *********
MyHandler1 Incoming *********
MyHandler1 Outgoing *********
MyHandler2 Outgoing *********
MyHandler3 Outgoing *********

Is this order right , I thought MyHandler1 will get the input request first !
 
Sim Kim
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All of the handlers are protocol handlers (implement implements SOAPHandler<SOAPMessageContext>
 
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I think about your question.

jaxws-2_0 spec says:

"For outbound messages handler processing starts with the first handler in the chain and proceeds in the same order as the handler chain. For inbound messages the order of processing is reversed: processing starts with
the last handler in the chain and proceeds in the reverse order of the handler chain."

Which means outbound messages are the ones that comes back from the webservice to the client, and inbound messages are the ones which are given to the webservice; which explains why MyHandler3 Incoming ********* as the first print in your application.

Let me know what you think.
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sim Kim,

Can you please please share us all of your findings about SOAP, UDDI, WSDL, JAX-WS, in the form of hints and tricks.

Since i am a beginner in web services, thats why i m just trying to understand the basic concepts. And i know the SCDJWS will be very tough, so my preparation might not help a lot. If you share your knowledge with us, that it will be very advantegous for all of us.

And i request all of you guys to post your notes/hints/tricks here. I will also do so.

Thank you very much,
 
Sim Kim
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anila,

I guess your are right . But when I read the RMH book it said otherwise (or may be that is what I understood)
reply
    Bookmark Topic Watch Topic
  • New Topic