summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk/itest
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2011-12-04 18:10:28 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2011-12-04 18:10:28 +0000
commitd7e5b6bef7f0ea0f062a0b715fdf4281ca65bcd5 (patch)
treed317d71fc9d49fd867d7802a57ca26c7818ffda1 /sca-java-1.x/trunk/itest
parentd505f2c08f09cb2feaa3c7be5f55cc05f0556c93 (diff)
TUSCANY-3984: Support binding.ws, interface.wsdl and policySets for serialized service references
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1210165 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/itest')
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/pom.xml65
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldServiceComponent.java80
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/definitions.xml25
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldws.composite35
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldwsclient.composite37
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/wsdl/helloworld.wsdl85
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldClientTestCase.java66
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldTestServer.java55
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/pom.xml87
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ClientPWCBHandler.java45
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldService.java29
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldServiceComponent.java78
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ServerPWCBHandler.java55
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler21
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/definitions.xml203
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldKeys.jksbin0 -> 1354 bytes
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldws.composite42
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldwsclient.composite59
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/wsdl/helloworld.wsdl85
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldClientTestCase.java82
-rw-r--r--sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldTestServer.java55
24 files changed, 1384 insertions, 0 deletions
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/pom.xml b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/pom.xml
new file mode 100644
index 0000000000..4b1302e1ab
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/pom.xml
@@ -0,0 +1,65 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-serialization-ws-basicauth</artifactId>
+ <name>Apache Tuscany SCA iTest Serialized Service Reference Using HTTP Basic Auth</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..4cdcc1fd0b
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldImpl.java
@@ -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 helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..c0259c6e07
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldService.java
@@ -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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..4d35fbac77
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -0,0 +1,80 @@
+/*
+ * 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 helloworld;
+
+import java.io.IOException;
+import java.io.StringReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ ServiceReference<HelloWorldService> helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ //return helloWorldService.getService().getGreetings(name);
+ String xml = null;
+ try {
+ xml = serializeServiceReferenceXML(helloWorldService);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "serialization failure";
+ }
+ System.out.println(xml);
+ ServiceReference<HelloWorldService> srCopy = null;
+ try {
+ srCopy = deserializeServiceReferenceXML(xml);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "deserialization failure";
+ }
+ return srCopy.getService().getGreetings(name);
+ }
+
+ private String serializeServiceReferenceXML(ServiceReference<HelloWorldService> sr) throws IOException {
+ ServiceReferenceImpl<HelloWorldService> sri = (ServiceReferenceImpl<HelloWorldService>) sr;
+ return sri.toXMLString();
+ }
+
+ private ServiceReference<HelloWorldService> deserializeServiceReferenceXML(String serializedSR) throws Exception {
+ StringReader reader = new StringReader(serializedSR);
+ XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(reader);
+ ServiceReferenceImpl<HelloWorldService> sri
+ = new ServiceReferenceImpl<HelloWorldService>(/*HelloWorldService.class, */xmlReader);
+ return sri;
+ }
+
+ public ServiceReference<HelloWorldService> getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ @Reference
+ public void setHelloWorldService(ServiceReference<HelloWorldService> helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/definitions.xml b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..463229c3a8
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/definitions.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ASCII"?>
+<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" >
+
+ <sca:policySet name="ClientBasicAuthenticationPolicySet"
+ provides="authentication"
+ appliesTo="sca:reference/sca:binding.ws">
+ <tuscany:basicAuthentication>
+ <tuscany:userName>TuscanyWsUser</tuscany:userName>
+ <tuscany:password>TuscanyWsUserPasswd</tuscany:password>
+ </tuscany:basicAuthentication>
+ </sca:policySet>
+
+ <sca:policySet name="ServerBasicAuthenticationPolicySet"
+ provides="authentication"
+ appliesTo="sca:service/sca:binding.ws">
+ <tuscany:basicAuthentication>
+ <tuscany:userName>TuscanyWsUser</tuscany:userName>
+ <tuscany:password>TuscanyWsUserPasswd</tuscany:password>
+ </tuscany:basicAuthentication>
+ </sca:policySet>
+
+</definitions>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldws.composite b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..949d7d4292
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldws.composite
@@ -0,0 +1,35 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <service name="HelloWorldService" requires="authentication" promote="HelloWorldServiceComponent/HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldwsclient.composite b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldwsclient.composite
new file mode 100644
index 0000000000..9bfcf80c6c
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/helloworldwsclient.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="helloworldwsclient">
+
+ <!-- A component with an embedded reference definition connecting to an external webservice
+ The wsdl interface for the reference is derived from the information specified by the 'wsdlElement'
+ -->
+ <component name="HelloTuscanyServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" requires="authentication">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/>
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..e6fcc6f4a6
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,85 @@
+<?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 targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/HelloWorldService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:service name="HelloWorldWsPolicyService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/HelloWorldWsPolicyService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldClientTestCase.java b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldClientTestCase.java
new file mode 100644
index 0000000000..6b9ede4efd
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldClientTestCase.java
@@ -0,0 +1,66 @@
+/*
+ * 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 helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldClientTestCase {
+
+ private HelloWorldService helloTuscanyService;
+ private SCADomain scaDomain;
+
+ private SCATestCaseRunner server;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
+
+ server = new SCATestCaseRunner(HelloWorldTestServer.class);
+ server.before();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testEmbeddedReferenceClient() throws Exception {
+ String msg = helloTuscanyService.getGreetings("Tuscany");
+ Assert.assertEquals("Hello Tuscany", msg);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldTestServer.java b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldTestServer.java
new file mode 100644
index 0000000000..21f2166560
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws-basicauth/src/test/java/helloworld/HelloWorldTestServer.java
@@ -0,0 +1,55 @@
+/*
+ * 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 helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class HelloWorldTestServer {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldws.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/pom.xml b/sca-java-1.x/trunk/itest/serialization-ws/pom.xml
new file mode 100644
index 0000000000..b41e314e03
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/pom.xml
@@ -0,0 +1,87 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-serialization-ws</artifactId>
+ <name>Apache Tuscany SCA iTest Serialized Service Reference Using Web Services</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.security</groupId>
+ <artifactId>wss4j</artifactId>
+ <version>1.5.4</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.santuario</groupId>
+ <artifactId>xmlsec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>bouncycastle</groupId>
+ <artifactId>bcprov-jdk13</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>bouncycastle</groupId>
+ <artifactId>bcprov-jdk15</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>opensaml</groupId>
+ <artifactId>opensaml</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.7-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ClientPWCBHandler.java b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ClientPWCBHandler.java
new file mode 100644
index 0000000000..0f1ebf46d6
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ClientPWCBHandler.java
@@ -0,0 +1,45 @@
+/*
+ * 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 helloworld;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ClientPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Client UserId/Password Handler .... ");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("User Id = " + pwcb.getIdentifer());
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ System.out.println("Set Password = " + pwcb.getPassword());
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..4cdcc1fd0b
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldImpl.java
@@ -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 helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..c0259c6e07
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldService.java
@@ -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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+public interface HelloWorldService {
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..3a8edf372f
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/HelloWorldServiceComponent.java
@@ -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 helloworld;
+
+import java.io.IOException;
+import java.io.StringReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ ServiceReference<HelloWorldService> helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ String xml = null;
+ try {
+ xml = serializeServiceReferenceXML(helloWorldService);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "serialization failure";
+ }
+ System.out.println(xml);
+ ServiceReference<HelloWorldService> srCopy = null;
+ try {
+ srCopy = deserializeServiceReferenceXML(xml);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "deserialization failure";
+ }
+ return srCopy.getService().getGreetings(name);
+ }
+
+ public ServiceReference<HelloWorldService> getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ @Reference
+ public void setHelloWorldService(ServiceReference<HelloWorldService> helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+
+ private String serializeServiceReferenceXML(ServiceReference<HelloWorldService> sr) throws IOException {
+ ServiceReferenceImpl<HelloWorldService> sri = (ServiceReferenceImpl<HelloWorldService>) sr;
+ return sri.toXMLString();
+ }
+
+ private ServiceReference<HelloWorldService> deserializeServiceReferenceXML(String serializedSR) throws Exception {
+ StringReader reader = new StringReader(serializedSR);
+ XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(reader);
+ ServiceReferenceImpl<HelloWorldService> sri = new ServiceReferenceImpl<HelloWorldService>(xmlReader);
+ return sri;
+ }
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ServerPWCBHandler.java b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ServerPWCBHandler.java
new file mode 100644
index 0000000000..ded02f09d6
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/java/helloworld/ServerPWCBHandler.java
@@ -0,0 +1,55 @@
+/*
+ * 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 helloworld;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * Sample userid passwd generation class
+ */
+public class ServerPWCBHandler implements CallbackHandler {
+
+ public void handle(Callback[] callbacks) throws IOException,
+ UnsupportedCallbackException {
+ for (int i = 0; i < callbacks.length; i++) {
+ System.out.println("*** Calling Server User/Passwd Handler....");
+ WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
+ System.out.println("User Id = " + pwcb.getIdentifer());
+ System.out.println("Password = " + pwcb.getPassword());
+
+ if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) {
+ if ( pwcb.getIdentifer().equals("TuscanyWsUser") &&
+ pwcb.getPassword().equals("TuscanyWsUserPasswd") ){
+ return;
+ } else {
+ throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch");
+ }
+ } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) {
+ pwcb.setPassword("TuscanyWsUserPasswd");
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
new file mode 100644
index 0000000000..8b089c7222
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
@@ -0,0 +1,21 @@
+# 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.
+#
+# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
+# handler classname;qname=<policy intent addressed>;model=<policy model class>
+org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://helloworld#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
+org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://helloworld#wsIntegrity,model=org.apache.neethi.Policy \ No newline at end of file
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/definitions.xml b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/definitions.xml
new file mode 100644
index 0000000000..db1e2b291d
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/definitions.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:hw="http://helloworld">
+
+ <!-- WS Security POLICY SETS -->
+ <sca:policySet name="wsClientAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:reference/sca:binding.ws">
+ <tuscany:wsConfigParam>
+ <parameter name="OutflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <user>TuscanyWsUser</user>
+ <passwordCallbackClass>helloworld.ClientPWCBHandler</passwordCallbackClass>" +
+ <passwordType>PasswordText</passwordType>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <!-- A policyset that uses WS Policy -->
+ <sca:policySet name="wsSecurityPolicyForIntegrity"
+ provides="integrity"
+ appliesTo="sca:reference/sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>helloworld.ClientPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">helloworldKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+
+ <!-- Policysets for unit tests that use the testHelloworldws.composite -->
+ <!-- Since we use the helloworld-ws-service for the unit testing we need to
+ declare these policy sets and with the 'provides' set to the intents that the
+ composite in the helloworld-ws-service uses. -->
+ <sca:policySet name="wsAuthenticationPolicy"
+ provides="authentication"
+ appliesTo="sca:service/sca:binding.ws"
+ >
+ <tuscany:wsConfigParam>
+ <parameter name="InflowSecurity">
+ <action>
+ <items>UsernameToken</items>
+ <passwordCallbackClass>helloworld.ServerPWCBHandler</passwordCallbackClass>
+ </action>
+ </parameter>
+ </tuscany:wsConfigParam>
+ </sca:policySet>
+
+ <sca:policySet name="wsServerSecurityPolicyForIntegrity"
+ provides="integrity"
+ appliesTo="sca:service/sca:binding.ws">
+ <wsp:Policy wsu:Id="SignOnly"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>TuscanyWsUser</ramp:user>
+ <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>helloworld.ServerPWCBHandler</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">helloworldKeys.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sca:policySet>
+
+ </sca:definitions>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldKeys.jks b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldKeys.jks
new file mode 100644
index 0000000000..e2184ad3c6
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldKeys.jks
Binary files differ
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldws.composite b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..a078067e9a
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldws.composite
@@ -0,0 +1,42 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <service name="HelloWorldService" requires="authentication" promote="HelloWorldServiceComponent/HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+
+ <service name="HelloWorldWsPolicyService" promote="HelloWorldServiceComponent/HelloWorldService"
+ requires="integrity">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/HelloWorldWsPolicyService"/>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldwsclient.composite b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldwsclient.composite
new file mode 100644
index 0000000000..a57f3620ba
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/helloworldwsclient.composite
@@ -0,0 +1,59 @@
+<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+ name="helloworldwsclient">
+
+ <!-- A component with an embedded reference definition connecting to an external webservice
+ The wsdl interface for the reference is derived from the information specified by the 'wsdlElement'
+ -->
+ <component name="HelloTuscanyServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" requires="authentication">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/>
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+ </component>
+
+ <!-- A component with a reference promoted as a composite reference -->
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ </component>
+
+ <!-- A component with a reference promoted as a composite reference with a ws policy -->
+ <component name="HelloWorldWsPolicyServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService"
+ requires="authentication">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+ <reference name="HelloWorldWsPolicyService" promote="HelloWorldWsPolicyServiceComponent/helloWorldService"
+ requires="integrity">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldWsPolicyService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..e6fcc6f4a6
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/main/resources/wsdl/helloworld.wsdl
@@ -0,0 +1,85 @@
+<?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 targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getGreetingsResponse">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/HelloWorldService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+ <wsdl:service name="HelloWorldWsPolicyService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/HelloWorldWsPolicyService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldClientTestCase.java b/sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldClientTestCase.java
new file mode 100644
index 0000000000..8dabe87be6
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldClientTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * 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 helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldClientTestCase {
+
+ private HelloWorldService helloWorldService;
+ private HelloWorldService helloTuscanyService;
+ private HelloWorldService helloWsPolicyService;
+ private SCADomain scaDomain;
+
+ private SCATestCaseRunner server;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+ helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
+ helloWsPolicyService = scaDomain.getService(HelloWorldService.class, "HelloWorldWsPolicyServiceComponent");
+
+ server = new SCATestCaseRunner(HelloWorldTestServer.class);
+ server.before();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ String msg = helloWorldService.getGreetings("Smith");
+ Assert.assertEquals("Hello Smith", msg);
+ }
+
+ @Test
+ public void testEmbeddedReferenceClient() throws Exception {
+ String msg = helloTuscanyService.getGreetings("Tuscany");
+ Assert.assertEquals("Hello Tuscany", msg);
+ }
+
+ @Test
+ public void testWsPolicyClient() throws Exception {
+ String msg = helloWsPolicyService.getGreetings("WsPolicyWorld");
+ Assert.assertEquals("Hello WsPolicyWorld", msg);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldTestServer.java b/sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldTestServer.java
new file mode 100644
index 0000000000..21f2166560
--- /dev/null
+++ b/sca-java-1.x/trunk/itest/serialization-ws/src/test/java/helloworld/HelloWorldTestServer.java
@@ -0,0 +1,55 @@
+/*
+ * 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 helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class HelloWorldTestServer {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldws.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}