1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| package jtr.ws.wsif; |
8 |
| |
9 |
| import java.util.Iterator; |
10 |
| import java.util.concurrent.Future; |
11 |
| |
12 |
| import javax.wsdl.Definition; |
13 |
| import javax.wsdl.WSDLException; |
14 |
| import javax.xml.namespace.QName; |
15 |
| import jtr.config.ws.Binding; |
16 |
| |
17 |
| import jtr.config.ws.WebServiceConfig; |
18 |
| import jtr.config.ws.WebServiceOperation; |
19 |
| import jtr.config.ws.WebServicePort; |
20 |
| import jtr.config.ws.WebServiceService; |
21 |
| import jtr.config.ws.WebServiceTypeMapping; |
22 |
| import jtr.runners.IRunnerWs; |
23 |
| import jtr.ws.IWsHelper; |
24 |
| import jtr.ws.IWsResponse; |
25 |
| import jtr.ws.IWsResponseListener; |
26 |
| import jtr.ws.WsMsgType; |
27 |
| import jtr.ws.WsProviderException; |
28 |
| |
29 |
| import org.apache.axis.AxisFault; |
30 |
| import org.apache.log4j.Logger; |
31 |
| import org.apache.wsif.WSIFException; |
32 |
| import org.apache.wsif.WSIFMessage; |
33 |
| import org.apache.wsif.WSIFOperation; |
34 |
| import org.apache.wsif.WSIFPort; |
35 |
| import org.apache.wsif.WSIFService; |
36 |
| import org.apache.wsif.WSIFServiceFactory; |
37 |
| import org.apache.wsif.util.WSIFUtils; |
38 |
| import org.w3c.dom.Element; |
39 |
| |
40 |
| |
41 |
| |
42 |
| |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| public class WsifHelper implements IWsHelper { |
54 |
| |
55 |
| |
56 |
| |
57 |
0
| public WsifHelper() {
|
58 |
| } |
59 |
| |
60 |
| |
61 |
| |
62 |
| |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
0
| public void generateRuntimeConfig(WebServiceConfig wsCfg) throws WsProviderException {
|
73 |
0
| wsConfig = wsCfg;
|
74 |
0
| logger.debug("Generating runtime config for WSConfig " + wsCfg.getUniqueName());
|
75 |
0
| try {
|
76 |
0
| wsRtConfig = new WebServiceRtConfig();
|
77 |
| |
78 |
0
| Definition definition = WSIFUtils.readWSDL(null, wsCfg.getWsdlLocation());
|
79 |
0
| logger.debug("Obtained definition...");
|
80 |
0
| WSIFServiceFactory serviceFactory = WSIFServiceFactory.newInstance();
|
81 |
| |
82 |
| |
83 |
0
| for (WebServiceService service : wsCfg.getServices()) {
|
84 |
0
| WSIFService wsifService = serviceFactory.getService(definition, service.getNameSpace(), service.getName(), service.getPortTypes().iterator().next().getNameSpace(), service.getPortTypes().iterator().next().getName());
|
85 |
0
| logger.debug("Got service " + service.getNameSpace() + "-" + service.getName());
|
86 |
| |
87 |
0
| Iterator iter = wsifService.getAvailablePortNames();
|
88 |
0
| logger.debug("Logging available ports...");
|
89 |
0
| while (iter.hasNext()) {
|
90 |
0
| logger.debug("Available port: " + (String) iter.next());
|
91 |
| } |
92 |
| |
93 |
| |
94 |
0
| for (WebServiceTypeMapping mapping : service.getTypeMappings()) {
|
95 |
0
| wsifService.mapType(mapping.getQualifiedName(), mapping.getJavaClass());
|
96 |
0
| logger.debug("Mapped QName " + mapping.getQualifiedName().toString() + " to Java class " + mapping.getJavaClassName());
|
97 |
| } |
98 |
| |
99 |
0
| WebServiceRtService rtService = new WebServiceRtService();
|
100 |
0
| rtService.setQualifiedName(new QName(service.getNameSpace(), service.getName()));
|
101 |
0
| rtService.setService(wsifService);
|
102 |
| |
103 |
| |
104 |
0
| for (WebServicePort port : service.getPorts()) {
|
105 |
0
| logger.debug("Looking for port " + port.getName());
|
106 |
0
| WSIFPort wsifPort = wsifService.getPort(port.getName());
|
107 |
0
| logger.debug("Obtained port " + port.getName());
|
108 |
0
| WebServiceRtPort rtPort = new WebServiceRtPort();
|
109 |
0
| rtPort.setName(port.getName());
|
110 |
0
| rtPort.setPort(wsifPort);
|
111 |
| |
112 |
| |
113 |
0
| for (WebServiceOperation operation : port.getOperations()) {
|
114 |
0
| WSIFOperation wsifOperation = wsifPort.createOperation(operation.getName());
|
115 |
0
| logger.debug("Obtained operation " + operation.getName());
|
116 |
0
| WebServiceRtOperation rtOperation = new WebServiceRtOperation();
|
117 |
0
| rtOperation.setName(operation.getName());
|
118 |
0
| rtOperation.setOperation(wsifOperation);
|
119 |
0
| rtOperation.setInputMsg(wsifOperation.createInputMessage(operation.getInputMsg().getName()));
|
120 |
0
| rtOperation.setOutputMsg(wsifOperation.createOutputMessage(operation.getOuputMsg().getName()));
|
121 |
0
| rtOperation.setFaultMsg(wsifOperation.createFaultMessage(operation.getFaultMsg().getName()));
|
122 |
| |
123 |
| |
124 |
0
| rtPort.addOperation(rtOperation.getName(), rtOperation);
|
125 |
0
| logger.debug("Added operation " + operation.getName() + " to port " + rtPort.getName());
|
126 |
| } |
127 |
| |
128 |
| |
129 |
0
| rtService.addPort(rtPort.getName(), rtPort);
|
130 |
0
| logger.debug("Added port " + rtPort.getName() + " to service " + rtService.getQualifiedName());
|
131 |
| } |
132 |
| |
133 |
| |
134 |
| |
135 |
0
| wsRtConfig.addService(rtService.getQualifiedName(), rtService);
|
136 |
0
| logger.debug("Added service " + rtService.getQualifiedName() + " to WS configuration " + wsCfg.getUniqueName());
|
137 |
| } |
138 |
| } catch (WSIFException e) { |
139 |
0
| String msg = "Caught a WSIF exception: see nested exceptions for further details.";
|
140 |
0
| WsProviderException wse = new WsProviderException(msg,e);
|
141 |
0
| logger.error(msg,wse);
|
142 |
0
| throw wse;
|
143 |
| } catch (WSDLException e) { |
144 |
0
| String msg = "Caught a WSDL exception: see nested exceptions for further details.";
|
145 |
0
| WsProviderException wse = new WsProviderException(msg,e);
|
146 |
0
| logger.error(msg,wse);
|
147 |
0
| throw wse;
|
148 |
| } catch (ClassNotFoundException e) { |
149 |
0
| String msg = "Caught a ClassNotFound exception while performing type mapping.";
|
150 |
0
| WsProviderException wse = new WsProviderException(msg,e);
|
151 |
0
| logger.error(msg,wse);
|
152 |
0
| throw wse;
|
153 |
| } |
154 |
| } |
155 |
| |
156 |
0
| public Object invoke(Binding binding, Object input) throws WsProviderException {
|
157 |
0
| throw new UnsupportedOperationException();
|
158 |
| } |
159 |
| |
160 |
| |
161 |
| |
162 |
| |
163 |
0
| public boolean synchronousInvoke(Binding binding) throws WsProviderException {
|
164 |
0
| boolean outcome = false;
|
165 |
| |
166 |
0
| WebServiceRtService rtService = wsRtConfig.getService(binding.getNameSpace(), binding.getName());
|
167 |
0
| if (rtService != null) {
|
168 |
0
| WebServiceRtPort rtPort = rtService.getPort(binding.getPortName());
|
169 |
0
| if (rtPort != null) {
|
170 |
0
| WebServiceRtOperation rtOperation = rtPort.getOperation(binding.getOperationName());
|
171 |
0
| if (rtOperation != null) {
|
172 |
0
| WSIFOperation wsifOperation = rtOperation.getOperation();
|
173 |
0
| try {
|
174 |
0
| outcome = wsifOperation.executeRequestResponseOperation(rtOperation.getInputMsg(), rtOperation.getOutputMsg(), rtOperation.getFaultMsg());
|
175 |
| } catch (WSIFException e) { |
176 |
0
| String msg = "Caught a WSIF exception: see nested exceptions for further details.";
|
177 |
0
| WsProviderException wse = new WsProviderException(msg,e);
|
178 |
0
| logger.error(msg,wse);
|
179 |
0
| throw wse;
|
180 |
| } catch (Throwable t) { |
181 |
0
| String msg = "Caught an unexpected exception: see nested exceptions for further details.";
|
182 |
0
| WsProviderException wse = new WsProviderException(msg,t);
|
183 |
0
| logger.error(msg,wse);
|
184 |
0
| throw wse;
|
185 |
| } finally { |
186 |
0
| renewOperation(rtPort, binding.getOperationName());
|
187 |
| } |
188 |
| } else { |
189 |
| |
190 |
0
| String msg = "Unable to find the required operation named: "+binding.getOperationName();
|
191 |
0
| WsProviderException wse = new WsProviderException(msg);
|
192 |
0
| logger.error(msg,wse);
|
193 |
0
| throw wse;
|
194 |
| } |
195 |
| } else { |
196 |
| |
197 |
0
| String msg = "Unable to find the required port named: "+binding.getPortName();
|
198 |
0
| WsProviderException wse = new WsProviderException(msg);
|
199 |
0
| logger.error(msg,wse);
|
200 |
0
| throw wse;
|
201 |
| } |
202 |
| } else { |
203 |
| |
204 |
0
| String msg = "Unable to find the required service named: {"+binding.getNameSpace()+"}-"+binding.getName();
|
205 |
0
| WsProviderException wse = new WsProviderException(msg);
|
206 |
0
| logger.error(msg,wse);
|
207 |
0
| throw wse;
|
208 |
| } |
209 |
0
| return outcome;
|
210 |
| } |
211 |
| |
212 |
| |
213 |
| |
214 |
| |
215 |
0
| public void asynchronousInputOnlyInvoke(Binding binding) throws WsProviderException {
|
216 |
0
| WebServiceRtService rtService = wsRtConfig.getService(binding.getNameSpace(), binding.getName());
|
217 |
0
| if (rtService != null) {
|
218 |
0
| WebServiceRtPort rtPort = rtService.getPort(binding.getPortName());
|
219 |
0
| if (rtPort != null) {
|
220 |
0
| WebServiceRtOperation rtOperation = rtPort.getOperation(binding.getOperationName());
|
221 |
0
| if (rtOperation != null) {
|
222 |
0
| WSIFOperation wsifOperation = rtOperation.getOperation();
|
223 |
0
| try {
|
224 |
0
| wsifOperation.executeInputOnlyOperation(rtOperation.getInputMsg());
|
225 |
| } catch (WSIFException e) { |
226 |
0
| String msg = "Caught a WSIF exception: see nested exceptions for further details.";
|
227 |
0
| WsProviderException wse = new WsProviderException(msg,e);
|
228 |
0
| logger.error(msg,wse);
|
229 |
0
| throw wse;
|
230 |
| } catch (Throwable t) { |
231 |
0
| String msg = "Caught an unexpected exception: see nested exceptions for further details.";
|
232 |
0
| WsProviderException wse = new WsProviderException(msg,t);
|
233 |
0
| logger.error(msg,wse);
|
234 |
0
| throw wse;
|
235 |
| } finally { |
236 |
0
| renewOperation(rtPort, binding.getOperationName());
|
237 |
| } |
238 |
| } else { |
239 |
| |
240 |
0
| String msg = "Unable to find the required operation named: "+binding.getOperationName();
|
241 |
0
| WsProviderException wse = new WsProviderException(msg);
|
242 |
0
| logger.error(msg,wse);
|
243 |
0
| throw wse;
|
244 |
| } |
245 |
| } else { |
246 |
| |
247 |
0
| String msg = "Unable to find the required port named: "+binding.getOperationName();
|
248 |
0
| WsProviderException wse = new WsProviderException(msg);
|
249 |
0
| logger.error(msg,wse);
|
250 |
0
| throw wse;
|
251 |
| } |
252 |
| } else { |
253 |
| |
254 |
0
| String msg = "Unable to find the required service named: {"+binding.getNameSpace()+"}-"+binding.getName();
|
255 |
0
| WsProviderException wse = new WsProviderException(msg);
|
256 |
0
| logger.error(msg,wse);
|
257 |
0
| throw wse;
|
258 |
| } |
259 |
| } |
260 |
| |
261 |
| |
262 |
| |
263 |
| |
264 |
| |
265 |
| |
266 |
| |
267 |
| |
268 |
| |
269 |
| |
270 |
| |
271 |
| |
272 |
0
| protected WSIFOperation renewOperation(WebServiceRtPort port, String operationName) throws WsProviderException {
|
273 |
0
| try {
|
274 |
0
| WSIFOperation operation = port.getPort().createOperation(operationName);
|
275 |
0
| port.getOperation(operationName).setOperation(operation);
|
276 |
0
| return operation;
|
277 |
| } catch(WSIFException e) { |
278 |
0
| String msg = "Unable to obtain a reference to the operation named "+operationName;
|
279 |
0
| logger.fatal(msg,e);
|
280 |
0
| throw new WsProviderException(msg,e);
|
281 |
| } |
282 |
| } |
283 |
| |
284 |
| |
285 |
| |
286 |
| |
287 |
| |
288 |
| |
289 |
| |
290 |
| |
291 |
| |
292 |
| |
293 |
| |
294 |
| |
295 |
| |
296 |
0
| protected WSIFMessage getOperationMessage(Binding binding, WsMsgType msgType) {
|
297 |
0
| WSIFMessage res = null;
|
298 |
0
| WebServiceRtService service = wsRtConfig.getService(binding.getNameSpace(), binding.getName());
|
299 |
0
| if (service != null) {
|
300 |
0
| WebServiceRtPort port = service.getPort(binding.getPortName());
|
301 |
0
| if (port != null) {
|
302 |
0
| WebServiceRtOperation operation = port.getOperation(binding.getOperationName());
|
303 |
0
| if (operation != null) {
|
304 |
0
| switch (msgType) {
|
305 |
0
| case INPUT_MSG: {
|
306 |
0
| res = operation.getInputMsg();
|
307 |
0
| logger.debug("Got input message " + res);
|
308 |
0
| break;
|
309 |
| } |
310 |
0
| case OUTPUT_MSG: {
|
311 |
0
| res = operation.getOutputMsg();
|
312 |
0
| logger.debug("Got output message " + res);
|
313 |
0
| break;
|
314 |
| } |
315 |
0
| case FAULT_MSG: {
|
316 |
0
| res = operation.getFaultMsg();
|
317 |
0
| logger.debug("Got fault message " + res);
|
318 |
0
| break;
|
319 |
| } |
320 |
0
| default: {
|
321 |
0
| logger.warn("An unexpected message type has been requested: returning null");
|
322 |
| } |
323 |
| } |
324 |
| } |
325 |
| } |
326 |
| } |
327 |
0
| return res;
|
328 |
| } |
329 |
| |
330 |
| |
331 |
| |
332 |
| |
333 |
0
| public String getFaultMessageAsString(Binding binding) {
|
334 |
0
| String res = null;
|
335 |
0
| WSIFMessage msg = getOperationMessage(binding, WsMsgType.FAULT_MSG);
|
336 |
0
| Iterator parts = msg.getParts();
|
337 |
0
| while (parts.hasNext()) {
|
338 |
0
| Object part = parts.next();
|
339 |
0
| if (part instanceof AxisFault) {
|
340 |
0
| res = "FaultString: " + ((AxisFault) part).getFaultString() + "\nFaultActor: " + ((AxisFault) part).getFaultActor() + "\nFaultCode: " + ((AxisFault) part).getFaultCode()
|
341 |
| + "\nFaultNode: " + "\nFaultString " + ((AxisFault) part).getFaultString(); |
342 |
| |
343 |
0
| Element[] details = ((AxisFault) part).getFaultDetails();
|
344 |
0
| for (Element element : details) {
|
345 |
0
| res = res + "\nFaultDetail: (Name - Value) " + element.getNodeName() + " - " + element.getNodeValue();
|
346 |
| } |
347 |
| } |
348 |
| } |
349 |
0
| return res;
|
350 |
| } |
351 |
| |
352 |
| |
353 |
| |
354 |
| |
355 |
0
| public Throwable getFaultCause(Binding binding) {
|
356 |
0
| Throwable res = null;
|
357 |
0
| WSIFMessage msg = getOperationMessage(binding, WsMsgType.FAULT_MSG);
|
358 |
0
| Iterator parts = msg.getParts();
|
359 |
0
| while (parts.hasNext()) {
|
360 |
0
| Object part = parts.next();
|
361 |
0
| if (part instanceof AxisFault) {
|
362 |
0
| res = ((AxisFault) part).getCause();
|
363 |
| } |
364 |
| } |
365 |
0
| if (res == null)
|
366 |
0
| logger.warn("Attention: there is no available fault cause, returning null");
|
367 |
0
| return res;
|
368 |
| } |
369 |
| |
370 |
| |
371 |
| |
372 |
| |
373 |
| |
374 |
| |
375 |
0
| public Object getMessageObjectPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
376 |
0
| Object res = null;
|
377 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
378 |
0
| if (msg != null) {
|
379 |
0
| try {
|
380 |
0
| res = msg.getObjectPart(partName);
|
381 |
| } catch (WSIFException e) { |
382 |
0
| String emsg = "Caught a WSIF exception while getting Object part "+partName +" for the following ws-configuration:\n"+
|
383 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
384 |
| +"Port: "+binding.getPortName()+"\n" |
385 |
| +"Operation: "+binding.getOperationName()+"\n" |
386 |
| +"See nested exceptions for further details."; |
387 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
388 |
0
| logger.error(msg,wse);
|
389 |
0
| throw wse;
|
390 |
| } |
391 |
| } |
392 |
0
| return res;
|
393 |
| } |
394 |
| |
395 |
| |
396 |
| |
397 |
| |
398 |
| |
399 |
| |
400 |
0
| public int getMessageIntPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
401 |
0
| Integer res = null;
|
402 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
403 |
0
| if (msg != null) {
|
404 |
0
| try {
|
405 |
0
| res = msg.getIntPart(partName);
|
406 |
| } catch (WSIFException e) { |
407 |
0
| String emsg = "Caught a WSIF exception while getting int part "+partName +" for the following ws-configuration:\n"+
|
408 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
409 |
| +"Port: "+binding.getPortName()+"\n" |
410 |
| +"Operation: "+binding.getOperationName()+"\n" |
411 |
| +"See nested exceptions for further details."; |
412 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
413 |
0
| logger.error(msg,wse);
|
414 |
0
| throw wse;
|
415 |
| } |
416 |
| } |
417 |
0
| return res;
|
418 |
| } |
419 |
| |
420 |
| |
421 |
| |
422 |
| |
423 |
| |
424 |
| |
425 |
0
| public boolean getMessageBooleanPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
426 |
0
| Boolean res = null;
|
427 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
428 |
0
| if (msg != null) {
|
429 |
0
| try {
|
430 |
0
| res = msg.getBooleanPart(partName);
|
431 |
| } catch (WSIFException e) { |
432 |
0
| String emsg = "Caught a WSIF exception while getting boolean part "+partName +" for the following ws-configuration:\n"+
|
433 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
434 |
| +"Port: "+binding.getPortName()+"\n" |
435 |
| +"Operation: "+binding.getOperationName()+"\n" |
436 |
| +"See nested exceptions for further details."; |
437 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
438 |
0
| logger.error(msg,wse);
|
439 |
0
| throw wse;
|
440 |
| } |
441 |
| } |
442 |
0
| return res;
|
443 |
| } |
444 |
| |
445 |
| |
446 |
| |
447 |
| |
448 |
| |
449 |
| |
450 |
0
| public byte getMessageBytePart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
451 |
0
| Byte res = null;
|
452 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
453 |
0
| if (msg != null) {
|
454 |
0
| try {
|
455 |
0
| res = msg.getBytePart(partName);
|
456 |
| } catch (WSIFException e) { |
457 |
0
| String emsg = "Caught a WSIF exception while getting byte part "+partName +" for the following ws-configuration:\n"+
|
458 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
459 |
| +"Port: "+binding.getPortName()+"\n" |
460 |
| +"Operation: "+binding.getOperationName()+"\n" |
461 |
| +"See nested exceptions for further details."; |
462 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
463 |
0
| logger.error(msg,wse);
|
464 |
0
| throw wse;
|
465 |
| } |
466 |
| } |
467 |
0
| return res;
|
468 |
| } |
469 |
| |
470 |
| |
471 |
| |
472 |
| |
473 |
| |
474 |
| |
475 |
0
| public char getMessageCharPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
476 |
0
| Character res = null;
|
477 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
478 |
0
| if (msg != null) {
|
479 |
0
| try {
|
480 |
0
| res = msg.getCharPart(partName);
|
481 |
| } catch (WSIFException e) { |
482 |
0
| String emsg = "Caught a WSIF exception while getting char part "+partName +" for the following ws-configuration:\n"+
|
483 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
484 |
| +"Port: "+binding.getPortName()+"\n" |
485 |
| +"Operation: "+binding.getOperationName()+"\n" |
486 |
| +"See nested exceptions for further details."; |
487 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
488 |
0
| logger.error(msg,wse);
|
489 |
0
| throw wse;
|
490 |
| } |
491 |
| } |
492 |
0
| return res;
|
493 |
| } |
494 |
| |
495 |
| |
496 |
| |
497 |
| |
498 |
| |
499 |
| |
500 |
0
| public double getMessageDoublePart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
501 |
0
| Double res = null;
|
502 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
503 |
0
| if (msg != null) {
|
504 |
0
| try {
|
505 |
0
| res = msg.getDoublePart(partName);
|
506 |
| } catch (WSIFException e) { |
507 |
0
| String emsg = "Caught a WSIF exception while getting double part "+partName +" for the following ws-configuration:\n"+
|
508 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
509 |
| +"Port: "+binding.getPortName()+"\n" |
510 |
| +"Operation: "+binding.getOperationName()+"\n" |
511 |
| +"See nested exceptions for further details."; |
512 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
513 |
0
| logger.error(msg,wse);
|
514 |
0
| throw wse;
|
515 |
| } |
516 |
| } |
517 |
0
| return res;
|
518 |
| } |
519 |
| |
520 |
| |
521 |
| |
522 |
| |
523 |
| |
524 |
| |
525 |
0
| public float getMessageFloatPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
526 |
0
| Float res = null;
|
527 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
528 |
0
| if (msg != null) {
|
529 |
0
| try {
|
530 |
0
| res = msg.getFloatPart(partName);
|
531 |
| } catch (WSIFException e) { |
532 |
0
| String emsg = "Caught a WSIF exception while getting float part "+partName +" for the following ws-configuration:\n"+
|
533 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
534 |
| +"Port: "+binding.getPortName()+"\n" |
535 |
| +"Operation: "+binding.getOperationName()+"\n" |
536 |
| +"See nested exceptions for further details."; |
537 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
538 |
0
| logger.error(msg,wse);
|
539 |
0
| throw wse;
|
540 |
| } |
541 |
| } |
542 |
0
| return res;
|
543 |
| } |
544 |
| |
545 |
| |
546 |
| |
547 |
| |
548 |
| |
549 |
| |
550 |
0
| public long getMessageLongPart(Binding binding, String partName, WsMsgType msgType) throws WsProviderException {
|
551 |
0
| Long res = null;
|
552 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
553 |
0
| if (msg != null) {
|
554 |
0
| try {
|
555 |
0
| res = msg.getLongPart(partName);
|
556 |
| } catch (WSIFException e) { |
557 |
0
| String emsg = "Caught a WSIF exception while getting long part "+partName +" for the following ws-configuration:\n"+
|
558 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
559 |
| +"Port: "+binding.getPortName()+"\n" |
560 |
| +"Operation: "+binding.getOperationName()+"\n" |
561 |
| +"See nested exceptions for further details."; |
562 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
563 |
0
| logger.error(msg,wse);
|
564 |
0
| throw wse;
|
565 |
| } |
566 |
| } |
567 |
0
| return res;
|
568 |
| } |
569 |
| |
570 |
| |
571 |
| |
572 |
| |
573 |
| |
574 |
| |
575 |
0
| public void setMessageObjectPart(Binding binding, String partName, Object val, WsMsgType msgType) throws WsProviderException {
|
576 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
577 |
0
| if (msg != null) {
|
578 |
0
| try {
|
579 |
0
| msg.setObjectPart(partName, val);
|
580 |
| } catch (WSIFException e) { |
581 |
0
| String emsg = "Caught a WSIF exception while setting Object part "+partName +" for the following ws-configuration:\n"+
|
582 |
| "Service: {"+binding.getNameSpace()+"}"+binding.getName()+"\n" |
583 |
| +"Port: "+binding.getPortName()+"\n" |
584 |
| +"Operation: "+binding.getOperationName()+"\n" |
585 |
| +"See nested exceptions for further details."; |
586 |
0
| WsProviderException wse = new WsProviderException(emsg,e);
|
587 |
0
| logger.error(msg,wse);
|
588 |
0
| throw wse;
|
589 |
| } |
590 |
| } |
591 |
| } |
592 |
| |
593 |
| |
594 |
| |
595 |
| |
596 |
0
| public void setMessageIntPart(Binding binding, String partName, int val, WsMsgType msgType) {
|
597 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
598 |
0
| if (msg != null) {
|
599 |
0
| msg.setIntPart(partName, val);
|
600 |
| } |
601 |
| } |
602 |
| |
603 |
| |
604 |
| |
605 |
| |
606 |
0
| public void setMessageBooleanPart(Binding binding, String partName, boolean val, WsMsgType msgType) {
|
607 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
608 |
0
| if (msg != null) {
|
609 |
0
| msg.setBooleanPart(partName, val);
|
610 |
| } |
611 |
| } |
612 |
| |
613 |
| |
614 |
| |
615 |
| |
616 |
| |
617 |
0
| public void setMessageBytePart(Binding binding, String partName, byte val, WsMsgType msgType) {
|
618 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
619 |
0
| if (msg != null) {
|
620 |
0
| msg.setBytePart(partName, val);
|
621 |
| } |
622 |
| } |
623 |
| |
624 |
| |
625 |
| |
626 |
| |
627 |
| |
628 |
0
| public void setMessageCharPart(Binding binding, String partName, char val, WsMsgType msgType) {
|
629 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
630 |
0
| if (msg != null) {
|
631 |
0
| msg.setCharPart(partName, val);
|
632 |
| } |
633 |
| } |
634 |
| |
635 |
| |
636 |
| |
637 |
| |
638 |
| |
639 |
0
| public void setMessageDoublePart(Binding binding, String partName, double val, WsMsgType msgType) {
|
640 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
641 |
0
| if (msg != null) {
|
642 |
0
| msg.setDoublePart(partName, val);
|
643 |
| } |
644 |
| } |
645 |
| |
646 |
| |
647 |
| |
648 |
| |
649 |
| |
650 |
0
| public void setMessageFloatPart(Binding binding, String partName, float val, WsMsgType msgType) {
|
651 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
652 |
0
| if (msg != null) {
|
653 |
0
| msg.setFloatPart(partName, val);
|
654 |
| } |
655 |
| } |
656 |
| |
657 |
| |
658 |
| |
659 |
| |
660 |
| |
661 |
0
| public void setMessageLongPart(Binding binding, String partName, long val, WsMsgType msgType) {
|
662 |
0
| WSIFMessage msg = getOperationMessage(binding, msgType);
|
663 |
0
| if (msg != null) {
|
664 |
0
| msg.setLongPart(partName, val);
|
665 |
| } |
666 |
| } |
667 |
| |
668 |
| |
669 |
| |
670 |
| |
671 |
0
| public String[] getMessageParts(Binding binding, WsMsgType msgType) {
|
672 |
0
| String[] res = null;
|
673 |
0
| switch (msgType) {
|
674 |
0
| case INPUT_MSG : {
|
675 |
0
| res = wsConfig.getService(binding.getNameSpace(), binding.getName()).getPort(binding.getPortName()).getOperation(binding.getOperationName()).getInputMsg().getPartNames();
|
676 |
0
| break;
|
677 |
| } |
678 |
0
| case FAULT_MSG : {
|
679 |
0
| res = wsConfig.getService(binding.getNameSpace(), binding.getName()).getPort(binding.getPortName()).getOperation(binding.getOperationName()).getFaultMsg().getPartNames();
|
680 |
0
| break;
|
681 |
| } |
682 |
0
| case OUTPUT_MSG : {
|
683 |
0
| res = wsConfig.getService(binding.getNameSpace(), binding.getName()).getPort(binding.getPortName()).getOperation(binding.getOperationName()).getOuputMsg().getPartNames();
|
684 |
0
| break;
|
685 |
| } |
686 |
| } |
687 |
0
| return res;
|
688 |
| } |
689 |
| |
690 |
| |
691 |
| |
692 |
| |
693 |
| |
694 |
| |
695 |
| |
696 |
| |
697 |
| |
698 |
| |
699 |
| |
700 |
| |
701 |
0
| public WebServiceRtConfig getWsRtConfig() {
|
702 |
0
| return wsRtConfig;
|
703 |
| } |
704 |
| |
705 |
0
| public void invokeOneWay(Binding binding, Object input) throws WsProviderException {
|
706 |
| } |
707 |
| |
708 |
0
| public Future<?> invokeAsync(Binding binding, Object input, IWsResponseListener rl) throws WsProviderException {
|
709 |
0
| return null;
|
710 |
| } |
711 |
| |
712 |
0
| public IWsResponse invokeAsync(Binding binding, Object input) throws WsProviderException {
|
713 |
0
| return null;
|
714 |
| } |
715 |
| |
716 |
| protected WebServiceRtConfig wsRtConfig; |
717 |
| protected WebServiceConfig wsConfig; |
718 |
| |
719 |
| protected Logger logger = Logger.getLogger(WsifHelper.class); |
720 |
| |
721 |
0
| public Object invoke(IRunnerWs runner, Binding binding, Object input) throws WsProviderException {
|
722 |
0
| throw new UnsupportedOperationException("Not supported yet. Use JaxEsHelperFactory instead.");
|
723 |
| } |
724 |
| |
725 |
0
| public void invokeOneWay(IRunnerWs runner, Binding binding, Object input) throws WsProviderException {
|
726 |
0
| throw new UnsupportedOperationException("Not supported yet. Use JaxEsHelperFactory instead.");
|
727 |
| } |
728 |
| |
729 |
0
| public Future<?> invokeAsync(IRunnerWs runner, Binding binding, Object input, IWsResponseListener rl) throws WsProviderException {
|
730 |
0
| throw new UnsupportedOperationException("Not supported yet. Use JaxEsHelperFactory instead.");
|
731 |
| } |
732 |
| |
733 |
0
| public IWsResponse invokeAsync(IRunnerWs runner, Binding binding, Object input) throws WsProviderException {
|
734 |
0
| throw new UnsupportedOperationException("Not supported yet. Use JaxEsHelperFactory instead.");
|
735 |
| } |
736 |
| } |