1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.axis.message.addressing.handler;
18
19 import org.apache.axis.AxisFault;
20 import org.apache.axis.Handler;
21 import org.apache.axis.MessageContext;
22 import org.apache.ws.addressing.handler.ClientSideAddressingHandler;
23 import org.w3c.dom.Document;
24 import org.w3c.dom.Element;
25
26 import javax.xml.namespace.QName;
27 import java.util.Hashtable;
28 import java.util.List;
29
30 /***
31 * Axis-specific client-side WS-Addressing handler.
32 *
33 * @author Davanum Srinivas (dims@yahoo.com)
34 * @author Ian P. Springer
35 */
36 public class AxisClientSideAddressingHandler extends ClientSideAddressingHandler implements Handler
37 {
38
39 private GenericAxisHandler axisHelperHandler = new GenericAxisHandler( this );
40
41 /***
42 * @see org.apache.axis.Handler#init()
43 */
44 public void init()
45 {
46 axisHelperHandler.init();
47 }
48
49 /***
50 * @see org.apache.axis.Handler#cleanup()
51 */
52 public void cleanup()
53 {
54 axisHelperHandler.cleanup();
55 }
56
57 /***
58 * @see org.apache.axis.Handler#canHandleBlock(javax.xml.namespace.QName)
59 */
60 public boolean canHandleBlock( QName qname )
61 {
62 return ( axisHelperHandler.canHandleBlock( qname ) );
63 }
64
65 /***
66 * @see org.apache.axis.Handler#setOption(java.lang.String, java.lang.Object)
67 */
68 public void setOption( String name,
69 Object value )
70 {
71 axisHelperHandler.setOption( name, value );
72 }
73
74 /***
75 * Set a default value for the given option: if the option is not already set, then set it. if the option is already set,
76 * then do not set it.
77 * <p/>
78 * If this is called multiple times, the first with a non-null value if 'value' will set the default, remaining calls will
79 * be ignored.
80 * <p/>
81 * Returns true if value set (by this call), otherwise false;
82 */
83 public boolean setOptionDefault( String name,
84 Object value )
85 {
86 return axisHelperHandler.setOptionDefault( name, value );
87 }
88
89 /***
90 * @see org.apache.axis.Handler#getOption(java.lang.String)
91 */
92 public Object getOption( String name )
93 {
94 return axisHelperHandler.getOption( name );
95 }
96
97 /***
98 * @see org.apache.axis.Handler#getOptions()
99 */
100 public Hashtable getOptions()
101 {
102 return axisHelperHandler.getOptions();
103 }
104
105 /***
106 * @see org.apache.axis.Handler#setOptions(java.util.Hashtable)
107 */
108 public void setOptions( Hashtable opts )
109 {
110 axisHelperHandler.setOptions( opts );
111 }
112
113 /***
114 * @see org.apache.axis.Handler#setName(java.lang.String)
115 */
116 public void setName( String name )
117 {
118 axisHelperHandler.setName( name );
119 }
120
121 /***
122 * @see org.apache.axis.Handler#getName()
123 */
124 public String getName()
125 {
126 return axisHelperHandler.getName();
127 }
128
129 /***
130 * @see org.apache.axis.Handler#getDeploymentData(org.w3c.dom.Document)
131 */
132 public Element getDeploymentData( Document doc )
133 {
134 return axisHelperHandler.getDeploymentData( doc );
135 }
136
137 /***
138 * @see org.apache.axis.Handler#getUnderstoodHeaders()
139 */
140 public List getUnderstoodHeaders()
141 {
142 return axisHelperHandler.getUnderstoodHeaders();
143 }
144
145 /***
146 * @see org.apache.axis.Handler#generateWSDL(org.apache.axis.MessageContext)
147 */
148 public void generateWSDL( MessageContext msgContext ) throws AxisFault
149 {
150 axisHelperHandler.generateWSDL( msgContext );
151 }
152
153 /***
154 * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
155 */
156 public void invoke( MessageContext msgContext ) throws AxisFault
157 {
158 axisHelperHandler.invoke( msgContext );
159 }
160
161 /***
162 * @see org.apache.axis.Handler#onFault(org.apache.axis.MessageContext)
163 */
164 public void onFault( MessageContext msgContext )
165 {
166 axisHelperHandler.onFault( msgContext );
167 }
168
169 /***
170 * Use the UUID generator that comes with Axis.
171 *
172 * @return a UUID
173 */
174 protected String generateUUId()
175 {
176 return axisHelperHandler.generateUUId();
177 }
178
179 /***
180 * Axis-specific impl of {@link org.apache.ws.addressing.handler.ClientSideAddressingHandler#getSOAPAction(javax.xml.rpc.handler.MessageContext)}.
181 *
182 * @param jaxRpcMsgContext JAX-RPC message context
183 *
184 * @return the value of the SOAPAction HTTP header
185 */
186 protected String getSOAPAction( javax.xml.rpc.handler.MessageContext jaxRpcMsgContext )
187 {
188 MessageContext msgContext = (MessageContext) jaxRpcMsgContext;
189 return msgContext.getSOAPActionURI();
190 }
191
192 /***
193 * Axis-specific impl of
194 * {@link org.apache.ws.addressing.handler.ClientSideAddressingHandler#setSOAPAction(javax.xml.rpc.handler.MessageContext,String)}.
195 *
196 * @param jaxRpcMsgContext a JAX-RPC message context
197 * @param actionURI the SOAPAction URI to be set
198 */
199 protected void setSOAPAction( javax.xml.rpc.handler.MessageContext jaxRpcMsgContext, String actionURI )
200 {
201 MessageContext msgContext = (MessageContext) jaxRpcMsgContext;
202 msgContext.setUseSOAPAction( true );
203 msgContext.setSOAPActionURI( actionURI );
204 }
205
206 /***
207 * Axis-specific impl of
208 * {@link org.apache.ws.addressing.handler.ClientSideAddressingHandler#getEndpointURL(javax.xml.rpc.handler.MessageContext)}.
209 *
210 * @param jaxRpcMsgContext a JAX-RPC message context
211 */
212 protected String getEndpointURL(javax.xml.rpc.handler.MessageContext jaxRpcMsgContext) {
213 return (String) jaxRpcMsgContext.getProperty(org.apache.axis.MessageContext.TRANS_URL);
214 }
215
216 }