axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r509439 - in /webservices/axis/trunk/c: src/engine/client/ src/soap/ tests/auto_build/testcases/ tests/auto_build/testcases/client/cpp/ tests/auto_build/testcases/output/ tests/auto_build/testcases/tests/ tests/auto_build/testcases/wsdls/
Date Tue, 20 Feb 2007 06:57:02 GMT
Author: nadiramra
Date: Mon Feb 19 22:57:01 2007
New Revision: 509439

URL: http://svn.apache.org/viewvc?view=rev&rev=509439
Log:
AXISCPP-925 - one way messaging support.

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/OneWayOperationClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation.cpp.out
    webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation_ServerResponse.expected
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/OneWayOperation.xml
    webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.wsdl
    webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.xsd
Modified:
    webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp
    webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp
    webservices/axis/trunk/c/src/soap/SoapDeSerializer.h
    webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list

Modified: webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp?view=diff&rev=509439&r1=509438&r2=509439
==============================================================================
--- webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp (original)
+++ webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp Mon Feb 19 22:57:01 2007
@@ -177,7 +177,7 @@
     enum AE_LEVEL { AE_START = 1, AE_SERH, AE_GLH, AE_TRH, AE_SERV };
     int Status = AXIS_FAIL;
     int level = AE_START;
-
+    
     do
     {
         // Invoke client side service specific request handlers
@@ -221,9 +221,6 @@
         // Get header and body only if we are expecting a response
         if (!noResponse || m_pSoap->isThereResponseData())
         {
-            // There is response data, for one-way it must be a fault.
-            noResponse = false;
-            
             // version not supported set status to fail
             int nSoapVersion = m_pDZ->getVersion ();
             if (nSoapVersion == VERSION_LAST)     
@@ -231,6 +228,13 @@
 
             m_pDZ->getHeader ();
             m_pDZ->getBody ();
+            
+            // If one-way messaging and there is response data, then it must be a fault.

+            if (noResponse)
+            {
+                // initiate fault processing. This will result in an exception being thrown.
+                m_pDZ->initiateFault(NULL);
+            }
         }
     }
     while (0);

Modified: webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp?view=diff&rev=509439&r1=509438&r2=509439
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp (original)
+++ webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp Mon Feb 19 22:57:01 2007
@@ -429,6 +429,21 @@
     return AXIS_SUCCESS;
 }
 
