[xgws-dev] CVS Update: codes/xsul/java/modules/xwsif_runtime_xbeans/xsul/xwsif_runtime

Aleksander Andrzej Slominski xgws-dev_at_extreme.indiana.edu
Mon Dec 18 19:02:01 2006


aslom       06/12/18 19:01:27

  Modified:    xsul/java/doc changes.html
               xsul/java/modules/xwsif_provider_xsul_soap_http/xsul/wsif_xsul_soap_http
                        XsulSoapPort.java
               xsul/java/modules/xwsif_runtime/xsul/xwsif_runtime
                        WSIFClient.java WSIFRuntimeInvocationHandler.java
               xsul/java/modules/xwsif_runtime_xbeans/xsul/xwsif_runtime
                        XmlBeansWSIFClient.java
                        XmlBeansWSIFRuntimeInvocationHandler.java
  Log:
  option to allowMethodsUnmappedToWsdlOperations - this mimics static stub from WSDL - removed operation are detected when service is invoked - handy for case when "unimportant" operaiton was removed from WSDL (typical in dev cycle)
  
  Revision  Changes    Path
  1.70      +6 -1      codes/xsul/java/doc/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /l/extreme/cvs/codes/xsul/java/doc/changes.html,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -b -t -w -r1.69 -r1.70
  --- changes.html	14 Dec 2006 16:43:16 -0000	1.69
  +++ changes.html	19 Dec 2006 00:01:27 -0000	1.70
  @@ -18,6 +18,11 @@
   
   <ul>
   
  +<li>2006-12-18 (2.7.23)
  +Experimental version which should not require WSDL to have defintion of children elements
  +in case databinding is used (like XmlBeans)
  +</li>
  +
   <li>2006-12-14 (2.7.22)
   Add missing Lead Context parameters to schema and LeadContextHeader
   </li>
  @@ -515,7 +520,7 @@
   </td>
   <td align="right" width="25%">
   <font size="-2"><i>
  -Last modified: $Id: changes.html,v 1.69 2006/12/14 16:43:16 hperera Exp $
  +Last modified: $Id: changes.html,v 1.70 2006/12/19 00:01:27 aslom Exp $
   </i></font>
   
   </td>
  
  
  
  1.7       +15 -15    codes/xsul/java/modules/xwsif_provider_xsul_soap_http/xsul/wsif_xsul_soap_http/XsulSoapPort.java
  
  Index: XsulSoapPort.java
  ===================================================================
  RCS file: /l/extreme/cvs/codes/xsul/java/modules/xwsif_provider_xsul_soap_http/xsul/wsif_xsul_soap_http/XsulSoapPort.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -t -w -r1.6 -r1.7
  --- XsulSoapPort.java	20 Nov 2006 03:25:01 -0000	1.6
  +++ XsulSoapPort.java	19 Dec 2006 00:01:27 -0000	1.7
  @@ -4,7 +4,7 @@
    *
    * This software is open source. See the bottom of this file for the license.
    *
  - * $Id: XsulSoapPort.java,v 1.6 2006/11/20 03:25:01 aslom Exp $
  + * $Id: XsulSoapPort.java,v 1.7 2006/12/19 00:01:27 aslom Exp $
    */
   
   package xsul.wsif_xsul_soap_http;
  @@ -26,7 +26,7 @@
   /**
    * XSUL Soap/HTTP communication endpoint.
    *
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
    */
   public class XsulSoapPort implements WSIFPort {
  @@ -55,7 +55,7 @@
           this.typeMap = typeMap;
           this.location=location;
           binding = port.lookupBinding();
  -        // chekc port has soap:address
  +        // check port has soap:address
           invoker = new SoapHttpDynamicInfosetInvoker();
           setInvoker(invoker);
           soapNs = soapAddr.getNamespace();
  
  
  
  1.14      +38 -29    codes/xsul/java/modules/xwsif_runtime/xsul/xwsif_runtime/WSIFClient.java
  
  Index: WSIFClient.java
  ===================================================================
  RCS file: /l/extreme/cvs/codes/xsul/java/modules/xwsif_runtime/xsul/xwsif_runtime/WSIFClient.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -t -w -r1.13 -r1.14
  --- WSIFClient.java	20 Nov 2006 03:25:01 -0000	1.13
  +++ WSIFClient.java	19 Dec 2006 00:01:27 -0000	1.14
  @@ -4,7 +4,7 @@
    *
    * This software is open source. See the bottom of this file for the license.
    *
  - * $Id: WSIFClient.java,v 1.13 2006/11/20 03:25:01 aslom Exp $
  + * $Id: WSIFClient.java,v 1.14 2006/12/19 00:01:27 aslom Exp $
    */
   package xsul.xwsif_runtime;
   import java.lang.reflect.Proxy;
  @@ -38,12 +38,12 @@
       private WSIFService serv;
       //private Class portTypeInterface;
       protected WSIFPort port;
  +    protected boolean allowMethodsUnmappedToWsdlOperations;
       private XHandlerContext handlerContext;
       protected boolean xmlElementBasedStub;
       protected long asyncResponseTimeoutInMs = 0; //4 * 60 * 1000L; // 0 = wait indefinitely
       
       protected  WSIFAsyncResponsesCorrelator correlator;
  -    
       private WSIFAsyncSoapHttpDiiWithHandlers customInvoker;
       
       private SoapDynamicInfosetInvoker portInvoker;
  @@ -148,7 +148,8 @@
           Class portTypeInterface)
       {
           WSIFRuntimeInvocationHandler invocationHandler = new WSIFRuntimeInvocationHandler(
  -            portTypeInterface, port, typeRegistry, chainOfHandlers, correlator, asyncResponseTimeoutInMs, xmlElementBasedStub);
  +            portTypeInterface, port, allowMethodsUnmappedToWsdlOperations, typeRegistry,
  +            chainOfHandlers, correlator, asyncResponseTimeoutInMs, xmlElementBasedStub);
           ////do magic and override provider port -- could be more elegant !!!!
           //overrideAndRegenerateInvoker(port); //UGLY ...
           return invocationHandler;
  @@ -170,6 +171,14 @@
       public TypeHandlerRegistry getRegistry() {
           return typeRegistry;
       }
  +
  +    public boolean isAllowingMethodsUnmappedToWsdlOperations() {
  +        return allowMethodsUnmappedToWsdlOperations;
  +    }
  +
  +    public void allowMethodsUnmappedToWsdlOperations(boolean allowMethodsUnmappedToWsdlOperations) {
  +        this.allowMethodsUnmappedToWsdlOperations = allowMethodsUnmappedToWsdlOperations;
  +    }
   }
   
   /*
  
  
  
  1.20      +16 -43    codes/xsul/java/modules/xwsif_runtime/xsul/xwsif_runtime/WSIFRuntimeInvocationHandler.java
  
  Index: WSIFRuntimeInvocationHandler.java
  ===================================================================
  RCS file: /l/extreme/cvs/codes/xsul/java/modules/xwsif_runtime/xsul/xwsif_runtime/WSIFRuntimeInvocationHandler.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -b -t -w -r1.19 -r1.20
  --- WSIFRuntimeInvocationHandler.java	18 Dec 2006 23:40:11 -0000	1.19
  +++ WSIFRuntimeInvocationHandler.java	19 Dec 2006 00:01:27 -0000	1.20
  @@ -4,7 +4,7 @@
    *
    * This software is open source. See the bottom of this file for the license.
    *
  - * $Id: WSIFRuntimeInvocationHandler.java,v 1.19 2006/12/18 23:40:11 aslom Exp $
  + * $Id: WSIFRuntimeInvocationHandler.java,v 1.20 2006/12/19 00:01:27 aslom Exp $
    */
   package xsul.xwsif_runtime;
   
  @@ -55,6 +55,7 @@
       private List handlers;
   
       private boolean xmlElementBasedStub;
  +    private boolean allowMethodsUnmappedToWsdlOperations;
   
       private Class portTypeInterface;
   
  @@ -72,6 +73,7 @@
       public WSIFRuntimeInvocationHandler(
           Class portTypeInterface,
           WSIFPort port,
  +        boolean allowMethodsUnmappedToWsdlOperations,
           TypeHandlerRegistry registry,
           final List handlers,
           final WSIFAsyncResponsesCorrelator correlator,
  @@ -97,10 +99,7 @@
       }
   
       private void init() {
  -        // for all creatOP_NAMEMessage will generate HashMap of some kind
  -
  -        //methods lowercased must not be duplicated
  -
  +        //NOTE: method names lowercased must not be duplicated
           //find corresponding wsdl:portType
           WsdlPortType pt = port.getWsdlServicePort().lookupBinding().lookupPortType();
           // get list of operations -- each operation must map to one Java method
  @@ -141,44 +140,13 @@
                   WsdlDefinitions defs = pt.getDefinitions();
                   String msg = "method"+methodName+" in "+ portTypeInterface+" interface "+
                   "does not correspond to any WSDL operation in  "+XsulUtil.safeSerializeXmlItem(defs);
  +                if(allowMethodsUnmappedToWsdlOperations){
  +                    mapNameToOp.put(methodName, msg); // fail when method is invoked
  +                } else {
                   throw new WSIFException(msg);
               }
           }
  -
  -//        for(Iterator iter = pt.getOperations().iterator(); iter.hasNext(); ) {
  -//            WsdlPortTypeOperation ptOp = (WsdlPortTypeOperation) iter.next();
  -//            String opName = ptOp.getOperationName();
  -//
  -//            WSIFOperation op = port.createOperation(opName);
  -//            //WsdlMessage inputMsg = ptOp.getInput().lookupMessage();
  -//
  -//            //associate operation with Method
  -//            String opNameLower = opName.toLowerCase();
  -//            Method m = null;
  -//            for (int pos = 0; pos < methods.length; pos++) {
  -//                if(methods[pos].getName().toLowerCase().equals(opNameLower)) {
  -//                    if(m != null) {
  -//                        throw new WSIFException("for WSDL operation "+opName+" "+
  -//                                                    portTypeInterface+" has duplicated methods "+m.getName()+
  -//                                                    " and "+methods[pos].getName()+
  -//                                                    " in "+XsulUtil.safeSerializeXmlItem(pt));
  -//
  -//                    }
  -//                    m = methods[pos];
  -//
  -//                }
  -//            }
  -//            if(m != null) {
  -//                mapNameToOp.put(m.getName(), op);
  -//            } else {
  -//                String msg = "could not find in "+portTypeInterface
  -//                                            +" method for WSDL operation "+opName+
  -//                                            " in "+XsulUtil.safeSerializeXmlItem(pt);
  -//                //throw new WSIFException(msg);
  -//                logger.severe(msg); // be more forgiving when no method for operation is found ...
  -//            }
  -//
  -//        }
  +        }
       }
   
       public Object invoke(Object proxy, Method method, Object[] params) throws Throwable {
  @@ -204,7 +172,12 @@
   
   
       public WSIFOperation lookupOperationFromMethodName(String methodName) {
  -        return (WSIFOperation) mapNameToOp.get(methodName);
  +        Object value = mapNameToOp.get(methodName);
  +        if(value instanceof String) {
  +            String msg = (String) value;
  +            throw new WSIFException(msg);
  +        }
  +        return (WSIFOperation) value;
       }
   
       public Object invokeRemote(Object proxy, Method method, Object[] params) throws Throwable {
  @@ -242,7 +215,7 @@
           }
   
   
  -        WsdlPortTypeOutput wsdlOutput = op.getBindingOperation().lookupOperation().getOutput();
  +        //WsdlPortTypeOutput wsdlOutput = op.getBindingOperation().lookupOperation().getOutput();
           boolean success;
           //if(wsdlOutput != null) {
           success = executeRequestResponseOperation(op, in, out, fault);
  
  
  
  1.11      +6 -6      codes/xsul/java/modules/xwsif_runtime_xbeans/xsul/xwsif_runtime/XmlBeansWSIFClient.java
  
  Index: XmlBeansWSIFClient.java
  ===================================================================
  RCS file: /l/extreme/cvs/codes/xsul/java/modules/xwsif_runtime_xbeans/xsul/xwsif_runtime/XmlBeansWSIFClient.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -t -w -r1.10 -r1.11
  --- XmlBeansWSIFClient.java	20 Nov 2006 03:25:02 -0000	1.10
  +++ XmlBeansWSIFClient.java	19 Dec 2006 00:01:27 -0000	1.11
  @@ -4,7 +4,7 @@
    *
    * This software is open source. See the bottom of this file for the license.
    *
  - * $Id: XmlBeansWSIFClient.java,v 1.10 2006/11/20 03:25:02 aslom Exp $
  + * $Id: XmlBeansWSIFClient.java,v 1.11 2006/12/19 00:01:27 aslom Exp $
    */
   package xsul.xwsif_runtime;
   import org.xmlpull.v1.builder.XmlInfosetBuilder;
  @@ -29,7 +29,7 @@
           Class portTypeInterface)
       {
           WSIFRuntimeInvocationHandler handler = new XmlBeansWSIFRuntimeInvocationHandler(
  -            portTypeInterface, port, chainOfHandlers, correlator, asyncResponseTimeoutInMs);
  +            portTypeInterface, port, allowMethodsUnmappedToWsdlOperations, chainOfHandlers, correlator, asyncResponseTimeoutInMs);
           return handler;
       }
       
  
  
  
  1.8       +4 -3      codes/xsul/java/modules/xwsif_runtime_xbeans/xsul/xwsif_runtime/XmlBeansWSIFRuntimeInvocationHandler.java
  
  Index: XmlBeansWSIFRuntimeInvocationHandler.java
  ===================================================================
  RCS file: /l/extreme/cvs/codes/xsul/java/modules/xwsif_runtime_xbeans/xsul/xwsif_runtime/XmlBeansWSIFRuntimeInvocationHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -t -w -r1.7 -r1.8
  --- XmlBeansWSIFRuntimeInvocationHandler.java	18 Dec 2006 23:40:11 -0000	1.7
  +++ XmlBeansWSIFRuntimeInvocationHandler.java	19 Dec 2006 00:01:27 -0000	1.8
  @@ -4,7 +4,7 @@
    *
    * This software is open source. See the bottom of this file for the license.
    *
  - * $Id: XmlBeansWSIFRuntimeInvocationHandler.java,v 1.7 2006/12/18 23:40:11 aslom Exp $
  + * $Id: XmlBeansWSIFRuntimeInvocationHandler.java,v 1.8 2006/12/19 00:01:27 aslom Exp $
    */
   package xsul.xwsif_runtime;
   
  @@ -21,7 +21,7 @@
   import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
   
   /**
  - * This si dynamic stub implementing WSDL port/portType
  + * This is dynamic stub implementing WSDL port/portType
    */
   public class XmlBeansWSIFRuntimeInvocationHandler extends WSIFRuntimeInvocationHandler
       implements InvocationHandler
  @@ -34,11 +34,12 @@
       public XmlBeansWSIFRuntimeInvocationHandler(
           Class portTypeInterface,
           WSIFPort port,
  +        boolean allowMethodsUnmappedToWsdlOperations,
           final List handlers,
           final WSIFAsyncResponsesCorrelator correlator,
           final long asyncTimeoutInMs)
       {
  -        super(portTypeInterface, port, null, handlers, correlator, asyncTimeoutInMs, true /* it is always xmlelement based! */);
  +        super(portTypeInterface, port, allowMethodsUnmappedToWsdlOperations, null, handlers, correlator, asyncTimeoutInMs, true /* it is always xmlelement based! */);
       }
   
       public Object invokeRemote(Object proxy, Method method, Object[] params) throws Throwable {