You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by jm...@apache.org on 2002/08/16 00:43:26 UTC

cvs commit: xml-axis-wsil/java/src/org/apache/wsil/client WSILProxy.java

jmsnell     2002/08/15 15:43:26

  Modified:    java/src/org/apache/wsil/client WSILProxy.java
  Log:
  Added a method of returning WSDL Documents based on implemented 
  port types.  Initial tests are successful, have yet to test with more
  complicated use cases.
  
  Revision  Changes    Path
  1.2       +84 -1     xml-axis-wsil/java/src/org/apache/wsil/client/WSILProxy.java
  
  Index: WSILProxy.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsil/java/src/org/apache/wsil/client/WSILProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WSILProxy.java	6 Jun 2002 18:01:22 -0000	1.1
  +++ WSILProxy.java	15 Aug 2002 22:43:26 -0000	1.2
  @@ -76,7 +76,6 @@
   import org.w3c.dom.Element;
   
   import javax.wsdl.*;
  -
   import java.io.*;
   import java.util.*;
   import java.net.*;
  @@ -91,6 +90,7 @@
    */
   public class WSILProxy
   {
  +  
     /**
      *  WSIL inspection document reference.
      */
  @@ -353,6 +353,89 @@
       return wsdlDocArray;
     }
   
  +
  +  /**
  +   * Returns an array of WSDLDocuments given a portType name.
  +   *
  +   * @param portTypeName a <code>QName</code> value
  +   * @return a <code>WSDLDocument</code> value or null if no documents were
  +   *         found.
  +   * @exception WSILException if an error occurs
  +   */
  +  public WSDLDocument[] getWSDLDocumentByPortType(org.apache.wsil.QName portTypeName)
  +    throws WSILException
  +  {
  +    
  +    WSDLDocument[] wsdlDocArray = null;
  +    Vector wsdlDocVector = new Vector();
  +
  +    // Process links
  +    handleLinks(this.wsilDocument);
  +
  +    for (int l = 0; l < wsilDocVector.size(); l++) 
  +    {
  +      WSILDocument currentWSILDoc = (WSILDocument)wsilDocVector.elementAt(l);
  +
  +      Service[] serviceArray = currentWSILDoc.getInspection().getServices();
  +
  +      String wsdlDocLocation = null;
  +
  +      for (int i = 0; i < serviceArray.length; i++) 
  +      {
  +        Description[] descriptionArray = serviceArray[i].getDescriptions();
  +
  +        for (int j = 0; j < descriptionArray.length; j++) 
  +        {
  +          Description description = descriptionArray[j];
  +                
  +          Reference reference = 
  +            (Reference)description.getExtensionElement();
  +
  +          if (reference != null) 
  +          {
  +            ImplementedBinding[] implementedBindingArray = 
  +              reference.getImplementedBindings();
  +
  +            WSDLDocument definition = 
  +              readWSDLDocument(
  +                currentWSILDoc.resolveURL(
  +                  description.getLocation()));
  +
  +            for (int k = 0; k < implementedBindingArray.length; k++) 
  +            {
  +              if (!wsdlDocVector.contains(definition)) {
  +                org.apache.wsil.QName tmpQName = 
  +                  implementedBindingArray[k].getBindingName();
  +                javax.xml.namespace.QName nqname = 
  +                  new javax.xml.namespace.QName(
  +                    tmpQName.getNamespaceURI(),
  +                    tmpQName.getLocalName());
  +                Binding binding = definition.getDefinitions().getBinding(nqname);
  +                if (binding != null) {
  +                  PortType portType = binding.getPortType();
  +                  if (portType != null) {
  +                    if (portType.getQName().getLocalPart().equals(portTypeName.getLocalName()) &&
  +                        portType.getQName().getNamespaceURI().equals(portTypeName.getNamespaceURI())) {
  +                      wsdlDocVector.add(definition);
  +                    }
  +                  }
  +                }  
  +              }
  +            }
  +          }
  +        }
  +      }
  +    }
  +
  +    // Create wsdlDocArray
  +    if (wsdlDocVector.size() != 0)
  +    {
  +      wsdlDocArray = new WSDLDocument[wsdlDocVector.size()];
  +      wsdlDocVector.copyInto(wsdlDocArray);
  +    }
  +
  +    return wsdlDocArray;
  +  }
   
     /**
      * Returns an array of BusinessServices given a service name.