gdaniels    2003/02/07 10:02:56

  Modified:    java/test/wsdl/soap12/assertion
                        WhiteMesaSoap12TestSvcTestCase.java
               java/test/wsdl/soap12/additional
                        WhiteMesaSoap12AddTestSvcTestCase.java
               java/src/org/apache/axis/message SOAPHeaderElement.java
               java/src/org/apache/axis/soap SOAP12Constants.java
               java/samples/echo InteropTestSoapBindingImpl.java
               java/src/org/apache/axis Constants.java
  Log:
  More work on SOAP 1.2 client interop tests.
  
  As it turned out, the generated test case for the XMLP additional tests was
  pretty useless, since all the test require some futzing around with the
  envelope (adding headers, removing parameters, etc).  Hence this has been
  rewritten ground-up and most of the xmlp-1 through xmlp-19 tests are
  implemented.
  
  Add a "relay" field to the SOAPHeaderElement class for SOAP 1.2's relay
  attribute.
  
  Deprecate URI_SOAP12_NEXT_ACTOR in favor of URI_SOAP12_NEXT_ROLE
  
  Add fault subcode constants for bad arguments and procedure not found
  
  Revision  Changes    Path
  1.4       +1 -1      
xml-axis/java/test/wsdl/soap12/assertion/WhiteMesaSoap12TestSvcTestCase.java
  
  Index: WhiteMesaSoap12TestSvcTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/test/wsdl/soap12/assertion/WhiteMesaSoap12TestSvcTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WhiteMesaSoap12TestSvcTestCase.java       3 Feb 2003 13:54:46 -0000       1.3
  +++ WhiteMesaSoap12TestSvcTestCase.java       7 Feb 2003 18:02:55 -0000       1.4
  @@ -568,7 +568,7 @@
        * @throws Exception
        */ 
       public void testT1() throws Exception {
  -        testEchoOkHeaderWithEmptyBody(Constants.URI_SOAP12_NEXT_ACTOR);
  +        testEchoOkHeaderWithEmptyBody(Constants.URI_SOAP12_NEXT_ROLE);
       }
   
       /**
  
  
  
  1.5       +253 -250  
xml-axis/java/test/wsdl/soap12/additional/WhiteMesaSoap12AddTestSvcTestCase.java
  
  Index: WhiteMesaSoap12AddTestSvcTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/test/wsdl/soap12/additional/WhiteMesaSoap12AddTestSvcTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WhiteMesaSoap12AddTestSvcTestCase.java    3 Feb 2003 13:54:46 -0000       1.4
  +++ WhiteMesaSoap12AddTestSvcTestCase.java    7 Feb 2003 18:02:55 -0000       1.5
  @@ -7,18 +7,22 @@
   
   package test.wsdl.soap12.additional;
   
  -import org.apache.axis.Constants;
   import org.apache.axis.AxisFault;
  -import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.soap.SOAPConstants;
  -import org.apache.axis.soap.SOAP12Constants;
  +import org.apache.axis.Constants;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.encoding.ser.BeanDeserializerFactory;
  +import org.apache.axis.encoding.ser.BeanSerializerFactory;
   import org.apache.axis.enum.Style;
   import org.apache.axis.enum.Use;
  -import org.apache.axis.client.Call;
  -import org.apache.axis.client.Service;
  +import org.apache.axis.message.SOAPEnvelope;
  +import org.apache.axis.message.SOAPHeaderElement;
  +import org.apache.axis.soap.SOAP12Constants;
  +import org.apache.axis.soap.SOAPConstants;
  +import test.wsdl.soap12.additional.xsd.SOAPStruct;
   
   import javax.xml.namespace.QName;
   import javax.xml.rpc.ParameterMode;
  +import java.util.Vector;
   
   /**
    * Additional SOAP 1.2 tests.
  @@ -34,13 +38,49 @@
   public class WhiteMesaSoap12AddTestSvcTestCase extends junit.framework.TestCase {
       public static final String STRING_VAL = "SOAP 1.2 is cool!";
       public static final float FLOAT_VAL = 3.14F;
  +    public static final Float FLOAT_OBJVAL = new Float(FLOAT_VAL);
       public static final int INT_VAL = 69;
  +    public static final Integer INT_OBJVAL = new Integer(INT_VAL);
  +
  +    public final String TEST_NS = "http://soapinterop.org/";;
  +    public final QName ECHO_STRING_QNAME = new QName(TEST_NS, "echoString");
       
  +    // Endpoints
  +    // TODO : Shouldn't be hardcoded!
  +//    public static final String HOST = "http://localhost:8080";;
  +    public static final String HOST = "http://www.whitemesa.net";;
  +    public static final String RPC_ENDPOINT = HOST + "/soap12/add-test-rpc";
  +    public static final String DOC_ENDPOINT = HOST + "/soap12/add-test-doc";
  +    public static final String DOC_INT_ENDPOINT = HOST + "/soap12/add-test-doc-int";
  +    private QName SOAPSTRUCT_QNAME = new QName("http://example.org/ts-tests/xsd";, 
"SOAPStruct");
  +
       public WhiteMesaSoap12AddTestSvcTestCase(java.lang.String name) {
           super(name);
       }
       
       /**
  +     * Test xmlp-1 - call echoString with no arguments (even though it expects
  +     * one).  Confirm bad arguments fault from endpoint.
  +     * 
  +     * @throws Exception
  +     */ 
  +    public void testXMLP1() throws Exception {
  +        Call call = new Call(RPC_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
  +        try {
  +            call.invoke(ECHO_STRING_QNAME, null);
  +        } catch (AxisFault fault) {
  +            assertEquals(Constants.FAULT_SOAP12_SENDER, fault.getFaultCode());
  +            QName [] subCodes = fault.getFaultSubCodes();
  +            assertNotNull(subCodes);
  +            assertEquals(1, subCodes.length);
  +            assertEquals(Constants.FAULT_SUBCODE_BADARGS, subCodes[0]);
  +            return;
  +        }
  +        fail("Didn't catch expected fault");
  +    }
  +    
  +    /**
        * Test xmlp-2, using the GET webmethod.
        * 
        * @throws Exception
  @@ -77,29 +117,64 @@
           // gonna for now.
       }
       
  -    public void test1Soap12AddTestDocPortEchoString() throws Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
  +    public void textXMLP4() throws Exception {
  +        Call call = new Call(RPC_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
  +        call.registerTypeMapping(SOAPStruct.class, SOAPSTRUCT_QNAME,
  +                                 new BeanSerializerFactory(SOAPStruct.class, 
SOAPSTRUCT_QNAME),
  +                                 new BeanDeserializerFactory(SOAPStruct.class, 
SOAPSTRUCT_QNAME));
  +        call.addParameter(new QName("", "inputFloat"),
  +                          Constants.XSD_FLOAT, ParameterMode.IN);
  +        call.addParameter(new QName("", "inputInteger"),
  +                          Constants.XSD_INT, ParameterMode.IN);
  +        call.addParameter(new QName("", "inputString"),
  +                          Constants.XSD_STRING, ParameterMode.IN);
  +        call.setReturnType(SOAPSTRUCT_QNAME);
  +        SOAPStruct ret = (SOAPStruct)call.invoke(
  +                new QName(TEST_NS, "echoSimpleTypesAsStruct"),
  +                new Object [] {
  +                    new Float(FLOAT_VAL),
  +                    new Integer(INT_VAL),
  +                    STRING_VAL 
  +                });
  +        assertEquals(STRING_VAL, ret.getVarString());
  +        assertEquals(FLOAT_VAL, ret.getVarFloat(), 0.0004F);
  +        assertEquals(INT_VAL, ret.getVarInt());
  +    }
  +    
  +    public void testXMLP5() throws Exception {
  +        Call call = new Call(RPC_ENDPOINT);
           try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocPort();
  +            call.invoke(new QName(TEST_NS, "echoVoid"), null);        
  +        } catch (AxisFault fault) {
  +            // Got the expected Fault - make sure it looks right
  +            assertEquals(Constants.FAULT_VERSIONMISMATCH, fault.getFaultCode());
  +            return;
           }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  +        fail("Didn't catch expected fault");
  +    }
  +    
  +    public void testXMLP6() throws Exception {
  +        Call call = new Call(RPC_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
  +        SOAPHeaderElement unknownHeader =
  +                new SOAPHeaderElement("http://example.org";,
  +                                      "unknown",
  +                                      "Nobody understands me!");
  +        unknownHeader.setMustUnderstand(true);
  +        call.addHeader(unknownHeader);
  +        try {
  +            call.invoke(new QName(TEST_NS, "echoVoid"), null);        
  +        } catch (AxisFault fault) {
  +            // Got the expected Fault - make sure it looks right
  +            assertEquals(Constants.FAULT_SOAP12_MUSTUNDERSTAND,
  +                         fault.getFaultCode());
  +            return;
           }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        java.lang.String value = null;
  -        value = binding.echoString(STRING_VAL);
  -        assertEquals(STRING_VAL, value);
  +        fail("Didn't catch expected fault");        
       }
  -
  -    public void test2Soap12AddTestDocPortEchoSenderFault() throws Exception {
  +    
  +    public void testXMLP7() throws Exception {
           test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
           try {
               binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  @@ -129,8 +204,8 @@
           
           fail("Should have received sender fault!");
       }
  -
  -    public void test3Soap12AddTestDocPortEchoReceiverFault() throws Exception {
  +    
  +    public void testXMLP8() throws Exception {
           test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
           try {
               binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  @@ -160,253 +235,181 @@
           
           fail("Should have received receiver fault!");
       }
  -
  -    public void test4Soap12AddTestRpcPortEchoVoid() throws Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestRpcPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        binding.echoVoid();
  +    
  +    public void testXMLP9() throws Exception {
  +        
       }
  -
  -    public void test5Soap12AddTestRpcPortEchoSimpleTypesAsStruct() throws Exception 
{
  -        test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestRpcPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        test.wsdl.soap12.additional.xsd.SOAPStruct value = null;
  -        value = binding.echoSimpleTypesAsStruct(STRING_VAL, INT_VAL, FLOAT_VAL);
  -        assertEquals("Float values differ", FLOAT_VAL, value.getVarFloat(), 
0.000001F);
  -        assertEquals("Int values differ", INT_VAL, value.getVarInt());
  -        assertEquals("String values differ", STRING_VAL, value.getVarString());
  +    
  +    public void testXMLP11() throws Exception {
  +        
       }
  -
  -    public void test6Soap12AddTestRpcPortEchoString() throws Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub binding;
  +    
  +    public void testXMLP12() throws Exception {
  +        Call call = new Call(RPC_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
  +        call.addParameter(new QName("inputInteger"), Constants.XSD_INT, 
ParameterMode.IN);
           try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestRpcPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  +            call.invoke(new QName(TEST_NS, "unknownFreakyMethod"), new Object [] { 
new Integer(5) });
  +        } catch (AxisFault fault) {
  +            assertEquals(Constants.FAULT_SOAP12_SENDER, fault.getFaultCode());
  +            QName [] subCodes = fault.getFaultSubCodes();
  +            assertNotNull(subCodes);
  +            assertEquals(1, subCodes.length);
  +            assertEquals(Constants.FAULT_SUBCODE_PROC_NOT_PRESENT, subCodes[0]);
  +            return;
           }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        java.lang.String value = null;
  -        value = binding.echoString(STRING_VAL);
  -        assertEquals(STRING_VAL, value);
  +        fail("Didn't catch expected fault");
       }
  -
  -    public void test7Soap12AddTestRpcPortEchoSimpleTypesAsStructOfSchemaTypes() 
throws Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestRpcPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        test.wsdl.soap12.additional.xsd.SOAPStructTypes value = null;
  -        value = binding.
  -                  echoSimpleTypesAsStructOfSchemaTypes(STRING_VAL,
  -                                                       new Integer(INT_VAL),
  -                                                       new Float(FLOAT_VAL),
  -                                                       "another string");
  -        assertEquals(Constants.XSD_STRING, value.getType1());
  -        assertEquals(Constants.XSD_INT, value.getType2());
  -        assertEquals(Constants.XSD_FLOAT, value.getType3());
  -        assertEquals(Constants.XSD_ANYTYPE, value.getType4());
  +    
  +    /**
  +     * Test xmlp-13 : doc/lit echoString which sends back the original
  +     * message via a transparent "forwarding intermediary"
  +     * 
  +     */ 
  +    public void testXMLP13() throws Exception {
  +        
       }
   
  -    public void test8Soap12AddTestRpcPortEchoInteger() throws Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestRpcBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestRpcPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        int value;
  -        value = binding.echoInteger(INT_VAL);
  -        assertEquals(INT_VAL, value);
  +    /**
  +     * Test xmlp-14 : doc/lit echoString which sends back the original
  +     * message via an "active intermediary" (translating the string
  +     * to uppercase)
  +     * 
  +     */ 
  +    public void testXMLP14() throws Exception {
  +        
       }
       
  -    // getTime is a notification style operation and is unsupported.
  -    // getTime is a notification style operation and is unsupported.
  -    public void test9Soap12AddTestDocUpperPortEchoString() throws Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  -                    new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocUpperPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  +    public void testXMLP15() throws Exception {
  +        String HEADER_VAL = "I'm going to be discarded!";
  +        String HEADER_NS = "http://test-xmlp-15";;
  +        String HEADER_NAME = "unknown";
           
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -        
  -        // Test operation
  -        java.lang.String value = null;
  -        value = binding.echoString(STRING_VAL);
  -        assertEquals(STRING_VAL.toUpperCase(), value);
  -    }
  -
  -    public void test10Soap12AddTestDocUpperPortEchoSenderFault() throws Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocUpperPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  +        Call call = new Call(DOC_INT_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
   
  -        // Test operation
  -        binding.echoSenderFault(new java.lang.String());
  -        // TBD - validate results
  +        SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME);
  +        header.setRole(Constants.URI_SOAP12_NEXT_ROLE);
  +        header.setObjectValue(HEADER_VAL);
  +        call.addHeader(header);
  +        
  +        call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" });
  +        
  +        SOAPEnvelope respEnv = 
call.getMessageContext().getResponseMessage().getSOAPEnvelope();
  +        
  +        // Confirm we got no headers back
  +        Vector headers = respEnv.getHeaders();
  +        assertTrue("Headers Vector wasn't empty", headers.isEmpty());
       }
  +    
  +    public void testXMLP16() throws Exception {
  +        String HEADER_VAL = "I'm going all the way through!";
  +        String HEADER_NS = "http://test-xmlp-16";;
  +        String HEADER_NAME = "unknown";
  +        QName HEADER_QNAME = new QName(HEADER_NS, HEADER_NAME);
  +        
  +        Call call = new Call(DOC_INT_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
   
  -    public void test11Soap12AddTestDocUpperPortEchoReceiverFault() throws Exception 
{
  -        test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocUpperPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        binding.echoReceiverFault(new java.lang.String());
  -        // TBD - validate results
  +        SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME);
  +        header.setRole(Constants.URI_SOAP12_NONE_ROLE);
  +        header.setObjectValue(HEADER_VAL);
  +        call.addHeader(header);
  +        
  +        call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" });
  +        
  +        SOAPEnvelope respEnv = 
call.getMessageContext().getResponseMessage().getSOAPEnvelope();
  +        
  +        // Confirm we got our header back
  +        Vector headers = respEnv.getHeaders();
  +        assertEquals(1, headers.size());
  +        SOAPHeaderElement respHeader = (SOAPHeaderElement)headers.get(0);
  +        assertEquals(Constants.URI_SOAP12_NONE_ROLE, respHeader.getRole());
  +        assertEquals(HEADER_QNAME, respHeader.getQName());
  +        assertEquals(HEADER_VAL, respHeader.getValue());
       }
       
  -    // getTime is a notification style operation and is unsupported.
  -    public void test12Soap12AddTestDocIntermediaryPortEchoString() throws Exception 
{
  -        test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  -                    new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocIntermediaryPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  +    public void testXMLP17() throws Exception {
  +        String HEADER_VAL = "I'm going all the way through!";
  +        String HEADER_NS = "http://test-xmlp-17";;
  +        String HEADER_NAME = "seekrit";
  +        QName HEADER_QNAME = new QName(HEADER_NS, HEADER_NAME);
           
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  +        Call call = new Call(DOC_INT_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
  +
  +        SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME);
  +        header.setRole(Constants.URI_SOAP12_ULTIMATE_ROLE);
  +        header.setObjectValue(HEADER_VAL);
  +        call.addHeader(header);
           
  -        // Test operation
  -        java.lang.String value = null;
  -        value = binding.echoString(STRING_VAL);
  -        assertEquals(STRING_VAL, value);
  +        call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" });
  +        
  +        SOAPEnvelope respEnv = 
call.getMessageContext().getResponseMessage().getSOAPEnvelope();
  +        
  +        // Confirm we got a single header back, targeted at the ultimate
  +        // receiver
  +        Vector headers = respEnv.getHeaders();
  +        assertEquals(1, headers.size());
  +        SOAPHeaderElement respHeader = (SOAPHeaderElement)headers.get(0);
  +        assertEquals(Constants.URI_SOAP12_ULTIMATE_ROLE, respHeader.getRole());
  +        assertEquals(HEADER_QNAME, respHeader.getQName());
  +        assertEquals(HEADER_VAL, respHeader.getValue());
       }
   
  -    public void test13Soap12AddTestDocIntermediaryPortEchoSenderFault() throws 
Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
  -        try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocIntermediaryPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  -        }
  -        assertNotNull("binding is null", binding);
  -
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  +    public void testXMLP18() throws Exception {
  +        String HEADER_VAL = "I'm going all the way through!";
  +        String HEADER_NS = "http://test-xmlp-17";;
  +        String HEADER_NAME = "seekrit";
  +        QName HEADER_QNAME = new QName(HEADER_NS, HEADER_NAME);
  +        
  +        Call call = new Call(DOC_INT_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
   
  -        // Test operation
  -        binding.echoSenderFault(new java.lang.String());
  -        // TBD - validate results
  +        SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME);
  +        header.setRole(Constants.URI_SOAP12_NEXT_ROLE);
  +        header.setRelay(true);
  +        header.setObjectValue(HEADER_VAL);
  +        call.addHeader(header);
  +        
  +        call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" });
  +        
  +        SOAPEnvelope respEnv = 
call.getMessageContext().getResponseMessage().getSOAPEnvelope();
  +        
  +        // Confirm we got a single header back, targeted at the ultimate
  +        // receiver
  +        Vector headers = respEnv.getHeaders();
  +        assertEquals(1, headers.size());
  +        SOAPHeaderElement respHeader = (SOAPHeaderElement)headers.get(0);
  +        assertEquals(Constants.URI_SOAP12_NEXT_ROLE, respHeader.getRole());
  +        assertTrue(respHeader.getRelay());
  +        assertEquals(HEADER_QNAME, respHeader.getQName());
  +        assertEquals(HEADER_VAL, respHeader.getValue());
       }
   
  -    public void test14Soap12AddTestDocIntermediaryPortEchoReceiverFault() throws 
Exception {
  -        test.wsdl.soap12.additional.Soap12AddTestDocBindingStub binding;
  +    public void testXMLP19() throws Exception {
  +        String HEADER_VAL = "I'm going to generate a fault!";
  +        String HEADER_NS = "http://test-xmlp-17";;
  +        String HEADER_NAME = "seekrit";
  +        
  +        Call call = new Call(DOC_INT_ENDPOINT);
  +        call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
  +
  +        SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS, HEADER_NAME);
  +        header.setRole(Constants.URI_SOAP12_NEXT_ROLE);
  +        header.setMustUnderstand(true);
  +        header.setObjectValue(HEADER_VAL);
  +        call.addHeader(header);
  +        
           try {
  -            binding = (test.wsdl.soap12.additional.Soap12AddTestDocBindingStub)
  -                          new 
test.wsdl.soap12.additional.WhiteMesaSoap12AddTestSvcLocator().getSoap12AddTestDocIntermediaryPort();
  -        }
  -        catch (javax.xml.rpc.ServiceException jre) {
  -            if(jre.getLinkedCause()!=null)
  -                jre.getLinkedCause().printStackTrace();
  -            throw new junit.framework.AssertionFailedError("JAX-RPC 
ServiceException caught: " + jre);
  +            call.invoke(ECHO_STRING_QNAME, new Object [] { "body string" });
  +        } catch (AxisFault fault) {
  +            // Got the expected Fault - make sure it looks right
  +            assertEquals(Constants.FAULT_SOAP12_MUSTUNDERSTAND,
  +                         fault.getFaultCode());
  +            return;
           }
  -        assertNotNull("binding is null", binding);
   
  -        // Time out after a minute
  -        binding.setTimeout(60000);
  -
  -        // Test operation
  -        binding.echoReceiverFault(new java.lang.String());
  -        // TBD - validate results
  +        fail("Didn't catch expected fault");        
       }
  -
   }
  
  
  
  1.20      +26 -1     xml-axis/java/src/org/apache/axis/message/SOAPHeaderElement.java
  
  Index: SOAPHeaderElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeaderElement.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SOAPHeaderElement.java    3 Feb 2003 02:31:46 -0000       1.19
  +++ SOAPHeaderElement.java    7 Feb 2003 18:02:56 -0000       1.20
  @@ -80,6 +80,7 @@
   
       protected String    actor = "";
       protected boolean   mustUnderstand = false;
  +    protected boolean   relay = false;
   
       public SOAPHeaderElement(String namespace, String localPart)
       {
  @@ -121,6 +122,12 @@
           if (actor == null) {
               actor = "";
           }
  +        
  +        if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
  +            String relayVal = elem.getAttributeNS(soapConstants.getEnvelopeURI(),
  +                                                  Constants.ATTR_RELAY);
  +            relay = ((relayVal != null) && (relayVal.equals("true") || 
relayVal.equals("1"))) ? true : false;
  +        }
       }
   
       public void setParentElement(SOAPElement parent) throws SOAPException {
  @@ -164,6 +171,12 @@
               actor = "";
           }
   
  +        if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
  +            String relayVal = attributes.getValue(soapConstants.getEnvelopeURI(),
  +                                                  Constants.ATTR_RELAY);
  +            relay = ((relayVal != null) && (relayVal.equals("true") || 
relayVal.equals("1"))) ? true : false;
  +        }
  +
           processed = false;
           alreadySerialized = true;
       }
  @@ -182,7 +195,14 @@
       public void setRole(String a) {
           actor = a ;
       }
  -    
  +
  +    public boolean getRelay() {
  +        return relay;
  +    }
  +    public void setRelay(boolean relay) {
  +        this.relay = relay;
  +    }
  +
       public void setProcessed(boolean value) {
           processed = value ;
       }
  @@ -212,6 +232,11 @@
               setAttribute(soapVer.getEnvelopeURI(),
                            Constants.ATTR_MUST_UNDERSTAND,
                            val);
  +            
  +            if (soapVer == SOAPConstants.SOAP12_CONSTANTS && relay) {
  +                setAttribute(soapVer.getEnvelopeURI(), Constants.ATTR_RELAY,
  +                             "true");
  +            }
           }
   
           super.outputImpl(context);
  
  
  
  1.11      +1 -1      xml-axis/java/src/org/apache/axis/soap/SOAP12Constants.java
  
  Index: SOAP12Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/soap/SOAP12Constants.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SOAP12Constants.java      7 Jan 2003 19:41:58 -0000       1.10
  +++ SOAP12Constants.java      7 Feb 2003 18:02:56 -0000       1.11
  @@ -117,7 +117,7 @@
        * Obtain the "next" role/actor URI
        */
       public String getNextRoleURI() {
  -        return Constants.URI_SOAP12_NEXT_ACTOR;
  +        return Constants.URI_SOAP12_NEXT_ROLE;
       }
   
       /**
  
  
  
  1.6       +3 -0      xml-axis/java/samples/echo/InteropTestSoapBindingImpl.java
  
  Index: InteropTestSoapBindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/InteropTestSoapBindingImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- InteropTestSoapBindingImpl.java   15 Sep 2002 19:16:16 -0000      1.5
  +++ InteropTestSoapBindingImpl.java   7 Feb 2003 18:02:56 -0000       1.6
  @@ -10,8 +10,11 @@
   
   package samples.echo;
   
  +import org.apache.axis.MessageContext;
  +
   public class InteropTestSoapBindingImpl implements samples.echo.InteropTestPortType 
{
       public java.lang.String echoString(java.lang.String inputString) throws 
java.rmi.RemoteException {
  +        
MessageContext.getCurrentContext().setProperty(echoHeaderStringHandler.ECHOHEADER_STRING_ID,
 "header text");
           return inputString;
       }
   
  
  
  
  1.114     +10 -1     xml-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- Constants.java    3 Feb 2003 13:54:46 -0000       1.113
  +++ Constants.java    7 Feb 2003 18:02:56 -0000       1.114
  @@ -274,8 +274,10 @@
       // Misc SOAP Namespaces / URIs
       public static final String URI_SOAP11_NEXT_ACTOR =
                                        "http://schemas.xmlsoap.org/soap/actor/next"; ;
  -    public static final String URI_SOAP12_NEXT_ACTOR =
  +    public static final String URI_SOAP12_NEXT_ROLE =
                                        
"http://www.w3.org/2002/12/soap-envelope/role/next";;
  +    /** @deprecated use URI_SOAP12_NEXT_ROLE */
  +    public static final String URI_SOAP12_NEXT_ACTOR = URI_SOAP12_NEXT_ROLE;
   
       public static final String URI_SOAP12_FAULT =
                                        "http://www.w3.org/2002/12/soap-faults";;
  @@ -462,6 +464,7 @@
       public static final String ATTR_ENCODING_STYLE  = "encodingStyle" ;
       public static final String ATTR_ACTOR           = "actor" ;
       public static final String ATTR_ROLE            = "role" ;
  +    public static final String ATTR_RELAY           = "relay" ;    
       public static final String ATTR_ROOT            = "root" ;
       public static final String ATTR_ID              = "id" ;
       public static final String ATTR_HREF            = "href" ;
  @@ -504,6 +507,12 @@
   
       public static final QName FAULT_SOAP12_RECEIVER =
                                     new QName(URI_SOAP12_ENV, "Receiver");
  +    
  +    // SOAP 1.2 Fault subcodes
  +    public static final QName FAULT_SUBCODE_BADARGS =
  +            new QName(URI_SOAP12_RPC, "BadArguments");
  +    public static final QName FAULT_SUBCODE_PROC_NOT_PRESENT =
  +            new QName(URI_SOAP12_RPC, "ProcedureNotPresent");
   
       // QNames
       //////////////////////////////////////////////////////////////////////////
  
  
  


Reply via email to