You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2008/12/10 16:46:12 UTC

svn commit: r725316 - in /cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client: ./ src/ src/demo/hw/client/ src/demo/hw/server/ wsdl/

Author: bimargulies
Date: Wed Dec 10 07:46:11 2008
New Revision: 725316

URL: http://svn.apache.org/viewvc?rev=725316&view=rev
Log:
Add a sample to help people who want to use Aegis to talk to some pre-existing service.

Added:
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/   (props changed)
      - copied from r725071, cxf/trunk/distribution/src/main/release/samples/aegis/
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/README.txt
      - copied, changed from r725314, cxf/trunk/distribution/src/main/release/samples/aegis/README.txt
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/build.xml
      - copied unchanged from r725314, cxf/trunk/distribution/src/main/release/samples/aegis/build.xml
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/pom.xml
      - copied, changed from r725314, cxf/trunk/distribution/src/main/release/samples/aegis/pom.xml
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/
      - copied from r725314, cxf/trunk/distribution/src/main/release/samples/aegis/src/
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/wsdl/
      - copied from r725314, cxf/trunk/distribution/src/main/release/samples/aegis/wsdl/
Removed:
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/HelloWorld.aegis.xml
Modified:
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/HelloWorld.java
    cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/Server.java

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Dec 10 07:46:11 2008
@@ -0,0 +1 @@
+target

Copied: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/README.txt (from r725314, cxf/trunk/distribution/src/main/release/samples/aegis/README.txt)
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/README.txt?p2=cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/README.txt&p1=cxf/trunk/distribution/src/main/release/samples/aegis/README.txt&r1=725314&r2=725316&rev=725316&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/aegis/README.txt (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/README.txt Wed Dec 10 07:46:11 2008
@@ -1,8 +1,17 @@
 Aegis Demo
 ====================
 
-This demo illustrates how to develop a service use the "code first", pojo based.
-This demo uses the Aegis data binding.
+This demo sets up a server with JAX-WS and JAXB, and a client with Aegis.
+It is very unlikely that you will want to intentionally build a system
+with this arrangement. However, this sample demonstrates using Aegis on
+the client with someone else's service.
+
+In a real application, the client would have a completely separate implementation
+of a SEI for use with Aegis. Since CXF does not have a 'wsdl2java' tool for Aegis,
+this is a manual process. If you do have access to the SEI source code for the
+server, you merely need to add .aegis.xml files to specify the information
+otherwise present in the @nnotations. Note that the client needs both the WSDL
+and the .aegis.xml file to achieve coherence.
 
 Prerequisite
 ------------

Copied: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/pom.xml (from r725314, cxf/trunk/distribution/src/main/release/samples/aegis/pom.xml)
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/pom.xml?p2=cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/pom.xml&p1=cxf/trunk/distribution/src/main/release/samples/aegis/pom.xml&r1=725314&r2=725316&rev=725316&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/aegis/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/pom.xml Wed Dec 10 07:46:11 2008
@@ -2,7 +2,7 @@
 <project>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.cxf.samples</groupId>
-    <artifactId>aegis</artifactId>
+    <artifactId>jax_service_aegis_client</artifactId>
     <version>1.0</version>
     <properties>
             <cxf.version>[2,)</cxf.version>

Modified: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java?rev=725316&r1=725314&r2=725316&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/Client.java Wed Dec 10 07:46:11 2008
@@ -19,7 +19,8 @@
 
 package demo.hw.client;
 
-import demo.hw.server.HelloWorld;
+import javax.xml.namespace.QName;
+
 import org.apache.cxf.aegis.databinding.AegisDatabinding;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 
@@ -31,11 +32,15 @@
     public static void main(String args[]) throws Exception {
         ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
         factory.setServiceClass(HelloWorld.class);
+        String serviceURL;
         if (args != null && args.length > 0 && !"".equals(args[0])) {
-            factory.setAddress(args[0]);
+            serviceURL = args[0];
         } else {
-            factory.setAddress("http://localhost:9000/Hello");
+            serviceURL = "http://localhost:9000/Hello";
         }
+        factory.setServiceName(new QName("http://server.hw.demo/", "HelloWorldService"));
+        factory.setAddress(serviceURL);
+        factory.setWsdlURL(serviceURL + "?wsdl");
         factory.getServiceFactory().setDataBinding(new AegisDatabinding());
         HelloWorld client = (HelloWorld)factory.create();
         System.out.println("Invoke sayHi()....");

Added: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml?rev=725316&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml Wed Dec 10 07:46:11 2008
@@ -0,0 +1,26 @@
+<?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.
+-->
+<mappings>
+    <mapping name="HelloWorld">
+        <method name="sayHi">
+            <parameter index="0" name="greeting" />
+        </method>
+    </mapping>
+</mappings>

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.java?rev=725316&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.java Wed Dec 10 07:46:11 2008
@@ -0,0 +1,29 @@
+/**
+ * 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.client;
+
+/**
+ * A 'clean' copy of the SEI that does not have any annotations.
+ */
+public interface HelloWorld {
+    
+    String sayHi(String text);
+
+}
+

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/client/HelloWorld.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/HelloWorld.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/HelloWorld.java?rev=725316&r1=725314&r2=725316&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/HelloWorld.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/HelloWorld.java Wed Dec 10 07:46:11 2008
@@ -18,9 +18,13 @@
  */
 package demo.hw.server;
 
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService
 public interface HelloWorld {
     
-    String sayHi(String text);
+    String sayHi(@WebParam(name = "greeting") String text);
 
 }
 

Modified: cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/Server.java?rev=725316&r1=725314&r2=725316&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/Server.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_server_aegis_client/src/demo/hw/server/Server.java Wed Dec 10 07:46:11 2008
@@ -19,18 +19,17 @@
 
 package demo.hw.server;
 
-import org.apache.cxf.aegis.databinding.AegisDatabinding;
 import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 
 public class Server {
 
     protected Server() throws Exception {
         HelloWorldImpl helloworldImpl = new HelloWorldImpl();
-        ServerFactoryBean svrFactory = new ServerFactoryBean();
+        ServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
         svrFactory.setServiceClass(HelloWorld.class);
         svrFactory.setAddress("http://localhost:9000/Hello");
         svrFactory.setServiceBean(helloworldImpl);
-        svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
         svrFactory.create();
     }