Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handlers declaration

 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
im preparing to take SCDJWS exam .i have been studying in RMH book in chapter 14 im losted. Is the Message Handlers declared in web.xml or in webservices.xml?
please Help
 
Amit K Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hani,

Handler declaration goes in webservices.xml. Also, you can have a chain of handlers declared in your Web service DD file. If you like to have a Handler class [it should extend jax-rpc handler class] defined in your webservice which you may be using for processing SOAP message header information.
The mention of that handler class goes in webservices.xml. For Axis style webservice the same is placed in server-deploy.wsdd file. Now, how this is specified is something which is specific to target App Server.

Here I will provide a few samples:
1. Websphere:
<handler id="Handler_1066493401322">
<handler-name>serverHandler</handler-name>
<handler-class>websphere.handler.ServerHandler</handler-class>
<soap-header>
<namespaceURI>http://x.y.z</namespaceURI>
<localpart>xfh</localpart>
</soap-header>
<soap-header>
<namespaceURI>http://x.y.z</namespaceURI>
<localpart>lang</localpart>
</soap-header>
</handler>

2. Weblogic
<handler-chains>
<handler-chain name="myChain">
<handler class-name="weblogic.handler.ServerHandler" />
</handler-chain>
</handler-chains>

3. Oracle AS
<handler>
<handler-name>serverHandler</handler-name>
<handler-class>oc4j.handler.ServerHandler</handler-class>
<soap-header xmlns:wsa1="http://x.y.z">test</soap-header>
</handler>

Hope this help.

Thanks,
Amit Srivastava..
 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Amit,
i want to thank you for this quick response about my Question.
but lets make 100% clear answer. I understand from you that if i has handelrXX so i will make it declared in webservices.xml but what about the other case that i delcare it in web.xml ?
thanks a lot
 
Amit K Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to specify handler information in web.xml. Your webservice will learn from webservices.xml only [not from any other place] that a Server Handler has been configured. It will use that server handler class (or chain of handlers) to process the SOAP header information.

-Amit
 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Amit..it is now clear to me
 
ruijin yang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Server-side handler has to be declared using <port-component> element in webservices.xml , client-side handler has to be declared using <service-ref> element in web.xml or ejb-jar.xml.
 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear ruijin yang ,

Would you please explain that in more details and is that appear in web services specification or in Vendor specification like Websphere ?
 
ruijin yang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by hani Ibrahim:
Dear ruijin yang ,

Would you please explain that in more details and is that appear in web services specification or in Vendor specification like Websphere ?


Please read this chapter from XYZWS:
http://www.xyzws.com/scdjws.do?cat=scdjws&smenu=SGS34&article=7

<service-ref> in web.xml:
<service-ref>
<description>WSDL Service AttachmentIBMService</description>
<service-ref-name>service/AttachmentIBMService</service-ref-name>
<service-interface>ibm.attachment.AttachmentIBMService</service-interface>
<wsdl-file>WEB-INF/wsdl/AttachmentIBM.wsdl</wsdl-file>
<jaxrpc-mapping-file>WEB-INF/AttachmentIBM_mapping.xml</jaxrpc-mapping-file>
<service-qname xmlns fx="urn:attachment.ibm">pfx:AttachmentIBMService</service-qname>
<port-component-ref>
<service-endpoint-interface>ibm.attachment.AttachmentIBM</service-endpoint-interface>
</port-component-ref>
<handler>
<handler-name>ibm.attachment.handler.AttachmentIBMClientHandler</handler-name>
<handler-class>ibm.attachment.handler.AttachmentIBMClientHandler</handler-class>
</handler>
</service-ref>

<port-component> in webservices.xml:
<port-component>
<port-component-name>AttachmentIBM</port-component-name>
<wsdl-port xmlns fx="urn:attachment.ibm">
pfx:AttachmentIBM
</wsdl-port>
<service-endpoint-interface>
ibm.attachment.AttachmentIBM
</service-endpoint-interface>
<service-impl-bean>
<servlet-link>
ibm_attachment_AttachmentIBMBindingImpl
</servlet-link>
</service-impl-bean>
<handler>
<handler-name>ibm.attachment.handler.AttachmentIBMHandler</handler-name>
<handler-class>ibm.attachment.handler.AttachmentIBMHandler</handler-class>
</handler>
</port-component>
[ May 24, 2007: Message edited by: ruijin yang ]
 
Amit K Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ruijin,

Client handler is something which Webservice client should take care of [Client handler may be enriching soap requests emanating from WS Client with the header information which is supposed to be proccessed by the Webservice's Server handler].
It makes sense for client application's web.xml to capture these information you have mentioned.

Could you please share the idea behind this as i am not so sure why webservice should declare this?

Thanks,
Amit Srivastava..
 
ruijin yang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit K Srivastava:
Hi Ruijin,

Client handler is something which Webservice client should take care of [Client handler may be enriching soap requests emanating from WS Client with the header information which is supposed to be proccessed by the Webservice's Server handler].
It makes sense for client application's web.xml to capture these information you have mentioned.

Could you please share the idea behind this as i am not so sure why webservice should declare this?

Thanks,
Amit Srivastava..


Hi Amit,

Sorry, I have not idea about your question. I am learning web services and preparing for this exam. Hope someone can answer your question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic