KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > wsif > base > WSIFClientProxy


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2002 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "WSIF" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 2001, 2002, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package org.apache.wsif.base;
59
60 import java.lang.reflect.InvocationHandler JavaDoc;
61 import java.lang.reflect.Method JavaDoc;
62 import java.lang.reflect.Proxy JavaDoc;
63 import java.util.ArrayList JavaDoc;
64 import java.util.HashMap JavaDoc;
65 import java.util.Iterator JavaDoc;
66 import java.util.List JavaDoc;
67 import java.util.Map JavaDoc;
68
69 import javax.activation.DataHandler JavaDoc;
70 import javax.wsdl.Definition;
71 import javax.wsdl.Input;
72 import javax.wsdl.Message;
73 import javax.wsdl.Operation;
74 import javax.wsdl.Output;
75 import javax.wsdl.Part;
76 import javax.wsdl.PortType;
77 import javax.xml.namespace.QName JavaDoc;
78
79 import org.apache.wsif.WSIFConstants;
80 import org.apache.wsif.WSIFException;
81 import org.apache.wsif.WSIFMessage;
82 import org.apache.wsif.WSIFOperation;
83 import org.apache.wsif.WSIFPort;
84 import org.apache.wsif.compiler.util.TypeMapping;
85 import org.apache.wsif.logging.Trc;
86 import org.apache.wsif.providers.WSIFDynamicTypeMap;
87 import org.apache.wsif.providers.WSIFDynamicTypeMapping;
88 import org.apache.wsif.util.WSIFUtils;
89
90 /**
91  * WSIFClientProxy is a dynamic proxy (or stub) used by the
92  * WSIFServiceImpl when the application is using the stubs to
93  * invoke the web service. A WSIFClientProxy is created using the
94  * static newInstance method. A WSIFClientProxy dynamically implements
95  * exactly one interface passed by the application. This class
96  * invokes the web service using the WSIFOperation and WSIFPort
97  * interfaces and so is independent of any provider implementation.
98  * Operation overloading is supported.
99  *
100  * @author Owen Burroughs <owenb@apache.org>
101  * @author Ant Elder <antelder@apache.org>
102  * @author Jeremy Hughes <hughesj@apache.org>
103  * @author Mark Whitlock <whitlock@apache.org>
104  * @author Nirmal Mukhi <nmukhi@apache.org>
105  */

106 public class WSIFClientProxy implements InvocationHandler JavaDoc {
107     protected Class JavaDoc iface = null;
108     protected Definition def = null;
109     protected String JavaDoc serviceNS = null;
110     protected String JavaDoc serviceName = null;
111     protected String JavaDoc portTypeNS = null;
112     protected String JavaDoc portTypeName = null;
113     protected WSIFDynamicTypeMap typeMap = null;
114     protected Map JavaDoc simpleTypeReg = null;
115     protected PortType portType = null;
116     protected WSIFPort wsifport = null;
117     protected Object JavaDoc proxy = null;
118     private Map JavaDoc wsdlOperationTable = null;
119
120     /**
121      * Factory method to create a new dynamic proxy.
122      * @param iface the user interface that is to be dynamically implemented
123      * @param def the WSDL definition
124      * @param serviceNS WSDL service namespace
125      * @param serviceName WSDL service name
126      * @param portTypeNS WSDL port type namespace
127      * @param portTypeName WSDL port type name
128      * @param typeMap table of mappings between XML and Java types
129      * @return the new WSIFClientProxy
130      * @exception WSIFException
131      */

132     public static WSIFClientProxy newInstance(
133         Class JavaDoc iface,
134         Definition def,
135         String JavaDoc serviceNS,
136         String JavaDoc serviceName,
137         String JavaDoc portTypeNS,
138         String JavaDoc portTypeName,
139         WSIFDynamicTypeMap typeMap)
140         throws WSIFException {
141         Trc.entry(
142             null,
143             iface,
144             def,
145             serviceNS,
146             serviceName,
147             portTypeNS,
148             portTypeName,
149             typeMap);
150
151         if (!iface.isInterface())
152             throw new WSIFException(
153                 "Cannot get a stub for " + iface + " because it is not an interface");
154
155         WSIFClientProxy clientProxy =
156             new WSIFClientProxy(
157                 iface,
158                 def,
159                 serviceNS,
160                 serviceName,
161                 portTypeNS,
162                 portTypeName,
163                 typeMap);
164
165         Object JavaDoc proxy =
166             Proxy.newProxyInstance(
167                 iface.getClassLoader(),
168                 new Class JavaDoc[] { iface },
169                 clientProxy);
170
171         clientProxy.setProxy(proxy);
172
173         if (Trc.ON)
174             Trc.exit(clientProxy.deep());
175         return clientProxy;
176     }
177
178     /**
179      * Private constructor because newInstance() should be used instead.
180      */

181     private WSIFClientProxy(
182         Class JavaDoc iface,
183         Definition def,
184         String JavaDoc serviceNS,
185         String JavaDoc serviceName,
186         String JavaDoc portTypeNS,
187         String JavaDoc portTypeName,
188         WSIFDynamicTypeMap typeMap)
189         throws WSIFException {
190         Trc.entry(
191             this,
192             iface,
193             def,
194             serviceNS,
195             serviceName,
196             portTypeNS,
197             portTypeName,
198             typeMap);
199         this.iface = iface;
200         this.def = def;
201         this.serviceNS = serviceNS;
202         this.serviceName = serviceName;
203         this.portTypeNS = portTypeNS;
204         this.portTypeName = portTypeName;
205         this.typeMap = typeMap;
206         this.portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
207
208         simpleTypeReg = WSIFUtils.getSimpleTypesMap();
209         wsdlOperationTable = new HashMap JavaDoc();
210         Trc.exit();
211     }
212
213     private void setProxy(Object JavaDoc proxy) {
214         this.proxy = proxy;
215     }
216     
217     public Object JavaDoc getProxy() {
218         return this.proxy;
219     }
220
221     /**
222      * Select which port to use for this proxy.
223      */

224     public void setPort(WSIFPort wsifport) {
225         Trc.entry(this, wsifport);
226         this.wsifport = wsifport;
227         Trc.exit();
228     }
229
230     /**
231      * Invoke a user method. The java proxy support calls this method.
232      *
233      * The fault from the fault message is not passed back to caller
234      * (but it should be). However none of the existing providers set
235      * the fault message. I'm not sure what to do with the fault message
236      * anyhow. I guess raise a WSIFException which is what the current
237      * providers do with faults already.
238      */

239     public Object JavaDoc invoke(Object JavaDoc proxy, Method JavaDoc method, Object JavaDoc[] args)
240         throws WSIFException {
241         Trc.entry(this, method, args); // Tracing proxy cause a hang
242

243         Operation operation = findMatchingOperation(method, args);
244
245         // Now set up the input and output messages.
246
Input input = operation.getInput();
247         Output output = operation.getOutput();
248         String JavaDoc inputName = (input == null) ? null : input.getName();
249         String JavaDoc outputName = (output == null) ? null : output.getName();
250         Message inputMessage = (input == null) ? null : input.getMessage();
251         Message outputMessage = (output == null) ? null : output.getMessage();
252
253         WSIFOperation wsifOperation =
254             wsifport.createOperation(method.getName(), inputName, outputName);
255
256         // make the msg names for compiled msgs xxxAnt ask Mark why diff from inputName
257
String JavaDoc inputMsgName = "";
258         if (input != null) {
259             Message m = input.getMessage();
260             if (m != null) {
261                 QName JavaDoc qn = m.getQName();
262                 inputMsgName = (qn == null) ? "" : qn.getLocalPart();
263             }
264         }
265
266         String JavaDoc outputMsgName = "";
267         if (output != null) {
268             Message m = output.getMessage();
269             if (m != null) {
270                 QName JavaDoc qn = m.getQName();
271                 outputMsgName = (qn == null) ? "" : qn.getLocalPart();
272             }
273         }
274
275         // There must be an inputMessage.
276
WSIFMessage wsifInputMessage =
277             wsifOperation.createInputMessage(inputMsgName);
278
279         // There may not be an output message.
280
WSIFMessage wsifOutputMessage = null;
281         WSIFMessage wsifFaultMessage = null;
282         if (output != null) {
283             wsifOutputMessage = wsifOperation.createOutputMessage(inputMsgName);
284             wsifFaultMessage = wsifOperation.createFaultMessage(inputMsgName);
285         }
286
287         List JavaDoc inputParts = (inputMessage == null)
288            ? new ArrayList JavaDoc()
289            : inputMessage.getOrderedParts(null);
290         if (args != null) {
291             if (inputParts.size() != args.length) {
292                 unWrapIfWrappedDocLit(inputParts, operation.getName());
293             }
294             Iterator JavaDoc partIt = inputParts.iterator();
295             for (int argIndex = 0; partIt.hasNext(); argIndex++) {
296                 Part part = (Part) partIt.next();
297                 String JavaDoc partName;
298                 if (isWrappedInContext()) {
299                     QName JavaDoc qn = part.getElementName();
300                     partName = (qn == null) ? "" : qn.getLocalPart();
301                 } else {
302                     partName = part.getName();
303                 }
304                 wsifInputMessage.setObjectPart(partName, args[argIndex]);
305             }
306         }
307
308         if (output == null)
309             wsifOperation.executeInputOnlyOperation(wsifInputMessage);
310         else {
311             boolean success =
312                 wsifOperation.executeRequestResponseOperation(
313                     wsifInputMessage,
314                     wsifOutputMessage,
315                     wsifFaultMessage);
316             if (!success) {
317                 StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
318                 Iterator JavaDoc it = wsifFaultMessage.getPartNames();
319                 while (it.hasNext()) {
320                     String JavaDoc name = (String JavaDoc) it.next();
321                     sb.append(name).append(":").append(
322                         wsifFaultMessage.getObjectPart(name)).append(
323                         " ");
324                 }
325                 throw new WSIFException(sb.toString());
326             }
327         }
328
329         // Copy the output part out of the message.
330
Object JavaDoc result = null;
331         if (outputMessage != null) {
332             List JavaDoc outputParts = outputMessage.getOrderedParts(null);
333             if (outputParts != null && outputParts.size() > 0) {
334                 // The return value is always the first output part
335
Iterator JavaDoc outPartIt = outputParts.iterator();
336                 Part returnPart = (Part) outPartIt.next();
337                 try {
338                     result = wsifOutputMessage.getObjectPart(returnPart.getName());
339                 } catch (WSIFException e) {
340                     Trc.ignoredException(e);
341                     unWrapIfWrappedDocLit(outputParts, operation.getName()+"Response");
342                     outPartIt = outputParts.iterator();
343                     returnPart = (Part) outPartIt.next();
344                     result = wsifOutputMessage.getObjectPart(returnPart.getName());
345                 }
346                 // Are there any inout parts? Multiple output-only parts
347
// are not allowed in java. Skip over input-only parts in the message.
348
if (outPartIt.hasNext()) {
349                     Object JavaDoc[] inPartArr =
350                         inputMessage.getOrderedParts(null).toArray();
351                     Part nextOutPart = (Part) outPartIt.next();
352
353                     for (int argIndex = 0; argIndex < args.length; argIndex++) {
354                         if (((Part) (inPartArr[argIndex]))
355                             .getName()
356                             .equals(nextOutPart.getName())) {
357                             args[argIndex] =
358                                 wsifOutputMessage.getObjectPart(
359                                     nextOutPart.getName());
360                             if (outPartIt.hasNext())
361                                 nextOutPart = (Part) outPartIt.next();
362                             else
363                                 break; // No more output parameters
364
}
365                     } // end for
366
}
367             }
368         }
369         Trc.exit(result);
370         return result;
371     }
372
373     /**
374      * Find an operation in the list that matches the method and arguments.
375      *
376      * Java only allows one output-only parameter and that is the return
377      * value. Java also does not allow overloading based on the return value.
378      * Consequently we only look at the input parameters when deciding
379      * which overloaded operation to pick.
380      *
381      * If the user invoked an overloaded method, MyMethod(null) seems to be
382      * ambiguous. However it is not since java forces the user to cast the
383      * null to one of the types that are valid on the method. So the invoke
384      * method on our client proxy gets passed args[0]==null which is not typed.
385      * However method.getParameterTypes()[0] is the type that java picked to
386      * invoke. So we use getParameterTypes() to choose the operation, as well
387      * as args[i].getClass().
388      *
389      * We also use args[i].getClass() to choose the operation in case
390      * getParameterTypes()[i].equals(Object.class) (no match) but
391      * args[i].getClass() is the class specified in the operation.
392      *
393      * The typeMap only contains complexTypes, so this class also uses the
394      * simpleTypeReg for simple types (int, string, etc).
395      *
396      * We compare the class in the mapping with the one from types using
397      * isAssignableFrom() not equals() because we allow the user to pass
398      * a subclass.
399      *
400      * If there are two methods MyMethod(Address) and MyMethod(SubAddress)
401      * then MyMethod(new SubAddress()) would match both methods. So if we
402      * find an operation which exactly matches the method we return it.
403      * But if we find an operation whose types are assignable from the
404      * method's types, we carry on searching for an exact match. If we fail
405      * to find an exact match then we return the "assignable" match. There
406      * is a problem if there are multiple "assignable" matches and no exact
407      * match as would happen if MyMethod(SubSubAddress) where SubSubAddress
408      * extends Address. This code does not cope with that case and it is a
409      * known restriction (bug).
410      *
411      * If the WSDL is correct, we do not expect that there will be multiple
412      * exact matches, so we do not test for this.
413      */

414     private Operation findMatchingOperation(Method JavaDoc method, Object JavaDoc[] args)
415         throws WSIFException {
416             
417         // create a key consisting of the method and these args
418
String JavaDoc key = createWSDLOperationKey(method, args);
419         
420         // check if we have found an operation matching the signature of this
421
// invocation before
422
Operation previousOp = (Operation) wsdlOperationTable.get(key);
423         if (previousOp != null) {
424             return previousOp;
425         }
426         
427         // Check here that the method is in the interface iface
428
Method JavaDoc[] allMethods = iface.getMethods();
429         int i;
430         for (i = 0; i < allMethods.length; i++)
431             if (allMethods[i].equals(method))
432                 break;
433         if (i >= allMethods.length || !method.equals(allMethods[i]))
434             throw new WSIFException(
435                 "Method "
436                     + method.getName()
437                     + " is not in interface "
438                     + iface.getName());
439
440         String JavaDoc methodName = method.getName();
441         Class JavaDoc[] types = method.getParameterTypes();
442         List JavaDoc opList = portType.getOperations();
443         Iterator JavaDoc opIt = opList.iterator();
444         Operation matchingOperation = null;
445
446         // First try to find this method in the portType's list of operations.
447
// Be careful of overloaded operations.
448
while (opIt.hasNext()) {
449             Operation operation = (Operation) opIt.next();
450             // If the method name doesn't match the operation name this isn't the operation
451
if (!methodName.equalsIgnoreCase(operation.getName()))
452                 continue;
453
454             Input input = operation.getInput();
455             Message inputMessage = (input == null) ? null : input.getMessage();
456             List JavaDoc inputParts = (inputMessage == null)
457                ? new ArrayList JavaDoc()
458                : inputMessage.getOrderedParts(null);
459             
460             int numInputParts = inputParts.size();
461
462             // Check for a match if neither args nor the operation has any parameters
463
if (numInputParts == 0 && types.length == 0) {
464                 wsdlOperationTable.put(key, operation);
465                 return operation;
466             }
467
468             // No match if there are different numbers of parameters
469
if (types != null && (numInputParts != types.length)) {
470                 unWrapIfWrappedDocLit(inputParts, operation.getName());
471                 numInputParts = inputParts.size();
472                 if (numInputParts != types.length) {
473                     continue;
474                 }
475             }
476
477             // Go through all the parameters making sure all their datatypes match
478
Iterator JavaDoc partIt = inputParts.iterator();
479             boolean foundAllArgs = true;
480             boolean exactMatchAllArgs = true;
481             for (int argIndex = 0;
482                 partIt.hasNext() && foundAllArgs;
483                 argIndex++) {
484                     
485                 Part part = (Part) partIt.next();
486                 QName JavaDoc partTypeName = part.getTypeName();
487                 if (partTypeName==null) {
488                     partTypeName = part.getElementName();
489                 }
490
491                 /* for wrapped document literal operations AXIS uses a wrapper
492                  * element class with ">" prefixed to the namespace local part
493                  */

494                 QName JavaDoc partTypeNameWrapped =
495                    new QName JavaDoc(partTypeName.getNamespaceURI(), ">" + partTypeName.getLocalPart());
496
497                 boolean foundThisArg = false;
498                 boolean exactMatchThisArg = false;
499
500                 // Look this parameter up in the typeMap.
501
for (Iterator JavaDoc mapIt = typeMap.iterator();
502                     mapIt.hasNext() && !foundThisArg;
503                     ) {
504                     WSIFDynamicTypeMapping mapping =
505                         (WSIFDynamicTypeMapping) mapIt.next();
506                     if (mapping.getXmlType().equals(partTypeName)
507                     || (mapping.getXmlType().equals(partTypeNameWrapped))) {
508                         if (mapping
509                             .getJavaType()
510                             .isAssignableFrom(types[argIndex])
511                             || (args[argIndex] != null
512                                 && mapping.getJavaType().isAssignableFrom(
513                                     args[argIndex].getClass()))) {
514                             foundThisArg = true;
515                             if (mapping.getJavaType().equals(types[argIndex])
516                                 || (args[argIndex] != null
517                                     && mapping.getJavaType().equals(
518                                         args[argIndex].getClass())))
519                                 exactMatchThisArg = true;
520                         } else
521                             break;
522                     }
523                 }
524
525                 // Look for a simple type that matches
526
TypeMapping tm =
527                     (TypeMapping) (simpleTypeReg.get(partTypeName));
528                 if (!foundThisArg) {
529                     if (tm != null) {
530                         String JavaDoc simpleType = tm.javaType;
531                         if (types[argIndex].toString().equals(simpleType)) {
532                             // this works for simple types (float, int)
533
foundThisArg = true;
534                             exactMatchThisArg = true;
535                         } else
536                             try // this works for String, Date
537
{
538                                 Class JavaDoc simpleClass =
539                                     Class.forName(
540                                         simpleType,
541                                         true,
542                                         Thread
543                                             .currentThread()
544                                             .getContextClassLoader());
545                                 if (simpleClass
546                                     .isAssignableFrom(types[argIndex])) {
547                                     foundThisArg = true;
548                                     if (simpleClass.equals(types[argIndex]))
549                                         exactMatchThisArg = true;
550                                 }
551                             } catch (ClassNotFoundException JavaDoc ignored) {
552                                 Trc.ignoredException(ignored);
553                             }
554                     } else if (types[argIndex].equals(DataHandler JavaDoc.class))
555                         // There is no (simple or complex) type mapping for
556
// this argument. If it's a DataHandler, then assume
557
// it's a mime type, since we do automatic registering
558
// of DataHandlers for Mime types. We should really look
559
// in the WSDL binding to make sure it is a mime part.
560
foundThisArg = true;
561                 }
562
563                 if (!foundThisArg)
564                     foundAllArgs = false;
565                 if (!exactMatchThisArg)
566                     exactMatchAllArgs = false;
567             }
568
569             if (foundAllArgs) {
570                 if (exactMatchAllArgs) {
571                     wsdlOperationTable.put(key, operation);
572                     return operation;
573                 }
574
575                 // if matchingOperation!=null then write trace statement.
576
matchingOperation = operation;
577             }
578         } // end while
579

580         if (matchingOperation != null) {
581             wsdlOperationTable.put(key, matchingOperation);
582             return matchingOperation;
583         }
584
585         // if we get here then we haven't found a matching operation
586
String JavaDoc argString = new String JavaDoc();
587         if (types != null)
588             for (i = 0; i < types.length; i++) {
589                 if (i != 0)
590                     argString += ", ";
591                 argString += types[i];
592             }
593
594         throw new WSIFException(
595             "Method "
596                 + methodName
597                 + "("
598                 + argString
599                 + ") was not found in portType "
600                 + portType.getQName());
601     }
602
603     /**
604      * Create a key consisting of the method name and the types of all the args
605      */

606     private String JavaDoc createWSDLOperationKey(Method JavaDoc method, Object JavaDoc[] args) {
607         Trc.entry(this, method, args);
608
609         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
610         sb.append(method.getName()).append(":");
611
612         Class JavaDoc[] types = method.getParameterTypes();
613         for (int i = 0; i < types.length; i++)
614             sb.append(types[i].getName()).append(":");
615
616         if (args != null)
617             for (int i = 0; i < args.length; i++) {
618                 if (args[i] == null)
619                     sb.append("null");
620                 else
621                     sb.append(args[i].getClass().getName());
622                 sb.append(":");
623             }
624
625         Trc.exit(sb.toString());
626         return sb.toString();
627     }
628
629     /**
630      * Create a key consisting of all names concatenated
631      */

632     private String JavaDoc createWSIFOperationKey(
633         String JavaDoc operationName,
634         String JavaDoc inputName,
635         String JavaDoc outputName) {
636         Trc.entry(this,operationName,inputName,outputName);
637         
638         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
639         sb.append(operationName).append(inputName).append(outputName);
640         
641         Trc.exit(sb.toString());
642         return sb.toString();
643     }
644
645     /**
646      * Unwraps the top level element if this a wrapped message.
647      */

648     private void unWrapIfWrappedDocLit(List JavaDoc parts, String JavaDoc operationName)
649         throws WSIFException {
650         Part p = WSIFUtils.getWrappedDocLiteralPart(parts, operationName);
651         if (p != null) {
652             List JavaDoc unWrappedParts = WSIFUtils.unWrapPart(p, def);
653             parts.remove(p);
654             parts.addAll(unWrappedParts);
655         }
656     }
657     
658     private boolean isWrappedInContext() throws WSIFException {
659         WSIFMessage context = wsifport.getContext();
660         String JavaDoc style = null;
661         try {
662             style =
663                 (String JavaDoc) context.getObjectPart(
664                     WSIFConstants.CONTEXT_OPERATION_STYLE);
665         } catch (WSIFException e) {
666             Trc.ignoredException(e);
667         }
668         boolean wrappedInContext;
669         if (WSIFConstants.CONTEXT_OPERATION_STYLE_WRAPPED.equals(style)) {
670             wrappedInContext = true;
671         } else {
672             wrappedInContext = false;
673         }
674         return wrappedInContext;
675     }
676
677     public String JavaDoc deep() {
678         String JavaDoc buff = "";
679         try {
680             buff = new String JavaDoc(this.toString() + "\n");
681             buff += "iface: " + iface;
682             buff += " def: " + Trc.brief(def);
683             buff += " serviceNS: " + serviceNS;
684             buff += " serviceName: " + serviceName;
685             buff += " portTypeNS: " + portTypeNS;
686             buff += " portTypeName: " + portTypeName;
687             buff += " typeMap: " + typeMap;
688             buff += "\nsimpleTypeReg: " + simpleTypeReg;
689             buff += "\nportType: " + Trc.brief(portType);
690             buff += " wsifport: " + wsifport;
691
692             // Can't trace proxy here because it causes a hang.
693
//buff += "proxy: " + proxy;
694
} catch (Exception JavaDoc e) {
695             Trc.exceptionInTrace(e);
696         }
697         return buff;
698     }
699 }
700
Popular Tags