diff options
Diffstat (limited to 'branches/sca-java-1.2/samples/helloworld-ws-service-secure/src')
9 files changed, 0 insertions, 460 deletions
diff --git a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 0de3c70303..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -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/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java deleted file mode 100644 index e03ed4dc25..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This server program shows how to create an SCA runtime, and start it which - * activates the helloworld Web service endpoint. - */ -public class HelloWorldServer { - - public static void main(String[] args) { - - SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite"); - - try { - System.out.println("HelloWorld server started (press enter to shutdown)"); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - scaDomain.close(); - System.out.println("HelloWorld server stopped"); - } - -} diff --git a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 7245513b2a..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.osoa.sca.annotations.Remotable; - -/** - * This is the business interface of the HelloWorld greetings service. - */ -@Remotable -public interface HelloWorldService { - - public String getGreetings(String name); -} - diff --git a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java deleted file mode 100644 index def19b4f40..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -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/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml deleted file mode 100644 index 1f4a8ff819..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml +++ /dev/null @@ -1,113 +0,0 @@ -<?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://www.osoa.org/xmlns/sca/1.0" - 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="hw:wsAuthenticationPolicy" - provides="authentication" - appliesTo="sca:binding.ws" - > - <tuscany:wsConfigParam> - <parameter name="InflowSecurity"> - <action> - <items>UsernameToken</items> - <passwordCallbackClass>helloworld.ServerPWCBHandler</passwordCallbackClass> - </action> - </parameter> - </tuscany:wsConfigParam> - </sca:policySet> - - <!-- A policyset that uses WS Policy --> - <sca:policySet name="hw:wsSecurityPolicyForIntegrity" - provides="integrity" - appliesTo="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>
\ No newline at end of file diff --git a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks Binary files differdeleted file mode 100644 index 0b4f2399f0..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks +++ /dev/null diff --git a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite deleted file mode 100644 index d1e18d7929..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite +++ /dev/null @@ -1,41 +0,0 @@ -<?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 uri="http://localhost:8085/HelloWorldWsPolicyService"/>
- </service>
-
- <component name="HelloWorldServiceComponent">
- <implementation.java class="helloworld.HelloWorldImpl" /> - </component>
-
-</composite>
diff --git a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 068229be6f..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,79 +0,0 @@ -<?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/HelloWorldServiceComponent"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java b/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java deleted file mode 100644 index 26c222cece..0000000000 --- a/branches/sca-java-1.2/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -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; - -/** - * Tests that the helloworld server is available - */ -public class HelloWorldServerTestCase{ - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - scaDomain = SCADomain.newInstance("helloworldws.composite"); - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @Test - public void testServiceCall() throws IOException { - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); - assertNotNull(helloWorldService); - - assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } - -} |