axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl/toJava JavaServiceImplWriter.java
Date Mon, 19 Aug 2002 15:35:21 GMT
butek       2002/08/19 08:35:21

  Modified:    java/src/org/apache/axis/client Call.java Service.java
                        Stub.java
               java/src/org/apache/axis/utils axisNLS.properties
               java/src/org/apache/axis/wsdl/toJava
                        JavaServiceImplWriter.java
  Log:
  There must be a way to configure the WSDD service info into the Service
  Locator object.  The WSDD service's name is typically the same as the
  WSDL service's port name.  But there is not necessarily a 1-1 correllation
  between WSDL service's port name and WSDD service name.  A given
  WSDL service port could have any number of WSDD services.  For
  instance, imagine a hand-modified client-config.wsdd that has TWO
  services, one that sends XSI types and one that doesn't.  Right now, one
  of them would (presumably) be named after the port name and the other
  would be named "somethingElse".  There is NO WAY to tell the AXIS
  runtime to use the WSDDService named "somethingElse".
  
  In order to accomplish this feat, I've added to the service Locator class
  two methods per port:  get/set<portName>WSDDServiceName.  When the
  service locator creates the stub, it passes this info to it.
  
  This brought up one other issue.  Call.setTargetService seemed to be
  exactly what I wanted to call, but Service is already calling
  Call.setPortName to do what I'm trying to do.  setTargetService and
  setPortName appear to be virtually the same thing.  Since setTargetService
  wasn't being called and it wasn't documented anywhere, I removed it in
  favor of setPortName.  If folks have a problem with this, let me know and I
  can return setTargetService and tie it in with setPortName.
  
  Revision  Changes    Path
  1.170     +7 -18     xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.169
  retrieving revision 1.170
  diff -u -r1.169 -r1.170
  --- Call.java	6 Aug 2002 18:35:49 -0000	1.169
  +++ Call.java	19 Aug 2002 15:35:21 -0000	1.170
  @@ -154,7 +154,7 @@
   
       private boolean            parmAndRetReq   = true ;
       private Service            service         = null ;
  -    private QName              portName        = new QName("");
  +    private QName              portName        = null;
       private QName              operationName   = null ;
       private QName              returnType      = null ;
   
  @@ -1176,17 +1176,17 @@
        * Returns the fully qualified name of the port for this Call object
        * (if there is one).
        *
  -     * @return QName Fully qualified name of the port (or null if not set)
  +     * @return QName Fully qualified name of the port
        *
        * @deprecated This is really the service's port name, not portType name.
        *            Use getPortName instead.
        */
       public QName getPortTypeName() {
  -        return getPortName();
  +        return portName == null ? new QName("") : portName;
       }
   
       /**
  -     * Sets the port type of this Call object.  This call will not set
  +     * Sets the port name of this Call object.  This call will not set
        * any additional fields, nor will it do any checking to verify that
        * this port type is actually defined in the WSDL - for now anyway.
        *
  @@ -1976,7 +1976,7 @@
           msgContext.setResponseMessage(null);
           msgContext.setProperty( MessageContext.CALL, this );
           msgContext.setProperty( WSDL_SERVICE, service );
  -        msgContext.setProperty( WSDL_PORT_NAME, getPortTypeName() );
  +        msgContext.setProperty( WSDL_PORT_NAME, getPortName() );
   
           if (username != null) {
               msgContext.setUsername(username);
  @@ -2007,10 +2007,10 @@
               // If we have a SOAPService kicking around, use that directly
               msgContext.setService(myService);
           } else {
  -            if (targetService != null) {
  +            if (portName != null) {
                   // No explicit service.  If we have a target service name,
                   // try that.
  -                msgContext.setTargetService(targetService);
  +                msgContext.setTargetService(portName.getLocalPart());
               } else {
                   // No direct config, so try the namespace of the first body.
                   reqMsg = msgContext.getRequestMessage();
  @@ -2163,7 +2163,6 @@
       }
   
       private SOAPService myService = null;
  -    private String targetService = null;
   
       /**
        *
  @@ -2190,16 +2189,6 @@
           // Create a SOAPService which will be used as the client-side service
           // handler.
           setSOAPService(new SOAPService(reqHandler, null, respHandler));
  -    }
  -
  -    /**
  -     * Set the target service name on the client side.  Note that an explicit
  -     * set of an actual SOAPService (with setSOAPService()) will override
  -     * this.
  -     */
  -    public void setTargetService(String targetService)
  -    {
  -        this.targetService = targetService;
       }
   
       protected java.util.Vector attachmentParts= new java.util.Vector();
  
  
  
  1.68      +1 -1      xml-axis/java/src/org/apache/axis/client/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Service.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- Service.java	13 Aug 2002 11:48:41 -0000	1.67
  +++ Service.java	19 Aug 2002 15:35:21 -0000	1.68
  @@ -426,7 +426,7 @@
       public javax.xml.rpc.Call createCall(QName portName)
                               throws ServiceException {
           Call call = (org.apache.axis.client.Call)createCall();
  -        call.setPortTypeName( portName );
  +        call.setPortName( portName );
   
           // We can't prefill information if WSDL is not specified,
           // So just return the call that we just created.
  
  
  
  1.15      +8 -1      xml-axis/java/src/org/apache/axis/client/Stub.java
  
  Index: Stub.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Stub.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Stub.java	29 Jul 2002 12:42:12 -0000	1.14
  +++ Stub.java	19 Aug 2002 15:35:21 -0000	1.15
  @@ -268,10 +268,17 @@
       } // getPortName
   
       /**
  -     * Set the port name.
  +     * Set the port QName.
        */
       public void setPortName(QName portName) {
           cachedPortName = portName;
  +    } // setPortName
  +
  +    /**
  +     * Set the port name.
  +     */
  +    public void setPortName(String portName) {
  +        setPortName(new QName(portName));
       } // setPortName
   
       /**
  
  
  
  1.47      +2 -0      xml-axis/java/src/org/apache/axis/utils/axisNLS.properties
  
  Index: axisNLS.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- axisNLS.properties	18 Aug 2002 13:59:29 -0000	1.46
  +++ axisNLS.properties	19 Aug 2002 15:35:21 -0000	1.47
  @@ -991,3 +991,5 @@
   needJIMI=JIMI is necessary to use java.awt.Image attachments (http://java.sun.com/products/jimi/).
   
   imageEnabled=Image attachment support is enabled?
  +
  +wsddServiceName00=The WSDD service name defaults to the port name.
  
  
  
  1.21      +29 -6     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java
  
  Index: JavaServiceImplWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- JavaServiceImplWriter.java	15 Aug 2002 23:39:54 -0000	1.20
  +++ JavaServiceImplWriter.java	19 Aug 2002 15:35:21 -0000	1.21
  @@ -197,19 +197,36 @@
                           new String[] {portName, className, address}));
               }
   
  -            // Write out the get<PortName> methods
  +            // Write the private address info for this port
               pw.println();
               pw.println("    // " + JavaUtils.getMessage("getProxy00", portName));
               writeComment(pw, p.getDocumentationElement());
               pw.println("    private final java.lang.String " + portName + "_address = \""
+ address + "\";");
   
  -
  -            pw.println("" );
  +            // Write the public address getter for this port
  +            pw.println();
               pw.println("    public java.lang.String get" + portName + "Address() {" );
               pw.println("        return " + portName + "_address;" );
               pw.println("    }" );
  -            pw.println("" );
  +            pw.println();
   
  +            // Write the private WSDD service name for this port
  +            String wsddServiceName = portName + "WSDDServiceName";
  +            pw.println("    // " + JavaUtils.getMessage("wsddServiceName00"));
  +            pw.println("    private java.lang.String " + wsddServiceName + " = \"" + portName
+ "\";");
  +            pw.println();
  +
  +            // Write the public accessors for the WSDD service name for this port
  +            pw.println("    public java.lang.String get" + wsddServiceName + "() {");
  +            pw.println("        return " + wsddServiceName + ";");
  +            pw.println("    }");
  +            pw.println();
  +            pw.println("    public void set" + wsddServiceName + "(java.lang.String name)
{");
  +            pw.println("        " + wsddServiceName + " = name;");
  +            pw.println("    }");
  +            pw.println();
  +
  +            // Write the get<portName>() method
               pw.println("    public " + bindingType + " get" + portName + "() throws " +
javax.xml.rpc.ServiceException.class.getName() + " {");
               pw.println("       java.net.URL endpoint;");
               pw.println("        try {");
  @@ -222,9 +239,13 @@
               pw.println("        return get" + portName + "(endpoint);");
               pw.println("    }");
               pw.println();
  +
  +            // Write the get<portName>(URL) method
               pw.println("    public " + bindingType + " get" + portName + "(java.net.URL
portAddress) throws " + javax.xml.rpc.ServiceException.class.getName() + " {");
               pw.println("        try {");
  -            pw.println("            return new " + stubClass + "(portAddress, this);");
  +            pw.println("            " + stubClass + " _stub = new " + stubClass + "(portAddress,
this);");
  +            pw.println("            _stub.setPortName(get" + wsddServiceName + "());");
  +            pw.println("            return _stub;");
               pw.println("        }");
               pw.println("        catch (org.apache.axis.AxisFault e) {");
               pw.println("            return null; // ???");
  @@ -255,7 +276,9 @@
                   String stubClass = (String) getPortStubClasses.get(i);
                   String portName = (String) getPortPortNames.get(i);
                   pw.println("            if (" + iface + ".class.isAssignableFrom(serviceEndpointInterface))
{");
  -                pw.println("                return new " + stubClass + "(new java.net.URL("
+ portName + "_address), this);");
  +                pw.println("                " + stubClass + " _stub = new " + stubClass
+ "(new java.net.URL(" + portName + "_address), this);");
  +                pw.println("                _stub.setPortName(get" + portName + "WSDDServiceName());");
  +                pw.println("                return _stub;");
                   pw.println("            }");
               }
               pw.println("        }");
  
  
  

Mime
View raw message