axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava JavaServiceImplWriter.java
Date Tue, 06 Jul 2004 02:22:58 GMT
dims        2004/07/05 19:22:57

  Modified:    java/src/org/apache/axis/wsdl/toJava
                        JavaServiceImplWriter.java
  Log:
  Fix from "Jongjin Choi" <gunsnroz@hotmail.com>
  (http://marc.theaimsgroup.com/?l=axis-dev&m=108904042826447&w=2)
  
  [Preserve the port name (specified in wsdl) in generated code]
  
  Revision  Changes    Path
  1.38      +15 -10    ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java
  
  Index: JavaServiceImplWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- JavaServiceImplWriter.java	30 Mar 2004 11:36:02 -0000	1.37
  +++ JavaServiceImplWriter.java	6 Jul 2004 02:22:57 -0000	1.38
  @@ -98,6 +98,7 @@
           Vector getPortIfaces = new Vector();
           Vector getPortStubClasses = new Vector();
           Vector getPortPortNames = new Vector();
  +        Vector getPortPortXmlNames = new Vector();
           boolean printGetPortNotice = false;
   
           // get ports
  @@ -150,6 +151,7 @@
               // valid java identifiers.  Thus the following code.
   
               // java port <--> wsdl port mapping
  +            String portXmlName = p.getName();
               String portName = (String) bEntry.getDynamicVar(JavaServiceWriter.PORT_NAME
+ ":" + p.getName());
               if (portName == null) {
                   portName = p.getName();
  @@ -170,6 +172,7 @@
               }
   
               getPortIfaces.add(bindingType);
  +            getPortPortXmlNames.add(portXmlName);
               getPortStubClasses.add(stubClass);
               getPortPortNames.add(portName);
   
  @@ -238,7 +241,7 @@
   
               String wsddServiceName = portName + "WSDDServiceName";
   
  -            writeWSDDServiceNameInfo(pw, wsddServiceName, portName);
  +            writeWSDDServiceNameInfo(pw, wsddServiceName, portName, portXmlName);
               writeGetPortName(pw, bindingType, portName);
               writeGetPortNameURL(pw, bindingType, portName, stubClass,
                       wsddServiceName);
  @@ -247,9 +250,9 @@
   
           writeGetPortClass(pw, getPortIfaces, getPortStubClasses,
                   getPortPortNames, printGetPortNotice);
  -        writeGetPortQNameClass(pw, getPortPortNames);
  +        writeGetPortQNameClass(pw, getPortPortNames, getPortPortXmlNames);
           writeGetServiceName(pw, sEntry.getQName());
  -        writeGetPorts(pw, getPortPortNames);
  +        writeGetPorts(pw, sEntry.getQName().getNamespaceURI(), getPortPortXmlNames);
           writeSetEndpointAddress(pw, getPortPortNames);
       }    // writeFileBody
   
  @@ -289,12 +292,12 @@
        */
       protected void writeWSDDServiceNameInfo(PrintWriter pw,
                                               String wsddServiceName,
  -                                            String portName) {
  +                                            String portName, String portXmlName) {
   
           // Write the private WSDD service name field
           pw.println("    // " + Messages.getMessage("wsddServiceName00"));
           pw.println("    private java.lang.String " + wsddServiceName + " = \""
  -                + portName + "\";");
  +                + portXmlName + "\";");        
           pw.println();
   
           // Write the public accessors for the WSDD service name
  @@ -461,7 +464,8 @@
        * @param getPortPortNames 
        */
       protected void writeGetPortQNameClass(PrintWriter pw,
  -                                          Vector getPortPortNames) {
  +                                          Vector getPortPortNames,
  +            Vector getPortPortXmlNames) {
   
           pw.println("    /**");
           pw.println("     * " + Messages.getMessage("getPortDoc00"));
  @@ -479,8 +483,9 @@
   
           for (int i = 0; i < getPortPortNames.size(); ++i) {
               String portName = (String) getPortPortNames.get(i);
  +            String portXmlName = (String) getPortPortXmlNames.get(i);
   
  -            pw.println("if (\"" + portName + "\".equals(inputPortName)) {");
  +            pw.println("if (\"" + portXmlName + "\".equals(inputPortName)) {");
               pw.println("            return get" + portName + "();");
               pw.println("        }");
               pw.print("        else ");
  @@ -517,7 +522,7 @@
        * @param pw        
        * @param portNames 
        */
  -    protected void writeGetPorts(PrintWriter pw, Vector portNames) {
  +    protected void writeGetPorts(PrintWriter pw, String namespaceURI, Vector portNames)
{
   
           pw.println("    private java.util.HashSet ports = null;");
           pw.println();
  @@ -526,8 +531,8 @@
           pw.println("            ports = new java.util.HashSet();");
   
           for (int i = 0; i < portNames.size(); ++i) {
  -            pw.println("            ports.add(new javax.xml.namespace.QName(\""
  -                    + portNames.get(i) + "\"));");
  +            pw.println("            ports.add(new javax.xml.namespace.QName(\"" + 
  +                    namespaceURI + "\", \"" + portNames.get(i) + "\"));");
           }
   
           pw.println("        }");
  
  
  

Mime
View raw message