You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/08/26 22:12:29 UTC
svn commit: r1517679 - in
/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut:
pom.xml src/main/java/demo/wssec/client/Client.java
src/main/java/demo/wssec/server/Server.java
Author: dkulp
Date: Mon Aug 26 20:12:28 2013
New Revision: 1517679
URL: http://svn.apache.org/r1517679
Log:
Merged revisions 1517663 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1517663 | dkulp | 2013-08-26 15:55:23 -0400 (Mon, 26 Aug 2013) | 2 lines
Fix ut demo to also work with ws-discovery
........
Modified:
cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/pom.xml
cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/client/Client.java
cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/server/Server.java
Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/pom.xml?rev=1517679&r1=1517678&r2=1517679&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/pom.xml (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/pom.xml Mon Aug 26 20:12:28 2013
@@ -140,6 +140,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+
</dependencies>
</project>
Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/client/Client.java?rev=1517679&r1=1517678&r2=1517679&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/client/Client.java (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/client/Client.java Mon Aug 26 20:12:28 2013
@@ -28,6 +28,7 @@ import java.util.Map;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.hello_world_soap_http.Greeter;
import org.apache.cxf.hello_world_soap_http.GreeterService;
import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
@@ -56,17 +57,20 @@ public final class Client {
outProps.put("user", "abcd");
outProps.put("passwordCallbackClass", "demo.wssec.client.UTPasswordCallback");
- bus.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
Map<String, Object> inProps = new HashMap<String, Object>();
inProps.put("action", "UsernameToken Timestamp");
inProps.put("passwordType", "PasswordText");
inProps.put("passwordCallbackClass", "demo.wssec.client.UTPasswordCallback");
- bus.getInInterceptors().add(new WSS4JInInterceptor(inProps));
GreeterService service = new GreeterService();
Greeter port = service.getGreeterPort();
+ org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
+ client.getInInterceptors().add(new WSS4JInInterceptor(inProps));
+ client.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
+
+
String[] names = new String[] {"Anne", "Bill", "Chris", "Scott"};
// make a sequence of 4 invocations
Modified: cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/server/Server.java?rev=1517679&r1=1517678&r2=1517679&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/server/Server.java (original)
+++ cxf/branches/2.7.x-fixes/distribution/src/main/release/samples/ws_security/ut/src/main/java/demo/wssec/server/Server.java Mon Aug 26 20:12:28 2013
@@ -20,7 +20,6 @@
package demo.wssec.server;
import java.net.URL;
-
import java.util.HashMap;
import java.util.Map;
@@ -29,6 +28,7 @@ import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
@@ -41,16 +41,8 @@ public class Server {
Object implementor = new GreeterImpl();
String address = "http://localhost:9000/SoapContext/GreeterPort";
- Endpoint.publish(address, implementor);
- }
-
- public static void main(String args[]) throws Exception {
-
- SpringBusFactory bf = new SpringBusFactory();
- URL busFile = Server.class.getResource("/wssec.xml");
- Bus bus = bf.createBus(busFile.toString());
-
-
+ EndpointImpl impl = (EndpointImpl)Endpoint.publish(address, implementor);
+
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put("action", "UsernameToken Timestamp");
@@ -58,14 +50,21 @@ public class Server {
outProps.put("user", "Alice");
outProps.put("passwordCallbackClass", "demo.wssec.server.UTPasswordCallback");
- bus.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
+ impl.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
Map<String, Object> inProps = new HashMap<String, Object>();
inProps.put("action", "UsernameToken Timestamp");
inProps.put("passwordType", "PasswordDigest");
inProps.put("passwordCallbackClass", "demo.wssec.server.UTPasswordCallback");
- bus.getInInterceptors().add(new WSS4JInInterceptor(inProps));
+ impl.getInInterceptors().add(new WSS4JInInterceptor(inProps));
+ }
+
+ public static void main(String args[]) throws Exception {
+
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = Server.class.getResource("/wssec.xml");
+ Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);