axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject cvs commit: xml-axis-wsif/java/src/org/apache/wsif/util WSIFUtils.java
Date Fri, 04 Oct 2002 07:05:16 GMT
antelder    2002/10/04 00:05:16

  Modified:    java/src/org/apache/wsif/providers/soap/apachesoap
                        WSIFPort_ApacheSOAP.java
               java/src/org/apache/wsif/providers/soap/apacheaxis
                        WSIFPort_ApacheAxis.java
               java/src/org/apache/wsif/util WSIFUtils.java
  Log:
  Fix bugzila bug 13038 - correctly find binding operation matching the portType operation
  
  Revision  Changes    Path
  1.18      +3 -5      xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFPort_ApacheSOAP.java
  
  Index: WSIFPort_ApacheSOAP.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFPort_ApacheSOAP.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- WSIFPort_ApacheSOAP.java	18 Sep 2002 15:38:19 -0000	1.17
  +++ WSIFPort_ApacheSOAP.java	4 Oct 2002 07:05:15 -0000	1.18
  @@ -90,10 +90,10 @@
   import org.apache.wsif.WSIFException;
   import org.apache.wsif.WSIFOperation;
   import org.apache.wsif.base.WSIFDefaultPort;
  -import org.apache.wsif.base.WSIFServiceImpl;
   import org.apache.wsif.logging.Trc;
   import org.apache.wsif.providers.WSIFDynamicTypeMap;
   import org.apache.wsif.providers.WSIFDynamicTypeMapping;
  +import org.apache.wsif.util.WSIFUtils;
   import org.apache.wsif.wsdl.extensions.jms.JMSAddress;
   import org.apache.wsif.wsdl.extensions.jms.JMSProperty;
   import org.apache.wsif.wsdl.extensions.jms.JMSPropertyValue;
  @@ -528,10 +528,8 @@
   		
           if (operation == null) {
               BindingOperation bop =
  -                port.getBinding().getBindingOperation(
  -                    name,
  -                    inputName,
  -                    outputName);
  +               WSIFUtils.getBindingOperation( 
  +                  port.getBinding(), name, inputName, outputName );
   
               if (bop != null) {
                   operation =
  
  
  
  1.11      +2 -11     xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFPort_ApacheAxis.java
  
  Index: WSIFPort_ApacheAxis.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apacheaxis/WSIFPort_ApacheAxis.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WSIFPort_ApacheAxis.java	25 Sep 2002 14:23:46 -0000	1.10
  +++ WSIFPort_ApacheAxis.java	4 Oct 2002 07:05:15 -0000	1.11
  @@ -82,24 +82,18 @@
   import javax.wsdl.extensions.soap.SOAPFault;
   import javax.wsdl.extensions.soap.SOAPHeader;
   import javax.wsdl.extensions.soap.SOAPOperation;
  -
   import javax.xml.rpc.JAXRPCException;
  -import javax.xml.namespace.QName;
   
   import org.apache.axis.client.Call;
   import org.apache.axis.client.Transport;
  -import org.apache.axis.encoding.TypeMappingRegistry;
  -import org.apache.axis.encoding.ser.BeanDeserializerFactory;
  -import org.apache.axis.encoding.ser.BeanSerializerFactory;
   import org.apache.axis.transport.http.HTTPTransport;
   import org.apache.wsif.WSIFException;
  -import org.apache.wsif.WSIFMessage;
   import org.apache.wsif.WSIFOperation;
   import org.apache.wsif.base.WSIFDefaultPort;
   import org.apache.wsif.logging.Trc;
   import org.apache.wsif.providers.WSIFDynamicTypeMap;
  -import org.apache.wsif.providers.WSIFDynamicTypeMapping;
   import org.apache.wsif.util.WSIFProperties;
  +import org.apache.wsif.util.WSIFUtils;
   import org.apache.wsif.util.jms.WSIFJMSDestination;
   import org.apache.wsif.util.jms.WSIFJMSFinder;
   import org.apache.wsif.wsdl.extensions.jms.JMSAddress;
  @@ -245,10 +239,7 @@
               }
                   
               BindingOperation bindingoperation =
  -                binding.getBindingOperation(
  -                    s3,
  -                    input.getName(),
  -                    output == null ? null : output.getName());
  +               WSIFUtils.getBindingOperation( binding, operation );
               if (bindingoperation == null)
                   throw new WSIFException(
                       "missing required in WSDL 1.1 binding operation for " + s3);
  
  
  
  1.19      +105 -2    xml-axis-wsif/java/src/org/apache/wsif/util/WSIFUtils.java
  
  Index: WSIFUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/util/WSIFUtils.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- WSIFUtils.java	27 Sep 2002 13:14:10 -0000	1.18
  +++ WSIFUtils.java	4 Oct 2002 07:05:16 -0000	1.19
  @@ -71,15 +71,20 @@
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  -import java.util.Properties;
   import java.util.Set;
   import java.util.StringTokenizer;
   
   import javax.wsdl.Binding;
  +import javax.wsdl.BindingInput;
  +import javax.wsdl.BindingOperation;
  +import javax.wsdl.BindingOutput;
   import javax.wsdl.Definition;
   import javax.wsdl.Import;
  +import javax.wsdl.Input;
   import javax.wsdl.Message;
   import javax.wsdl.Operation;
  +import javax.wsdl.OperationType;
  +import javax.wsdl.Output;
   import javax.wsdl.Part;
   import javax.wsdl.PortType;
   import javax.wsdl.Service;
  @@ -1062,7 +1067,105 @@
               return "http://" + result.substring(0, result.length() - 1) + "/";
           return "http://" + result + "/";
       }
  -    
  +
  +   /**
  +    * Get a binding operation for a portType operation.
  +    * 
  +    * @param binding the WSLD binding the operation will choosen from
  +    * @param portTypeOp the portType operation the binding operation 
  +    *         must match
  +    * @return the BindingOperation  
  +    */
  +   public static BindingOperation getBindingOperation(
  +      Binding binding,
  +      Operation portTypeOp) throws WSIFException {
  +
  +      Trc.entry(null, binding, portTypeOp);
  +      BindingOperation bop;
  +      if ( portTypeOp == null ) {
  +      	bop = null;
  +      } else {
  +      	bop = getBindingOperation( 
  +           binding, 
  +           portTypeOp.getName(),
  +           portTypeOp.getInput()==null ? null : portTypeOp.getInput().getName(),
  +           portTypeOp.getOutput()==null ? null : portTypeOp.getOutput().getName() );
  +      }
  +      Trc.exit(bop);
  +      return bop;
  +   }
  +
  +   /**
  +    * Get a binding operation for a portType operation.
  +    * 
  +    * @param binding the WSLD binding the operation will choosen from
  +    * @param opName the portType operation name of the wanted operation
  +    * @param inName the portType operation input name
  +    * @param outName the portType operation outpur name
  +    * @return the BindingOperation  
  +    */
  +   public static BindingOperation getBindingOperation(
  +      Binding binding,
  +      String opName,
  +      String inName,
  +      String outName) throws WSIFException {
  +
  +      Trc.entry(null, binding, opName, inName, outName);        	
  +      BindingOperation op = null;
  +      if (binding != null && opName != null) {
  +         ArrayList matchingOps = new ArrayList();
  +         List bops = binding.getBindingOperations();
  +         if (bops != null) {
  +            for (Iterator i = bops.iterator(); i.hasNext();) {
  +               BindingOperation bop = (BindingOperation) i.next();
  +               if ( opName.equals(bop.getName()) ) {
  +                  matchingOps.add(bop);
  +               }
  +            }
  +            if (matchingOps.size() == 1) {
  +               op = (BindingOperation) matchingOps.get(0);
  +            } else if (matchingOps.size() > 1) {
  +               op = chooseBindingOperation(matchingOps, inName, outName);
  +            }
  +         }
  +      }
  +      Trc.exit(op);
  +      return op;      	
  +   }
  +
  +   private static BindingOperation chooseBindingOperation(
  +      ArrayList bindingOps,
  +      String inName,
  +      String outName) throws WSIFException {
  +      	
  +      BindingOperation choosenOp = null;
  +      for (Iterator i = bindingOps.iterator(); i.hasNext(); ) {
  +         BindingOperation bop = (BindingOperation) i.next();
  +         String binName = (bop.getBindingInput() == null) ? 
  +            null : 
  +            bop.getBindingInput().getName();
  +         String boutName = (bop.getBindingOutput() == null) ?
  +            null : 
  +            bop.getBindingOutput().getName();
  +         if ((inName == null) ? binName == null : inName.equals(binName)) {
  +            if ((outName == null)
  +               ? boutName == null
  +               : outName.equals(boutName)) {
  +               if ( choosenOp == null ) {
  +                  choosenOp = bop;
  +               } else {
  +                  throw new WSIFException( 
  +                     "duplicate operation in binding: " +
  +                     bop.getName() +
  +                     ":" + inName +
  +                     ":" + outName );
  +               }
  +            }
  +         }
  +      }
  +      return choosenOp;
  +   }
  +
       private static boolean isJavaKeyword(String identifier) {
           if (keywordMap == null) {
               Object value = new Object();
  
  
  

Mime
View raw message