cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r558019 - in /incubator/cxf/trunk/distribution/src/main/release/samples/hello_world: README.txt cxf.xml src/demo/hw/client/Client.java
Date Fri, 20 Jul 2007 15:19:07 GMT
Author: andreasmyth
Date: Fri Jul 20 08:19:06 2007
New Revision: 558019

URL: http://svn.apache.org/viewvc?view=rev&rev=558019
Log:
Fixed cfg file for hello_world demo and added information about it and schema validation to
README. 

Modified:
    incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/README.txt
    incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/cxf.xml
    incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/src/demo/hw/client/Client.java

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/README.txt
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/README.txt?view=diff&rev=558019&r1=558018&r2=558019
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/README.txt (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/README.txt Fri Jul
20 08:19:06 2007
@@ -1,8 +1,33 @@
 Hello World Demo using Document/Literal Style
 =============================================
 
-Please review the README in the samples directory before
-continuing.
+This demo illustrates the use of the JAX-WS APIs to run a simple
+client against a standalone server using SOAP 1.1 over HTTP.
+
+It also shows how CXF configuration can be used to enable schema validation
+on the client and/or server side: By default the message parameters would not
+be validated, but the presence of the cxf.xml configuration file on
+the classpath, and its content change this default behavior:
+The configuration file specifies that 
+
+a) if a JAX-WS client proxy is created for port {http://apache.org/hello_world_soap_http}SoapPort
+it should have schema validation enabled.
+
+b) if a JAX-WS server endpoint is created for port {http://apache.org/hello_world_soap_http}SoapPort
+it should have schema validation enabled.
+
+The client's second greetMe invocation causes an exception (a marshalling
+error) on the client side, i.e. before the request with the invalid parameter
+goes on the wire.
+After commenting the definition of the <jaxws:client> element in cxf.xml you 
+will notice that the client's second greetMe invocation still throws an exception,
+but that this time the exception is caused by an unmarshalling error on the
+server side.
+Commenting both elements, or renaming/removing the cfg.xml file, and thus
+restoring the default behavior, results in the second greetMe invocation
+not causing an exception.
+
+Please review the README in the samples directory before continuing.
 
 
 

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/cxf.xml?view=diff&rev=558019&r1=558018&r2=558019
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/cxf.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/cxf.xml Fri Jul
20 08:19:06 2007
@@ -20,25 +20,30 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
+      xmlns:cxf="http://cxf.apache.org/core"
       xmlns:soap="http://cxf.apache.org/bindings/soap"
       xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
 http://cxf.apache.org/bindings/soap http://cxf.apache.org/schema/bindings/soap.xsd
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
 
-    <bean name="{http://apache.org/hello_world_soap_http}SOAPService" abstract="true">
-        <property name="properties">
-        	<map>
-        		<entry key="schema-validation-enabled" value="true" />
-        	</map>
-        </property>
-    </bean>
+    <!-- comment this bean to disable schema validation in the client -->
+
+    <jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort"
+        createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="schema-validation-enabled" value="true" />
+        </jaxws:properties>
+    </jaxws:client>
 
     <jaxws:endpoint name="{http://apache.org/hello_world_soap_http}SoapPort"
-		createdFromAPI="true">
-		<jaxws:properties>
-			<entry key="schema-validation-enabled" value="true" />
-		</jaxws:properties>
-	</jaxws:endpoint>
+        wsdlLocation="wsdl/hello_world.wsdl"
+        createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="schema-validation-enabled" value="true" />
+        </jaxws:properties>
+    </jaxws:endpoint>
+
 </beans>
 

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/src/demo/hw/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/src/demo/hw/client/Client.java?view=diff&rev=558019&r1=558018&r2=558019
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/src/demo/hw/client/Client.java
(original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/hello_world/src/demo/hw/client/Client.java
Fri Jul 20 08:19:06 2007
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.net.URL;
 import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
 import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.PingMeFault;
 import org.apache.hello_world_soap_http.SOAPService;
@@ -69,8 +70,9 @@
         System.out.println("Invoking greetMe with invalid length string, expecting exception...");
         try {
             resp = port.greetMe("Invoking greetMe with invalid length string, expecting exception...");
-        } catch (Exception e) {
-            System.out.println("Expected exception has occurred: " + e.getMessage());
+        } catch (WebServiceException ex) {
+            System.out.println("Caught expected WebServiceException:");
+            System.out.println("    " + ex.getMessage());
         }
 
         System.out.println();



Mime
View raw message