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 di...@apache.org on 2002/09/26 13:51:37 UTC

cvs commit: xml-axis/java/test/wsdl/esr esr.wsdl EsrTestBindingImpl.java EsrTestServiceTestCase.java

dims        2002/09/26 04:51:37

  Modified:    java/test/wsdl/esr esr.wsdl EsrTestBindingImpl.java
                        EsrTestServiceTestCase.java
  Log:
  Adding test case for 12753 - problem while deserializing output params based on WSDL (3 in params, 2 out params) in the client; org.xml.sax.SAXException: Bad types (double -> class java.lang.String)
  
  Note:
  Seems like the fix for 12626 fixed this as well.
  
  Revision  Changes    Path
  1.2       +28 -0     xml-axis/java/test/wsdl/esr/esr.wsdl
  
  Index: esr.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/esr/esr.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- esr.wsdl	25 Sep 2002 21:00:38 -0000	1.1
  +++ esr.wsdl	26 Sep 2002 11:51:37 -0000	1.2
  @@ -20,6 +20,15 @@
       <part name='echoVal' type='xsd:short'/>
       <part name='sqrtVal' type='xsd:double'/>
     </message>
  +  <message name='EsrTest.esrRequest2'> 
  +    <part name='bstrSAH' type='xsd:string'/>
  +    <part name='bstrSUH' type='xsd:string'/>
  +    <part name='value' type='xsd:short'/>
  +  </message>
  +  <message name='EsrTest.esrResponse2'>
  +    <part name='echoVal' type='xsd:short'/>
  +    <part name='sqrtVal' type='xsd:double'/>
  +  </message>
   
     <!-- port type declns -->
     <portType name='EsrTest'>
  @@ -27,6 +36,10 @@
         <input message='tns:EsrTest.esrRequest' />
         <output message='tns:EsrTest.esrResponse' />
       </operation>
  +    <operation name='esrInOut2' parameterOrder='bstrSAH bstrSUH value echoVal sqrtVal'>
  +      <input message='tns:EsrTest.esrRequest2' />
  +      <output message='tns:EsrTest.esrResponse2' />
  +    </operation>
     </portType>
   
     <!-- binding declns -->
  @@ -35,6 +48,21 @@
           style="rpc"
           transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="esrInOut">
  +      <soap:operation soapAction=""/>
  +      <input>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </input>
  +      <output>
  +        <soap:body
  +            use="encoded"
  +            namespace=""
  +            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  +      </output>
  +    </operation>
  +    <operation name="esrInOut2">
         <soap:operation soapAction=""/>
         <input>
           <soap:body
  
  
  
  1.2       +8 -0      xml-axis/java/test/wsdl/esr/EsrTestBindingImpl.java
  
  Index: EsrTestBindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/esr/EsrTestBindingImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EsrTestBindingImpl.java	25 Sep 2002 21:00:38 -0000	1.1
  +++ EsrTestBindingImpl.java	26 Sep 2002 11:51:37 -0000	1.2
  @@ -11,4 +11,12 @@
           echoVal.value = (short)value;
           sqrtVal.value = Math.sqrt(value);
       }
  +    public void esrInOut2(java.lang.String bstrSAH, java.lang.String bstrSUH, short value, javax.xml.rpc.holders.ShortHolder echoVal, javax.xml.rpc.holders.DoubleHolder sqrtVal) throws java.rmi.RemoteException
  +    {
  +        echoVal.value = value;
  +        sqrtVal.value = Math.sqrt( (double) value );
  +        if(Double.isNaN(sqrtVal.value)) {
  +          throw org.apache.axis.AxisFault.makeFault(new Exception("arg cannot be < 0"));
  +        }
  +    }
   }
  
  
  
  1.2       +61 -0     xml-axis/java/test/wsdl/esr/EsrTestServiceTestCase.java
  
  Index: EsrTestServiceTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/esr/EsrTestServiceTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EsrTestServiceTestCase.java	25 Sep 2002 21:00:38 -0000	1.1
  +++ EsrTestServiceTestCase.java	26 Sep 2002 11:51:37 -0000	1.2
  @@ -73,4 +73,65 @@
           }
   
       }
  +    
  +    public void test1EsrTestEsrInOut2() {
  +        // Using WSDL file to make a SOAP call
  +        try {
  +            String thisHost = SimpleAxisWorker.getLocalHost();
  +            String thisPort = System.getProperty("test.functional.ServicePort", "8080");
  +
  +            //load wsdl file
  +            String wsdlLocation = "http://" + thisHost + ":" + thisPort + "/axis/services/EsrTest?WSDL";
  +            javax.xml.rpc.Service svc =
  +                    new org.apache.axis.client.Service(
  +                            wsdlLocation,
  +                            new javax.xml.namespace.QName("urn:esr.wsdl.test",
  +                                    "EsrTestService")
  +                    );
  +			
  +            //setting up the call
  +            javax.xml.rpc.Call call = svc.createCall(
  +                    new javax.xml.namespace.QName("urn:esr.wsdl.test",
  +                            "EsrTest"),
  +                    new javax.xml.namespace.QName("urn:esr.wsdl.test",
  +                                    "esrInOut2")
  +            );
  +			
  +			//init in params
  +			Object[] soapInParams = new Object[] { 
  +                                              "token1",
  +                                              "token2",
  +                                              new Short((short)5) };
  +            
  +            //calling soap service
  +            Object ret = call.invoke(soapInParams);
  +			
  +            //printing output params
  +            java.util.Map outParams = call.getOutputParams();
  +
  +            // Debug code if you need it
  +            /*
  +            java.util.Collection outs = outParams.values();
  +            java.util.Iterator it = outs.iterator();
  +            int i = 1;
  +            while (it.hasNext()) {
  +                System.out.println(i++ + ". " + it.next().toString());
  +            }
  +            */
  +
  +            // Expecting a short and a double back
  +            assertEquals("Number of output parameters is wrong", outParams.size(), 2);
  +            Object s = outParams.get(new QName("echoVal"));
  +            assertNotNull("echoVal paramter is null", s);
  +            assertEquals("echoVal parameter is incorrect", (Short)s, new Short((short) 5) );
  +            Object sq = outParams.get(new QName("sqrtVal"));
  +            assertNotNull("sqrtVal paramter is null", sq);
  +            assertEquals("sqrtVal parameter is incorrect", ((Double)sq).doubleValue(), Math.sqrt(5), 0.001D );
  +
  +        } catch (Exception e) {
  +            e.printStackTrace(System.out);
  +            throw new junit.framework.AssertionFailedError("Exception caught: " + e);
  +        }
  +
  +    }
   }