You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by gm...@apache.org on 2012/08/09 20:15:22 UTC

svn commit: r1371356 - in /cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https: ./ bin/ certs/ src/main2/ src/main2/config/ src/main2/java/ src/main2/java/demo/ src/main2/java/demo/hw_https/ src/main2/java/demo/hw_https/clie...

Author: gmazza
Date: Thu Aug  9 18:15:21 2012
New Revision: 1371356

URL: http://svn.apache.org/viewvc?rev=1371356&view=rev
Log:
Updated wsdl_first_https sample: better Mavenized, no longer disabling CN check by default (backport from CXF 2.7/trunk branch.)

Added:
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/KeyREADME.txt
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/clientKeystore.jks   (with props)
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/hello_world.wsdl
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/serviceKeystore.jks   (with props)
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/Client.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/ClientNonSpring.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/GreeterImpl.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/Server.java
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/InsecureClient.xml
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/SecureClient.xml
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/ServerConfig.xml
Removed:
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/bin/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/certs/
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/wsdl/
Modified:
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/README.txt
    cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/pom.xml

Modified: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/README.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/README.txt?rev=1371356&r1=1371355&r2=1371356&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/README.txt (original)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/README.txt Thu Aug  9 18:15:21 2012
@@ -87,10 +87,6 @@ runtime by prompting for the password.  
 demonstration purposes only.
 
 Certificates:
-If the certificates have expired, a shell script in bin/gencerts.sh 
-will generate a new set of certificates needed for this sample. 
-Just do the following:
-
-        cd certs
-        sh ../bin/gencerts.sh
+See the src/main/config folder for the sample keys used (don't use
+these keys in production!) as well as scripts used for their creation.
 

Modified: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/pom.xml?rev=1371356&r1=1371355&r2=1371356&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/pom.xml (original)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/pom.xml Thu Aug  9 18:15:21 2012
@@ -32,7 +32,9 @@
 
     <properties>
         <cxf.version>${project.version}</cxf.version>
+        <wsdl.location>${basedir}/src/main/config/hello_world.wsdl</wsdl.location>
     </properties>
+
     <build>
         <plugins>
             <plugin>
@@ -53,7 +55,7 @@
                         <configuration>
                             <wsdlOptions>
                                 <wsdlOption>
-                                    <wsdl>${basedir}/wsdl/hello_world.wsdl</wsdl>
+                                    <wsdl>${wsdl.location}</wsdl>
                                 </wsdlOption>
                             </wsdlOptions>
                         </configuration>
@@ -63,28 +65,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copyxmlfiles</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                        <configuration>
-                            <tasks>
-                                <copy file="${basedir}/src/main/java/demo/hw_https/server/CherryServer.xml" todir="${basedir}/target/classes/demo/hw_https/server" />
-                                <copy file="${basedir}/src/main/java/demo/hw_https/client/SecureClient.xml" todir="${basedir}/target/classes/demo/hw_https/client" />
-                                <copy file="${basedir}/src/main/java/demo/hw_https/client/InsecureClient.xml" todir="${basedir}/target/classes/demo/hw_https/client" />
-                                <copy todir="${basedir}/target/classes/certs">
-                                    <fileset dir="${basedir}/certs" />
-                                </copy>
-                            </tasks>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
     </build>
     <profiles>
@@ -119,7 +99,7 @@
         <profile>
             <id>insecure.client</id>
             <build>
-                <defaultGoal>test</defaultGoal>
+                <defaultGoal>integration-test</defaultGoal>
                 <plugins>
                     <plugin>
                         <groupId>org.codehaus.mojo</groupId>
@@ -133,7 +113,7 @@
                                 <configuration>
                                     <mainClass>demo.hw_https.client.Client</mainClass>
                                     <arguments>
-                                        <argument>${basedir}/wsdl/hello_world.wsdl</argument>
+                                        <argument>${wsdl.location}</argument>
                                         <argument>insecure</argument>
                                     </arguments>
                                 </configuration>
@@ -160,7 +140,7 @@
                                 <configuration>
                                     <mainClass>demo.hw_https.client.ClientNonSpring</mainClass>
                                     <arguments>
