Author: andreasmyth
Date: Wed Jun 13 10:28:34 2007
New Revision: 546970
URL: http://svn.apache.org/viewvc?view=rev&rev=546970
Log:
Added simple WS-Policy demo showing how to use WSDL 1.1 xml element attachment
and external attchments to use addressing.
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/ConciseFormatter.java
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/GreeterImpl.java
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl
(with props)
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,130 @@
+WS-Policy Demo
+==============
+
+This demo shows how the CXF WS-Policy framework in Apache CXF uses
+WSDL 1.1 Policy attachments to enable the use of WS-Addressing.
+
+While most of the demo is very similar to the ws_addressing demo, there
+are two major differences:
+1. À Policy element containing an Addressing assertion is attached to
+the port element in the demo's wsdl.
+2. The configuration files for the client and server specify that the
+CXF policy engine should be enabled.
+In addition, the configuration file for the server tells the policy
+engine where to look for external policy attachments. This is necessary
+since neither the implementor not the interface specify wsdlLocation
+in their WebService annotation (the client could also use external policy
+attachments instead of WSDL 1.1 attachments).
+Note that, apart from the configuration of the decoupled http endpoint
+on which the client receives responses from the server, nothing else
+needs to be configured. In particular, there is no need to specify the
+WS-Addressing interceptors. The internals of what is involved in
+ensuring that addressing headers are added to the messages (namely:
+the addition of two addressing interceptors to the inbound and outbound
+fault and message processing chains) are left to the policy framework,
+or rather: its built-in support for the Addressing assertion.
+
+Please review the README in the samples directory before continuing.
+
+
+Prerequisite
+------------
+
+If your environment already includes cxf-manifest-incubator.jar on the
CLASSPATH,
+and the JDK and ant bin directories on the PATH, it is not necessary to
+run the environment script described in the samples directory README.
+If your environment is not properly configured, or if you are planning
+on using wsdl2java, javac, and java to build and run the demos, you must
+set the environment by running the script.
+
+
+Building and running the demo using ant
+---------------------------------------
+
+From the samples/ws_policy directory, the ant build script can be used to
+build and run the demo. The server and client targets automatically build
+the demo.
+
+Using either UNIX or Windows:
+
+ ant server
+ ant client
+
+Although not explicitly instructed to use these interceptors,
+both client and server will use the MAPAggregator and MAPCodec
+interceptors to aggregate and encode the WS-Addressing MAPs.
+
+To remove the code generated from the WSDL file and the .class
+files, run:
+
+ ant clean
+
+
+Buildng the demo using wsdl2java and javac
+------------------------------------------
+
+From the samples/ws_policy directory, first create the target directory
+build/classes and then generate code from the WSDL file.
+
+For UNIX:
+ mkdir -p build/classes
+
+ wsdl2java -d build/classes -compile ./wsdl/hello_world_addr.wsdl
+
+For Windows:
+ mkdir build\classes
+ Must use back slashes.
+
+ wsdl2java -d build\classes -compile .\wsdl\hello_world_addr.wsdl
+ May use either forward or back slashes.
+
+Now compile the provided client and server applications with the commands:
+
+For UNIX:
+
+ export
CLASSPATH=$CLASSPATH:$CXF_HOME/lib/cxf-manifest-incubator.jar:./build/classes:.
+ javac -d build/classes src/demo/ws_policy/common/*.java
+ javac -d build/classes src/demo/ws_policy/client/*.java
+ javac -d build/classes src/demo/ws_policy/server/*.java
+
+For Windows:
+ set
classpath=%classpath%;%CXF_HOME%\lib\cxf-manifest-incubator.jar;.\build\classes;.
+ javac -d build\classes src\demo\ws_policy\common\*.java
+ javac -d build\classes src\demo\ws_policy\client\*.java
+ javac -d build\classes src\demo\ws_policy\server\*.java
+
+Running the demo using java
+---------------------------
+
+From the samples/ws_policy directory run the commands (entered on a single
command line):
+
+For UNIX (must use forward slashes):
+ java -Djava.util.logging.config.file=./logging.properties
+ -Dcxf.config.file=server.xml
+ demo.ws_policy.server.Server &
+
+ java -Djava.util.logging.config.file=./logging.properties
+ -Dcxf.config.file=client.xml
+ demo.ws_policy.client.Client
+
+The server process starts in the background.
+
+For Windows (may use either forward or back slashes):
+ start
+ java -Djava.util.logging.config.file=.\logging.properties
+ -Dcxf.config.file=server.xml
+ demo.ws_policy.server.Server
+
+ java -Djava.util.logging.config.file=.\logging.properties
+ -Dcxf.config.file=client.xml
+ demo.ws_policy.client.Client
+
+The server process starts in a new command window.
+
+After running the client, terminate the server process.
+
+To remove the code generated from the WSDL file and the .class
+files, either delete the build directory and its contents or run:
+
+ ant clean
+
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/README.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<attachments xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsp:PolicyAttachment>
+ <wsp:AppliesTo>
+ <wsa:EndpointReference>
+
<wsa:Address>http://localhost:9000/SoapContext/SoapPort</wsa:Address>
+ </wsa:EndpointReference>
+ </wsp:AppliesTo>
+ <wsp:Policy>
+ <wsam:Addressing
xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
+ <wsp:Policy/>
+ </wsam:Addressing>
+ </wsp:Policy>
+ </wsp:PolicyAttachment>
+</attachments>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/addr-external.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project name="WS-Policy demo" default="build" basedir=".">
+
+ <import file="../common_build.xml"/>
+
+ <target name="client" description="run demo client" depends="build">
+ <cxfrun classname="demo.ws_policy.client.Client"
+ jvmarg1="-Dcxf.config.file=client.xml"
+ logging-properties-file="./logging.properties"/>
+ </target>
+
+ <target name="server" description="run demo server" depends="build">
+ <cxfrun classname="demo.ws_policy.server.Server"
+ jvmarg1="-Dcxf.config.file=server.xml"
+ logging-properties-file="./logging.properties"/>
+ </target>
+
+ <target name="generate.code">
+ <echo level="info" message="Generating code using wsdl2java..."/>
+ <wsdl2java file="hello_world_addr_policy.wsdl"/>
+ </target>
+</project>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <http:conduit
name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit">
+ <http:client
DecoupledEndpoint="http://localhost:9990/decoupled_endpoint"/>
+ </http:conduit>
+
+ <bean id="org.apache.cxf.ws.policy.PolicyEngine"
class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
+ <property name="bus" ref="cxf"/>
+ <property name="enabled" value="true"/>
+ </bean>
+
+ <bean id="loggingIn"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ <bean id="loggingOut"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+
+ <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
+ <property name="inInterceptors">
+ <list>
+ <ref bean="loggingIn"/>
+ </list>
+ </property>
+ <!--
+ <property name="inFaultInterceptors">
+ <list>
+ </list>
+ </property>
+ -->
+ <property name="outInterceptors">
+ <list>
+ <ref bean="loggingOut"/>
+ </list>
+ </property>
+ <property name="outFaultInterceptors">
+ <list>
+ <ref bean="loggingOut"/>
+ </list>
+ </property>
+ </bean>
+
+</beans>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/client.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,73 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= WARNING
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to INFO and above.
+java.util.logging.ConsoleHandler.level = FINE
+#java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+java.util.logging.ConsoleHandler.formatter =
demos.ws_policy.common.ConciseFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+com.xyz.foo.level = SEVERE
+org.apache.cxf.ws.addressing.soap.MAPCodec.level = INFO
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/logging.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <bean id="org.apache.cxf.ws.policy.PolicyEngine"
class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">
+ <property name="bus" ref="cxf"/>
+ <property name="enabled" value="true"/>
+ </bean>
+
+ <bean
class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider">
+ <constructor-arg ref="cxf"/>
+ <property name="location" value="addr-external.xml"/>
+ </bean>
+
+
+
+</beans>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/server.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package demo.ws_policy.client;
+
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.PingMeFault;
+import org.apache.hello_world_soap_http.SOAPService;
+
+public final class Client {
+
+ private static final String USER_NAME = System.getProperty("user.name");
+
+ private Client() {
+ }
+
+ public static void main(String args[]) {
+ try {
+ SOAPService service = new SOAPService();
+ Greeter port = service.getSoapPort();
+
+ System.out.println("Invoking sayHi...");
+ String resp = port.sayHi();
+ System.out.println("Server responded with: " + resp + "\n");
+
+ System.out.println("Invoking greetMe...");
+ resp = port.greetMe(USER_NAME);
+ System.out.println("Server responded with: " + resp + "\n");
+
+ System.out.println("Invoking greetMeOneWay...");
+ port.greetMeOneWay(USER_NAME);
+ System.out.println("No response from server as method is
OneWay\n");
+
+ try {
+ System.out.println("Invoking pingMe, expecting exception...");
+ port.pingMe();
+ } catch (PingMeFault ex) {
+ System.out.println("Expected exception occurred: " + ex);
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ } finally {
+ System.exit(0);
+ }
+ }
+
+}
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/client/Client.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/ConciseFormatter.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/ConciseFormatter.java?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/ConciseFormatter.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/ConciseFormatter.java
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package demo.ws_policy.common;
+
+import java.util.logging.LogRecord;
+import java.util.logging.SimpleFormatter;
+
+public class ConciseFormatter extends SimpleFormatter {
+ public synchronized String format(LogRecord record) {
+ String longForm = super.format(record);
+ String shortForm = longForm.indexOf("INFO: ") > 0
+ ? longForm.substring(longForm.indexOf("INFO: ") + 6)
+ : longForm;
+ return shortForm;
+ }
+}
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/ConciseFormatter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/common/ConciseFormatter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/GreeterImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/GreeterImpl.java?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/GreeterImpl.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/GreeterImpl.java
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package demo.ws_policy.server;
+
+import java.util.logging.Logger;
+
+import javax.jws.WebService;
+
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.PingMeFault;
+import org.apache.hello_world_soap_http.types.FaultDetail;
+
+
[EMAIL PROTECTED](name = "Greeter",
+ serviceName = "SOAPService",
+ targetNamespace = "http://apache.org/hello_world_soap_http")
+
+public class GreeterImpl implements Greeter {
+
+ private static final Logger LOG =
+ Logger.getLogger(GreeterImpl.class.getPackage().getName());
+
+ /* (non-Javadoc)
+ * @see org.apache.hello_world_soap_http.Greeter#greetMe(java.lang.String)
+ */
+ public String greetMe(String me) {
+ LOG.info("Executing operation greetMe");
+ System.out.println("Executing operation greetMe");
+ System.out.println("Message received: " + me + "\n");
+ return "Hello " + me;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.apache.hello_world_soap_http.Greeter#greetMeOneWay(java.lang.String)
+ */
+ public void greetMeOneWay(String me) {
+ LOG.info("Executing operation greetMeOneWay");
+ System.out.println("Executing operation greetMeOneWay\n");
+ System.out.println("Hello there " + me);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.hello_world_soap_http.Greeter#sayHi()
+ */
+ public String sayHi() {
+ LOG.info("Executing operation sayHi");
+ System.out.println("Executing operation sayHi\n");
+ return "Bonjour";
+ }
+
+ public void pingMe() throws PingMeFault {
+ FaultDetail faultDetail = new FaultDetail();
+ faultDetail.setMajor((short)2);
+ faultDetail.setMinor((short)1);
+ LOG.info("Executing operation pingMe, throwing PingMeFault exception");
+ System.out.println("Executing operation pingMe, throwing PingMeFault
exception\n");
+ throw new PingMeFault("PingMeFault raised by server", faultDetail);
+ }
+
+
+}
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/GreeterImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/GreeterImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package demo.ws_policy.server;
+
+import javax.xml.ws.Endpoint;
+
+public class Server {
+
+ protected Server() throws Exception {
+ System.out.println("Starting Server");
+
+
+ Object implementor = new GreeterImpl();
+ String address = "http://localhost:9000/SoapContext/SoapPort";
+ Endpoint.publish(address, implementor);
+ }
+
+ public static void main(String args[]) throws Exception {
+ new Server();
+ System.out.println("Server ready...");
+
+ Thread.sleep(5 * 60 * 1000);
+ System.out.println("Server exiting");
+ System.exit(0);
+ }
+}
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/src/demo/ws_policy/server/Server.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl?view=auto&rev=546970
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl
Wed Jun 13 10:28:34 2007
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<wsdl:definitions name="HelloWorld"
targetNamespace="http://apache.org/hello_world_soap_http"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/hello_world_soap_http"
+ xmlns:x1="http://apache.org/hello_world_soap_http/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema
targetNamespace="http://apache.org/hello_world_soap_http/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
+ <element name="sayHi">
+ <complexType/>
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMe">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeOneWay">
+ <complexType>
+ <sequence>
+ <element name="requestType" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="pingMe">
+ <complexType/>
+ </element>
+ <element name="pingMeResponse">
+ <complexType/>
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor" type="xsd:short"/>
+ <element name="major" type="xsd:short"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part element="x1:sayHi" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="x1:sayHiResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeRequest">
+ <wsdl:part element="x1:greetMe" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part element="x1:greetMeResponse" name="out"/>
+ </wsdl:message>
+ <wsdl:message name="greetMeOneWayRequest">
+ <wsdl:part element="x1:greetMeOneWay" name="in"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeRequest">
+ <wsdl:part name="in" element="x1:pingMe"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeResponse">
+ <wsdl:part name="out" element="x1:pingMeResponse"/>
+ </wsdl:message>
+ <wsdl:message name="pingMeFault">
+ <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+ <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input message="tns:greetMeOneWayRequest"
name="greetMeOneWayRequest"/>
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+ <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+ <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sayHiRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="greetMeResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="greetMeOneWayRequest">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="pingMeFault">
+ <soap:fault name="pingMeFault" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+ <soap:address
location="http://localhost:9000/SoapContext/SoapPort"/>
+ <wsp:Policy xmlns:wsp="http://www.w3.org/2006/07/ws-policy">
+ <wsam:Addressing
xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
+ <wsp:Policy/>
+ </wsam:Addressing>
+ </wsp:Policy>
+ <wswa:UsingAddressing
xmlns:wswa="http://www.w3.org/2005/08/addressing/wsdl"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/ws_policy/wsdl/hello_world_addr_policy.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml