dims        2003/07/28 09:31:06

  Modified:    java/src/org/apache/axis/wsdl/fromJava Emitter.java
                        Types.java
               java/src/org/apache/axis/message RPCParam.java
  Added:       java/samples/math build.xml deploy.wsdd Math.java
                        MathService.cs undeploy.wsdd
  Log:
  Fix for Bug 21930 - Net not able to serialize data with doc/literal style
  
  Notes:
  - Added a samples/math example. See MathService.cs that was generated by .NET's 
WSDL.EXE.
  
  Revision  Changes    Path
  1.1                  xml-axis/java/samples/math/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0" ?>
  <!DOCTYPE project [
          <!ENTITY properties SYSTEM "file:../../xmls/properties.xml">
          <!ENTITY paths  SYSTEM "file:../../xmls/path_refs.xml">
          <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml">
          <!ENTITY taskdefs_post_compile SYSTEM 
"file:../../xmls/taskdefs_post_compile.xml">
          <!ENTITY targets SYSTEM "file:../../xmls/targets.xml">
  ]>
  
  <!-- ===================================================================
  <description>
     Test/Sample Component file for Axis
  
  Notes:
     This is a build file for use with the Jakarta Ant build tool.
  
  Prerequisites:
  
     jakarta-ant from http://jakarta.apache.org
  
  Build Instructions:
     To compile
          ant compile
     To execute
          ant run
  
  Author:
    Matt Seibert [EMAIL PROTECTED]
  
  Copyright:
    Copyright (c) 2002-2003 Apache Software Foundation.
  </description>
  ==================================================================== -->
  
  <project default="compile">
  <property name="axis.home" location="../.." />
  <property name="componentName" value="samples/math" />
  
          &properties;
          &paths;
          &taskdefs;
        &taskdefs_post_compile;
        &targets;
  
  <target name="clean"/>
  
  <target name="copy" depends="setenv"/>
  
  <target name="compile" depends="copy">
  
    <!-- Compile the echo sample generated java files -->
    <javac srcdir="${build.dir}/work" destdir="${build.dest}" debug="${debug}" 
fork="${javac.fork}">
       <classpath refid="classpath" />
       <include name="samples/math/**.java" />
    </javac>
  
    <javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}" 