-                                        <argument>${basedir}/wsdl/hello_world.wsdl</argument>
+                                        <argument>${wsdl.location}</argument>
                                         <argument>insecure</argument>
                                     </arguments>
                                 </configuration>
@@ -187,7 +167,7 @@
                                 <configuration>
                                     <mainClass>demo.hw_https.client.Client</mainClass>
                                     <arguments>
-                                        <argument>${basedir}/wsdl/hello_world.wsdl</argument>
+                                        <argument>${wsdl.location}</argument>
                                         <argument>secure</argument>
                                     </arguments>
                                 </configuration>
@@ -214,7 +194,7 @@
                                 <configuration>
                                     <mainClass>demo.hw_https.client.ClientNonSpring</mainClass>
                                     <arguments>
-                                        <argument>${basedir}/wsdl/hello_world.wsdl</argument>
+                                        <argument>${wsdl.location}</argument>
                                         <argument>secure</argument>
                                     </arguments>
                                 </configuration>
@@ -229,17 +209,17 @@
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxws</artifactId>
-            <version>2.6.2-SNAPSHOT</version>
+            <version>${cxf.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http</artifactId>
-            <version>2.6.2-SNAPSHOT</version>
+            <version>${cxf.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http-jetty</artifactId>
-            <version>2.6.2-SNAPSHOT</version>
+            <version>${cxf.version}</version>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/KeyREADME.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/KeyREADME.txt?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/KeyREADME.txt (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/KeyREADME.txt Thu Aug  9 18:15:21 2012
@@ -0,0 +1,20 @@
+# The below scripts show the commands used to generate the self-signed keys for this sample.
+# If you use the below script to create your own keys be sure to change the passwords used here
+# DO NOT USE THE SUPPLIED KEYS IN PRODUCTION--everyone has them!!
+# For production recommended to use keys signed by a third-party certificate authority (CA)
+
+# Create the combination keystore/truststore for the client and service.
+# Note you can create separate keystores/truststores for both if desired
+keytool -genkeypair -validity 730 -alias myservicekey -keystore serviceKeystore.jks -dname "cn=localhost" -keypass skpass -storepass sspass
+keytool -genkeypair -validity 730 -alias myclientkey -keystore clientKeystore.jks -keypass ckpass -storepass cspass
+
+# Place server public cert in client key/truststore
+keytool -export -rfc -keystore serviceKeystore.jks -alias myservicekey -file MyService.cer -storepass sspass
+keytool -import -noprompt -trustcacerts -file MyService.cer -alias myservicekey -keystore clientKeystore.jks -storepass cspass
+
+# Place client public cert in service key/truststore
+# Note this needs to be done only if you're requiring client authentication
+# as configured in resources/ServerConfig.xml
+keytool -export -rfc -keystore clientKeystore.jks -alias myclientkey -file MyClient.cer -storepass cspass
+keytool -import -noprompt -trustcacerts -file MyClient.cer -alias myclientkey -keystore serviceKeystore.jks -storepass sspass
+

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/clientKeystore.jks
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/clientKeystore.jks?rev=1371356&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/clientKeystore.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/hello_world.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/hello_world.wsdl?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/hello_world.wsdl (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/hello_world.wsdl Thu Aug  9 18:15:21 2012
@@ -0,0 +1,91 @@
+<?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"
+	    xmlns:tns="http://apache.org/hello_world_soap_http/types"
+            elementFormDefault="qualified">
+
+	    <simpleType name="MyStringType">
+		<restriction base="string">
+		    <maxLength value="30" />
+		</restriction>
+	    </simpleType>
+
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <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:portType name="Greeter">
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </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="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:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <soap:address location="https://localhost:9001/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/serviceKeystore.jks
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/serviceKeystore.jks?rev=1371356&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/config/serviceKeystore.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/Client.java?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/Client.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/Client.java Thu Aug  9 18:15:21 2012
@@ -0,0 +1,89 @@
+/**
+ * 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.hw_https.client;
+
+import java.io.File;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.SOAPService;
+
+public final class Client {
+
+    private static final QName SERVICE_NAME
+        = new QName("http://apache.org/hello_world_soap_http", "SOAPService");
+
+    private static final QName PORT_NAME =
+        new QName("http://apache.org/hello_world_soap_http", "SoapPort");
+
+
+    private Client() {
+    }
+
+    public static void main(String args[]) throws Exception {
+
+        if (args.length == 0) {
+            System.out.println("please specify wsdl");
+            System.exit(1);
+        }
+
+        URL wsdlURL;
+        File wsdlFile = new File(args[0]);
+        if (wsdlFile.exists()) {
+            wsdlURL = wsdlFile.toURL();
+        } else {
+            wsdlURL = new URL(args[0]);
+        }
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = null;
+        if ("secure".equals(args[1])) {
+            busFile = Client.class.getResource("/SecureClient.xml");
+        } else if ("insecure".equals(args[1])) {
+            busFile = Client.class.getResource("/InsecureClient.xml");
+        } else {
+            System.out.println("arg1 needs to be either secure or insecure");
+            System.exit(1);
+        }
+        Bus bus = bf.createBus(busFile.toString());
+        BusFactory.setDefaultBus(bus);
+
+        System.out.println(wsdlURL);
+        SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
+        Greeter port = ss.getPort(PORT_NAME, Greeter.class);
+
+        System.out.println("Invoking greetMe...");
+        try {
+            String resp = port.greetMe(System.getProperty("user.name"));
+            System.out.println("Server responded with: " + resp);
+            System.out.println();
+
+        } catch (Exception e) {
+            System.out.println("Invocation failed with the following: " + e.getCause());
+            System.out.println();
+        }
+
+        System.exit(0);
+    }
+
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/ClientNonSpring.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/ClientNonSpring.java?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/ClientNonSpring.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/client/ClientNonSpring.java Thu Aug  9 18:15:21 2012
@@ -0,0 +1,137 @@
+/**
+ * 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.hw_https.client;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.configuration.jsse.TLSClientParameters;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.SOAPService;
+
+public final class ClientNonSpring {
+
+    private static final QName SERVICE_NAME
+        = new QName("http://apache.org/hello_world_soap_http", "SOAPService");
+
+    private static final QName PORT_NAME =
+        new QName("http://apache.org/hello_world_soap_http", "SoapPort");
+
+
+    private ClientNonSpring() {
+    }
+
+    public static void main(String args[]) throws Exception {
+
+        if (args.length == 0) {
+            System.out.println("please specify wsdl");
+            System.exit(1);
+        }
+
+        URL wsdlURL;
+        File wsdlFile = new File(args[0]);
+        if (wsdlFile.exists()) {
+            wsdlURL = wsdlFile.toURL();
+        } else {
+            wsdlURL = new URL(args[0]);
+        }
+
+        System.out.println(wsdlURL);
+        SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
+        Greeter port = ss.getPort(PORT_NAME, Greeter.class);        
+        if ("secure".equals(args[1])) {
+            setupTLS(port);
+        } else if ("insecure".equals(args[1])) {
+            //do nothing
+        } else {
+            System.out.println("arg1 needs to be either secure or insecure");
+            System.exit(1);
+        }
+        
+        System.out.println("Invoking greetMe...");
+        try {
+            String resp = port.greetMe(System.getProperty("user.name"));
+            System.out.println("Server responded with: " + resp);
+            System.out.println();
+
+        } catch (Exception e) {
+            System.out.println("Invocation failed with the following: " + e.getCause());
+            System.out.println();
+        }
+
+        System.exit(0);
+    }
+    
+    private static void setupTLS(Greeter port) 
+        throws FileNotFoundException, IOException, GeneralSecurityException {
+        String keyStoreLoc = "src/main/config/clientKeystore.jks";
+        HTTPConduit httpConduit = (HTTPConduit) ClientProxy.getClient(port).getConduit();
+ 
+        TLSClientParameters tlsCP = new TLSClientParameters();
+        String keyPassword = "ckpass";
+        KeyStore keyStore = KeyStore.getInstance("JKS");
+        keyStore.load(new FileInputStream(keyStoreLoc), "cspass".toCharArray());
+        KeyManager[] myKeyManagers = getKeyManagers(keyStore, keyPassword);
+        tlsCP.setKeyManagers(myKeyManagers);
+ 
+        
+        KeyStore trustStore = KeyStore.getInstance("JKS");
+        trustStore.load(new FileInputStream(keyStoreLoc), "cspass".toCharArray());
+        TrustManager[] myTrustStoreKeyManagers = getTrustManagers(trustStore);
+        tlsCP.setTrustManagers(myTrustStoreKeyManagers);
+        
+        httpConduit.setTlsClientParameters(tlsCP);
+    }
+
+    private static TrustManager[] getTrustManagers(KeyStore trustStore) 
+        throws NoSuchAlgorithmException, KeyStoreException {
+        String alg = KeyManagerFactory.getDefaultAlgorithm();
+        TrustManagerFactory fac = TrustManagerFactory.getInstance(alg);
+        fac.init(trustStore);
+        return fac.getTrustManagers();
+    }
+    
+    private static KeyManager[] getKeyManagers(KeyStore keyStore, String keyPassword) 
+        throws GeneralSecurityException, IOException {
+        String alg = KeyManagerFactory.getDefaultAlgorithm();
+        char[] keyPass = keyPassword != null
+                     ? keyPassword.toCharArray()
+                     : null;
+        KeyManagerFactory fac = KeyManagerFactory.getInstance(alg);
+        fac.init(keyStore, keyPass);
+        return fac.getKeyManagers();
+    }
+
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/GreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/GreeterImpl.java?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/GreeterImpl.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/GreeterImpl.java Thu Aug  9 18:15:21 2012
@@ -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.hw_https.server;
+
+import java.util.logging.Logger;
+import org.apache.hello_world_soap_http.Greeter;
+
+@javax.jws.WebService(name = "Greeter", serviceName = "SOAPService", 
+                      targetNamespace = "http://apache.org/hello_world_soap_http", 
+                      wsdlLocation = "file:./src/main/config/hello_world.wsdl")
+                  
+public class GreeterImpl implements Greeter {
+
+    private static final Logger LOG = 
+        Logger.getLogger(GreeterImpl.class.getPackage().getName());
+    
+    /* (non-Javadoc)
+     * @see org.objectweb.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;
+    }
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/Server.java?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/Server.java (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/java/demo/hw_https/server/Server.java Thu Aug  9 18:15:21 2012
@@ -0,0 +1,58 @@
+/**
+ * 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.hw_https.server;
+
+import java.net.URL;
+import javax.xml.ws.Endpoint;
+
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+
+public class Server {
+
+    protected Server() throws Exception {
+        System.out.println("Starting Server");
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = Server.class.getResource("/ServerConfig.xml");
+        Bus bus = bf.createBus(busFile.toString());
+        BusFactory.setDefaultBus(bus);
+
+        Object implementor = new GreeterImpl();
+        String address = "https://localhost:9001/SoapContext/SoapPort";
+        Endpoint.publish(address, implementor);
+    }
+
+    public static void main(String args[]) throws Exception {
+        System.out.println("The server's security configuration will be taken "
+                           + "from server.xml using the bean name : "
+                           + "\"{http://apache.org/hello_world_soap_http}"
+                           + "GreeterImplPort.http-destination\".");
+        System.out.println();
+        new Server();
+        System.out.println("Server ready...");
+
+        Thread.sleep(5 * 60 * 1000);
+        System.out.println("Server exiting");
+        System.exit(0);
+    }
+}

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/InsecureClient.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/InsecureClient.xml?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/InsecureClient.xml (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/InsecureClient.xml Thu Aug  9 18:15:21 2012
@@ -0,0 +1,30 @@
+<?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:conduit>
+
+</beans>

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/SecureClient.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/SecureClient.xml?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/SecureClient.xml (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/SecureClient.xml Thu Aug  9 18:15:21 2012
@@ -0,0 +1,60 @@
+<?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.
+-->
+
+<!-- 
+  ** This file configures the Wibble Client
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:sec="http://cxf.apache.org/configuration/security"
+  xmlns:http="http://cxf.apache.org/transports/http/configuration"
+  xsi:schemaLocation="
+           http://cxf.apache.org/configuration/security
+           http://cxf.apache.org/schemas/configuration/security.xsd
+           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:tlsClientParameters>
+      <sec:keyManagers keyPassword="ckpass">
+          <sec:keyStore file="src/main/config/clientKeystore.jks" password="cspass" type="JKS"/>
+      </sec:keyManagers>
+      <sec:trustManagers>
+          <sec:keyStore file="src/main/config/clientKeystore.jks" password="cspass" type="JKS"/>
+      </sec:trustManagers>
+      <sec:cipherSuitesFilter>
+        <!-- these filters ensure that a ciphersuite with
+          export-suitable or null encryption is used,
+          but exclude anonymous Diffie-Hellman key change as
+          this is vulnerable to man-in-the-middle attacks -->
+        <sec:include>.*_EXPORT_.*</sec:include>
+        <sec:include>.*_EXPORT1024_.*</sec:include>
+        <sec:include>.*_WITH_DES_.*</sec:include>
+        <sec:include>.*_WITH_AES_.*</sec:include>
+        <sec:include>.*_WITH_NULL_.*</sec:include>
+        <sec:exclude>.*_DH_anon_.*</sec:exclude>
+      </sec:cipherSuitesFilter>
+    </http:tlsClientParameters>
+   </http:conduit>
+</beans> 
+

Added: cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/ServerConfig.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/ServerConfig.xml?rev=1371356&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/ServerConfig.xml (added)
+++ cxf/branches/2.6.x-fixes/distribution/src/main/release/samples/wsdl_first_https/src/main2/resources/ServerConfig.xml Thu Aug  9 18:15:21 2012
@@ -0,0 +1,68 @@
+<?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.
+-->
+
+<!-- 
+  ** This file configures the Server which runs the web service.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:sec="http://cxf.apache.org/configuration/security"
+  xmlns:http="http://cxf.apache.org/transports/http/configuration"
+  xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+  xsi:schemaLocation="
+            http://cxf.apache.org/configuration/security  		      
+            http://cxf.apache.org/schemas/configuration/security.xsd
+            http://cxf.apache.org/transports/http/configuration
+            http://cxf.apache.org/schemas/configuration/http-conf.xsd
+            http://cxf.apache.org/transports/http-jetty/configuration
+            http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+            http://www.springframework.org/schema/beans
+            http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+  <http:destination name="{http://apache.org/hello_world_soap_http}GreeterPort.http-destination"> 
+  </http:destination>
+
+  <httpj:engine-factory>
+   <httpj:engine port="9001">
+    <httpj:tlsServerParameters>
+      <sec:keyManagers keyPassword="skpass">
+           <sec:keyStore file="src/main/config/serviceKeystore.jks" password="sspass" type="JKS"/>
+      </sec:keyManagers>
+      <sec:trustManagers>
+           <sec:keyStore file="src/main/config/serviceKeystore.jks" password="sspass" type="JKS"/>
+      </sec:trustManagers>
+      <sec:cipherSuitesFilter>
+        <!-- these filters ensure that a ciphersuite with
+          export-suitable or null encryption is used,
+          but exclude anonymous Diffie-Hellman key change as
+          this is vulnerable to man-in-the-middle attacks -->
+        <sec:include>.*_EXPORT_.*</sec:include>
+        <sec:include>.*_EXPORT1024_.*</sec:include>
+        <sec:include>.*_WITH_DES_.*</sec:include>
+        <sec:include>.*_WITH_AES_.*</sec:include>
+        <sec:include>.*_WITH_NULL_.*</sec:include>
+        <sec:exclude>.*_DH_anon_.*</sec:exclude>
+      </sec:cipherSuitesFilter>
+      <sec:clientAuthentication want="true" required="true"/>
+    </httpj:tlsServerParameters>
+   </httpj:engine>
+  </httpj:engine-factory>
+</beans>