+// Used for one-way message processing, to initiate a fault.
+void SoapDeSerializer::
+initiateFault (const AxisChar * pNamespace)
+{
+    // Will throw exception if failure in parser
+    if (AXIS_FAIL == getNextNode(true))
+        return;
+        
+    if (START_ELEMENT != m_pNode->m_type)
+        throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR, "Start-element was not found.");
+
+    setStyle (DOC_LITERAL);
+    throw AxisGenException (AXISC_NODE_VALUE_MISMATCH_EXCEPTION);    
+}
+
 void *SoapDeSerializer::
 checkForFault (const AxisChar * pName, const AxisChar * pNamespace)
 {

Modified: webservices/axis/trunk/c/src/soap/SoapDeSerializer.h
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/soap/SoapDeSerializer.h?view=diff&rev=509439&r1=509438&r2=509439
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapDeSerializer.h (original)
+++ webservices/axis/trunk/c/src/soap/SoapDeSerializer.h Mon Feb 19 22:57:01 2007
@@ -94,6 +94,7 @@
     bool isAnyMustUnderstandHeadersLeft();
     int AXISCALL checkMessageBody(const AxisChar* pName, const AxisChar* pNamespace);
     void* AXISCALL checkForFault(const AxisChar* pName,  const AxisChar* pNamespace);
+    void initiateFault(const AxisChar* pNamespace);
     /* to get any header blocks left in the Deserializer */
     HeaderBlock* getHeaderBlock();
     /* to add a header block to the Deserializer. Probably a handler */

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/OneWayOperationClient.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/OneWayOperationClient.cpp?view=auto&rev=509439
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/OneWayOperationClient.cpp
(added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/OneWayOperationClient.cpp
Mon Feb 19 22:57:01 2007
@@ -0,0 +1,121 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// 
+//        http://www.apache.org/licenses/LICENSE-2.0
+// 
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <iostream>
+#include "TestServicePortType.hpp"
+
+int main( int argc, char * argv[])
+{
+    const char *    pszURL = "http://localhost:9090/OneWayOperation/services/OneWayOperationImpl";
+    
+    if (argc > 1)
+        pszURL = argv[1];
+     
+    TestServicePortType pWS( pszURL, APTHTTP1_1);
+    SampleBeanBoolean pSBB;
+    SampleBeanComplex pSBC; 
+        
+    try
+    {
+        SampleBeanComplex_Array BBArrayIn;
+        SampleBeanComplex ** BBArray = NULL;                    
+        BBArrayIn.set(BBArray,0);
+        pSBB.setSampleBean(&BBArrayIn);
+        pSBB.setSampleBeanBoolean(false_);
+
+        pWS.aBeanPortTypeBase( &pSBB);  
+        cout << "Called aBeanPortTypeBase()" << endl;
+
+        SampleBeanComplex_Array BCArrayIn;
+        SampleBeanComplex ** BCArray = NULL;                    
+        BCArrayIn.set(BCArray,0);
+        
+        pSBC.setSampleBeanComplex(&BCArrayIn);
+        pSBC.setBoolean(false_);
+        pWS.aBeanPortTypeComplex( &pSBC);
+
+        cout << "Called aBeanPortTypeComplex()" << endl;
+
+        cout << "Calling aBeanPortTypeComplex() to initiate fault processing" <<
endl;
+        pWS.aBeanPortTypeComplex( &pSBC);
+        
+        cout << "Calling aBeanPortTypeComplex() to see everything OK after fault processing"
<< endl;
+        pWS.aBeanPortTypeComplex( &pSBC);
+    }
+    catch( SoapFaultException& e)
+    {
+        char *faultCode   = (char *)e.getFaultCode();
+        char *faultString = (char *)e.getFaultString();
+        char *faultActor  = (char *)e.getFaultActor();
+        
+        if (!faultCode)  faultCode = "NULL";
+        if (!faultString) faultString = "NULL";
+        if (!faultActor) faultActor = "NULL";
+        
+        cout << "  FaultCode = " << faultCode << endl;
+        cout << "  FaultString = " << faultString << endl;
+        cout << "  FaultActor = " << faultActor << endl;
+        cout << "  SoapFaultException: " << e.what() << endl;
+    }    
+    catch( AxisException& e)
+    {
+        cout <<  e.what() << endl;
+    }
+    catch( exception& e)
+    {
+        cout << "Unknown exception has occured : " << e.what() << endl;
+    }
+    catch(...)
+    {
+        cout << "Unknown exception has occured" << endl;
+    }
+
+    try
+    {
+        cout << "Calling aBeanPortTypeComplex() to see everything OK after fault processing"
<< endl;
+        pWS.aBeanPortTypeComplex( &pSBC);
+    }
+    catch( SoapFaultException& e)
+    {
+        char *faultCode   = (char *)e.getFaultCode();
+        char *faultString = (char *)e.getFaultString();
+        char *faultActor  = (char *)e.getFaultActor();
+        
+        if (!faultCode)  faultCode = "NULL";
+        if (!faultString) faultString = "NULL";
+        if (!faultActor) faultActor = "NULL";
+        
+        cout << "  FaultCode = " << faultCode << endl;
+        cout << "  FaultString = " << faultString << endl;
+        cout << "  FaultActor = " << faultActor << endl;
+        cout << "  SoapFaultException: " << e.what() << endl;
+    }    
+    catch( AxisException& e)
+    {
+        cout <<  e.what() << endl;
+    }
+    catch( exception& e)
+    {
+        cout << "Unknown exception has occured : " << e.what() << endl;
+    }
+    catch(...)
+    {
+        cout << "Unknown exception has occured" << endl;
+    }
+
+    cout<< "---------------------- TEST COMPLETE -----------------------------"<<
endl;
+
+    return 0;
+}
\ No newline at end of file

Added: webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation.cpp.out
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation.cpp.out?view=auto&rev=509439
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation.cpp.out (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation.cpp.out Mon
Feb 19 22:57:01 2007
@@ -0,0 +1,9 @@
+Called aBeanPortTypeBase()
+Called aBeanPortTypeComplex()
+Calling aBeanPortTypeComplex() to initiate fault processing
+  FaultCode = soapenv:Client
+  FaultString = OneWayOperation Client Error
+  FaultActor = NULL
+  SoapFaultException: OneWayOperation Client Error
+Calling aBeanPortTypeComplex() to see everything OK after fault processing
+---------------------- TEST COMPLETE -----------------------------
\ No newline at end of file

Added: webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation_ServerResponse.expected
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation_ServerResponse.expected?view=auto&rev=509439
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation_ServerResponse.expected
(added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/OneWayOperation_ServerResponse.expected
Mon Feb 19 22:57:01 2007
@@ -0,0 +1,41 @@
+HTTP/1.1 200 OK
+Server: WebSphere Application Server/5.1
+Content-Type: text/xml; charset=utf-8
+Content-Language: en-GB
+Content-Length: 0
+
+HTTP/1.1 200 OK
+Server: WebSphere Application Server/5.1
+Content-Type: text/xml; charset=utf-8
+Content-Language: en-GB
+Content-Length: 0
+
+HTTP/1.1 500 Internal Server Error
+Server: WebSphere Application Server/5.1
+Content-Type: text/xml; charset=utf-8
+Content-Language: en-GB
+Transfer-Encoding: chunked
+
+###
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
+         xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
+         xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<soapenv:Header/>
+<soapenv:Body>
+  <soapenv:Fault>
+     <faultcode>soapenv:Client</faultcode>
+     <faultstring>OneWayOperation Client Error</faultstring>
+     <detail/>
+   </soapenv:Fault>
+</soapenv:Body>
+</soapenv:Envelope>
+0
+
+HTTP/1.1 200 OK
+Server: WebSphere Application Server/5.1
+Content-Type: text/xml; charset=utf-8
+Content-Language: en-GB
+Content-Length: 0
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/OneWayOperation.xml
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/tests/OneWayOperation.xml?view=auto&rev=509439
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/OneWayOperation.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/OneWayOperation.xml Mon Feb
19 22:57:01 2007
@@ -0,0 +1,16 @@
+<test>
+    <name>OneWayOperation</name>
+    <description>OneWayOperation</description>
+    <clientLang>cpp</clientLang>
+    <clientCode>OneWayOperationClient.cpp</clientCode>
+    <wsdl>OneWayOperation.wsdl</wsdl>
+    <expected>
+        <serverResponse>
+            OneWayOperation_ServerResponse.expected
+        </serverResponse>
+        <output>
+            OneWayOperation.cpp.out
+        </output>
+    </expected>
+	<endpoint>http://localhost:80/axis/OneWayOperation</endpoint>
+</test>

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list?view=diff&rev=509439&r1=509438&r2=509439
==============================================================================
Binary files - no diff available.

Added: webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.wsdl?view=auto&rev=509439
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.wsdl (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.wsdl Mon Feb
19 22:57:01 2007
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2003-2004 The Apache Software Foundation.                      -->
+<!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved                   -->
+<!--                                                                          -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License");          -->
+<!-- you may not use this file except in compliance with the License.         -->
+<!-- You may obtain a copy of the License at                                  -->
+<!--                                                                          -->
+<!--        http://www.apache.org/licenses/LICENSE-2.0                        -->
+<!--                                                                          -->
+<!-- Unless required by applicable law or agreed to in writing, software      -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,        -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
+<!-- See the License for the specific language governing permissions and      -->
+<!-- limitations under the License.                                           -->
+
+<definitions targetNamespace="OneWayOperationTest"
+                       xmlns="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:ns99="OneWayOperation"
+                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+                   xmlns:tns="OneWayOperationTest"
+                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="XMLSchema">
+
+ <types>
+  <xsd:schema   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  	<xsd:import namespace="OneWayOperation"
+  	       schemaLocation="OneWayOperation.xsd"/>
+
+   <xsd:element name="anElementComplex">
+    <xsd:complexType>
+     <xsd:sequence>
+      <xsd:element maxOccurs="1" minOccurs="1" name="Element" nillable="true" type="ns99:SampleBeanComplex"/>
+     </xsd:sequence>
+    </xsd:complexType>
+   </xsd:element>
+
+   <xsd:element name="anElementBase">
+    <xsd:complexType>
+     <xsd:sequence>
+      <xsd:element maxOccurs="1" minOccurs="1" name="Element" nillable="true" type="ns99:SampleBeanBoolean"/>
+     </xsd:sequence>
+    </xsd:complexType>
+   </xsd:element>
+  </xsd:schema>
+ </types>
+
+ <message name="aBeanMessageComplex">
+ 	<part name="aBeanMesage" element="tns:anElementComplex"></part>
+ </message>
+
+ <message name="aBeanMessageBase">
+ 	<part name="aBeanMesage" element="tns:anElementBase"></part>
+ </message>
+
+ <portType name="TestServicePortType">
+  <operation name="aBeanPortTypeComplex">
+   <input message="tns:aBeanMessageComplex"/>
+  </operation>
+
+  <operation name="aBeanPortTypeBase">
+   <input message="tns:aBeanMessageBase"/>
+  </operation>
+ </portType>
+
+ <binding name="ServiceBinding" type="tns:TestServicePortType">
+  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+  <operation name="aBeanPortTypeComplex">
+   <soap:operation soapAction="" style="document"/>
+   <input>
+    <soap:body use="literal"/>
+   </input>
+  </operation>
+
+  <operation name="aBeanPortTypeBase">
+   <soap:operation soapAction="" style="document"/>
+   <input>
+    <soap:body use="literal"/>
+   </input>
+  </operation>
+ </binding>
+
+  <service name="SimpleService">
+    <port binding="tns:ServiceBinding" name="ServiceBinding">
+      <soap:address location="http://tempuri.org" /> 
+    </port>
+  </service>
+</definitions>
\ No newline at end of file

Added: webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.xsd
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.xsd?view=auto&rev=509439
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.xsd (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/OneWayOperation.xsd Mon Feb
19 22:57:01 2007
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsd:schema targetNamespace="OneWayOperation"
+            xmlns:tns="OneWayOperation"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ 
+ <xsd:complexType name="SampleBeanComplex">
+  <xsd:sequence>
+   <xsd:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="SampleBeanComplex"
nillable="true"  type="tns:SampleBeanComplex"/>
+   <xsd:element form="qualified" maxOccurs="1"         minOccurs="1" name="Boolean"  
        nillable="false" type="xsd:boolean"/>
+  </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="SampleBeanBoolean">
+  <xsd:sequence>
+   <xsd:element form="qualified" minOccurs="0" maxOccurs="unbounded"       name="SampleBean"
       nillable="true"  type="tns:SampleBeanComplex"/>
+   <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="SampleBeanBoolean"
nillable="false" type="xsd:boolean"/>
+  </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message