fork="${javac.fork}">
      <classpath>
          <path refid="classpath"/>
      </classpath>
      <include name="samples/math/**/*.java"/>
    </javac>
  </target>
  
  <target name="deploy"/>
  
  <target name="run"/>
  
  <target name="undeploy"/>
  
  </project>
  
  
  
  1.1                  xml-axis/java/samples/math/deploy.wsdd
  
  Index: deploy.wsdd
  ===================================================================
  <deployment
      xmlns="http://xml.apache.org/axis/wsdd/";
      xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
    <service name="Math" provider="java:RPC" style="wrapped" use="literal">
        <parameter name="wsdlTargetNamespace" value="http://math.samples/"/>
        <parameter name="className" value="samples.math.Math"/>
        <operation name="add" qname="operNS:Add" 
                   xmlns:operNS="http://math.samples/"; 
                   returnQName="retNS:AddResult" 
                   xmlns:retNS="http://math.samples/"; 
                   returnType="rtns:float" 
                   xmlns:rtns="http://www.w3.org/2001/XMLSchema"; >
          <parameter qname="pns:A" xmlns:pns="http://math.samples/"; 
                     type="tns:float" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
          <parameter qname="pns:B" xmlns:pns="http://math.samples/"; 
                     type="tns:float" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
        </operation>
        <parameter name="allowedMethods" value="add"/>
    </service>
  </deployment>
  
  
  
  1.1                  xml-axis/java/samples/math/Math.java
  
  Index: Math.java
  ===================================================================
  package samples.math;
  
  public class Math {
      public float add(float a, float b) {
          return a+b;
      }
  }
  
  
  
  1.1                  xml-axis/java/samples/math/MathService.cs
  
  Index: MathService.cs
  ===================================================================
  //------------------------------------------------------------------------------
  // <autogenerated>
  //     This code was generated by a tool.
  //     Runtime Version: 1.1.4322.573
  //
  //     Changes to this file may cause incorrect behavior and will be lost if 
  //     the code is regenerated.
  // </autogenerated>
  //------------------------------------------------------------------------------
  
  // 
  // This source code was auto-generated by wsdl, Version=1.1.4322.573.
  // 
  using System.Diagnostics;
  using System.Xml.Serialization;
  using System;
  using System.Web.Services.Protocols;
  using System.ComponentModel;
  using System.Web.Services;
  
  
  /// <remarks/>
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Web.Services.WebServiceBindingAttribute(Name="MathSoapBinding", 
Namespace="http://math.samples/";)]
  public class MathService : System.Web.Services.Protocols.SoapHttpClientProtocol {
      
      /// <remarks/>
      public MathService() {
          this.Url = "http://172.16.17.142:8080/axis/services/Math";;
      }
      
      /// <remarks/>
      [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", 
RequestElementName="Add", RequestNamespace="http://math.samples/";, 
ResponseElementName="AddResponse", ResponseNamespace="http://math.samples/";, 
Use=System.Web.Services.Description.SoapBindingUse.Literal, 
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
      [return: System.Xml.Serialization.XmlElementAttribute("AddResult")]
      public System.Single add(System.Single A, System.Single B) {
          object[] results = this.Invoke("add", new object[] {
                      A,
                      B});
          return ((System.Single)(results[0]));
      }
      
      /// <remarks/>
      public System.IAsyncResult Beginadd(System.Single A, System.Single B, 
System.AsyncCallback callback, object asyncState) {
          return this.BeginInvoke("add", new object[] {
                      A,
                      B}, callback, asyncState);
      }
      
      /// <remarks/>
      public System.Single Endadd(System.IAsyncResult asyncResult) {
          object[] results = this.EndInvoke(asyncResult);
          return ((System.Single)(results[0]));
      }
      
      public static void Main(String[] args) {
          MathService m = new MathService();
          Console.WriteLine(m.add(4,5));
      }
  }
  
  
  
  1.1                  xml-axis/java/samples/math/undeploy.wsdd
  
  Index: undeploy.wsdd
  ===================================================================
  <undeployment
      xmlns="http://xml.apache.org/axis/wsdd/";>
    <service name="Math"/>
  </undeployment>
  
  
  
  1.97      +3 -3      xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- Emitter.java      13 Jul 2003 15:07:11 -0000      1.96
  +++ Emitter.java      28 Jul 2003 16:31:05 -0000      1.97
  @@ -1107,7 +1107,7 @@
       {
           Message msg = def.createMessage();
   
  -        QName qName = createMessageName(def, oper.getName() + "Request");
  +        QName qName = createMessageName(def, getRequestQName(oper).getLocalPart() + 
"Request");
           
           msg.setQName(qName);
           msg.setUndefined(false);
  @@ -1155,7 +1155,7 @@
       private void qualifyOperation(OperationDesc oper) {
           if (style == Style.WRAPPED && use == Use.LITERAL) {
               QName qname = oper.getElementQName();
  -            if (qname != null) {
  +            if (qname == null) {
                   qname = new QName(intfNS, oper.getName()); 
               } else if (qname.getNamespaceURI().equals("")) {
                   qname = new QName(intfNS,qname.getLocalPart());
  @@ -1241,7 +1241,7 @@
       {
           Message msg = def.createMessage();
   
  -        QName qName = createMessageName(def, desc.getName() + "Response");
  +        QName qName = createMessageName(def, getResponseQName(desc).getLocalPart());
   
           msg.setQName(qName);
           msg.setUndefined(false);
  
  
  
  1.80      +4 -0      xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
  
  Index: Types.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- Types.java        13 Jul 2003 15:07:11 -0000      1.79
  +++ Types.java        28 Jul 2003 16:31:05 -0000      1.80
  @@ -734,6 +734,10 @@
                   importElem.setAttribute("namespace", 
Constants.URI_DEFAULT_SOAP_ENC);
               }
               
  +            if(serviceDesc.getStyle() == Style.DOCUMENT || serviceDesc.getStyle() 
== Style.WRAPPED ) {
  +                schemaElem.setAttribute("elementFormDefault","qualified");
  +            }
  +            
               writeTypeNamespace(namespaceURI);
           }
           schemaElem.appendChild(element);
  
  
  
  1.56      +10 -5     xml-axis/java/src/org/apache/axis/message/RPCParam.java
  
  Index: RPCParam.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCParam.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- RPCParam.java     24 Jun 2003 01:09:30 -0000      1.55
  +++ RPCParam.java     28 Jul 2003 16:31:06 -0000      1.56
  @@ -214,11 +214,16 @@
                   javaType = paramDesc.getJavaType() != null ?
                       paramDesc.getJavaType(): javaType;
               } else if (!(javaType.equals(paramDesc.getJavaType()))) {
  -                if (!(javaType.equals(
  -                        JavaUtils.getHolderValueType(paramDesc.getJavaType()))))
  -                    // This must (assumedly) be a polymorphic type - in ALL
  -                    // such cases, we must send an xsi:type attribute.
  -                    wantXSIType = Boolean.TRUE;
  +                Class clazz = JavaUtils.getPrimitiveClass(javaType);
  +                if(clazz == null || !clazz.equals(paramDesc.getJavaType())) {
  +                    if (!(javaType.equals(
  +                            
JavaUtils.getHolderValueType(paramDesc.getJavaType())))) {
  +                        
  +                        // This must (assumedly) be a polymorphic type - in ALL
  +                        // such cases, we must send an xsi:type attribute.
  +                        wantXSIType = Boolean.TRUE;
  +                    }
  +                }
               }
               xmlType = paramDesc.getTypeQName();
           }
  
  
  

Reply via email to