antelder    2002/11/18 08:22:06

  Modified:    java/samples/clients DynamicInvoker.java
  Log:
  Fix the DynamicInvokerSample to work with simple .Net doc style services
  
  Revision  Changes    Path
  1.7       +14 -9     xml-axis-wsif/java/samples/clients/DynamicInvoker.java
  
  Index: DynamicInvoker.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/samples/clients/DynamicInvoker.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DynamicInvoker.java       18 Nov 2002 14:07:01 -0000      1.6
  +++ DynamicInvoker.java       18 Nov 2002 16:22:06 -0000      1.7
  @@ -60,6 +60,7 @@
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Map;
   import java.util.StringTokenizer;
   
   import javax.wsdl.Definition;
  @@ -196,15 +197,19 @@
           System.out.println("Preparing WSIF dynamic invocation");
   
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
  -        if (portName != null) {
  -           Port p = service.getPort(portName);
  -           if (p!=null) {
  -              QName pn = p.getBinding().getQName();
  -              if (pn!=null) {
  -                 portTypeName = pn.getLocalPart();
  -                 portTypeNS = pn.getNamespaceURI();
  -              }
  -           }
  +
  +        Map portTypes = WSIFUtils.getAllItems(def, "PortType");
  +        // Really there should be a way to specify the portType
  +        // for now just try to find one with the portName 
  +        if (portTypes.size() > 1 && portName != null) {
  +             for (Iterator i=portTypes.keySet().iterator(); i.hasNext(); ) {
  +                     QName qn = (QName) i.next();
  +                     if (portName.equals(qn.getLocalPart())) {
  +                  portTypeName = qn.getLocalPart();
  +                  portTypeNS = qn.getNamespaceURI();
  +                  break;
  +               }
  +            }
           }
           PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
   
  
  
  


Reply via email to