diff options
Diffstat (limited to 'branches')
8 files changed, 370 insertions, 87 deletions
diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/anotherpackage/BBean.java b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/anotherpackage/BBean.java new file mode 100644 index 0000000000..f9578a5f92 --- /dev/null +++ b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/anotherpackage/BBean.java @@ -0,0 +1,42 @@ +/* + * 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 anotherpackage; + +public class BBean { + + protected String field1; + protected String field2; + + public String getField1() { + return field1; + } + + public void setField1(String field1) { + this.field1 = field1; + } + + public String getField2() { + return field2; + } + + public void setField2(String field2) { + this.field2 = field2; + } +} + diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/anotherpackage/CBean.java b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/anotherpackage/CBean.java new file mode 100644 index 0000000000..b1b3801210 --- /dev/null +++ b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/anotherpackage/CBean.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 anotherpackage; + +import javax.xml.bind.annotation.XmlType; + +@XmlType(name="") +public class CBean { + + protected String field1; + protected String field2; + + public String getField1() { + return field1; + } + + public void setField1(String field1) { + this.field1 = field1; + } + + public String getField2() { + return field2; + } + + public void setField2(String field2) { + this.field2 = field2; + } +} + diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java index 8a99a81132..0d2f9bf380 100644 --- a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java +++ b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java @@ -18,10 +18,13 @@ */ package helloworld; +import anotherpackage.BBean; + public class ABean { protected String field1; protected String field2; + protected BBean field3; public String getField1() { return field1; @@ -38,5 +41,13 @@ public class ABean { public void setField2(String field2) { this.field2 = field2; } + + public BBean getField3() { + return field3; + } + + public void setField3(BBean field3) { + this.field3 = field3; + } } diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java index 83165307af..788eded6f9 100644 --- a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java +++ b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java @@ -18,13 +18,17 @@ */ package helloworld; -import java.util.Vector; +import javax.jws.WebService; import org.osoa.sca.annotations.Service; +import anotherpackage.BBean; +import anotherpackage.CBean; + /** * This class implements the HelloWorld service. */ +@WebService @Service(HelloWorldService.class) public class HelloWorldImpl implements HelloWorldService { @@ -45,4 +49,12 @@ public class HelloWorldImpl implements HelloWorldService { return "Hello " + bean.get(0).getField1() + " " + bean.get(0).getField2(); } */ + + public String getGreetingsBBean(BBean bean){ + return "Hello " + bean.getField1() + " " + bean.getField2(); + } + + public String getGreetingsCBean(CBean bean){ + return "Hello " + bean.getField1() + " " + bean.getField2(); + } } diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java index 6f3d57e6f7..9922b8a233 100644 --- a/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java +++ b/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java @@ -18,10 +18,11 @@ */ package helloworld; -import java.util.Vector; - import org.osoa.sca.annotations.Remotable; +import anotherpackage.BBean; +import anotherpackage.CBean; + /** * This is the business interface of the HelloWorld greetings service. */ @@ -32,5 +33,7 @@ public interface HelloWorldService { public String getGreetingsBean(ABean bean); public String getGreetingsBeanArray(ABean[] bean); //public String getGreetingsBeanVector(Vector<ABean> bean); + public String getGreetingsBBean(BBean bean); + public String getGreetingsCBean(CBean bean); } diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld1.composite b/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld1.composite new file mode 100644 index 0000000000..12ef393521 --- /dev/null +++ b/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld1.composite @@ -0,0 +1,33 @@ +<?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" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://helloworld" + xmlns:hw="http://helloworld" + name="helloworldws"> + + <component name="HelloWorldServiceComponent1"> + <implementation.java class="helloworld.HelloWorldImpl" /> + <service name="HelloWorldService"> + <binding.ws/> + </service> + </component> + +</composite> diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl b/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl index c76ed7b338..35dfe95359 100644 --- a/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl +++ b/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl @@ -15,83 +15,121 @@ governing permissions and limitations * under the License. --> <wsdl:definitions name="HelloWorldServiceService" - targetNamespace="http://helloworld/" - xmlns:tns="http://helloworld/" - xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" - xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/"> + targetNamespace="http://helloworld/" xmlns:tns="http://helloworld/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/"> <wsdl:types> - <xs:schema targetNamespace="http://test" version="1.0" - xmlns:tns="http://test" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:complexType name="aBean"> + <xs:schema targetNamespace="http://helloworld/" + version="1.0" xmlns:ns1="http://test" xmlns:tns="http://helloworld/" + xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:import namespace="http://test" /> + + <xs:element name="getGreetings" type="tns:getGreetings" /> + <xs:element name="getGreetingsBBean" type="tns:getGreetingsBBean" /> + <xs:element name="getGreetingsBBeanResponse" + type="tns:getGreetingsBBeanResponse" /> + <xs:element name="getGreetingsBean" type="tns:getGreetingsBean" /> + <xs:element name="getGreetingsBeanArray" type="tns:getGreetingsBeanArray" /> + <xs:element name="getGreetingsBeanArrayResponse" + type="tns:getGreetingsBeanArrayResponse" /> + <xs:element name="getGreetingsBeanResponse" type="tns:getGreetingsBeanResponse" /> + <xs:element name="getGreetingsCBean" type="tns:getGreetingsCBean" /> + <xs:element name="getGreetingsCBeanResponse" + type="tns:getGreetingsCBeanResponse" /> + + <xs:element name="getGreetingsResponse" type="tns:getGreetingsResponse" /> + <xs:complexType name="getGreetingsBBeanResponse"> <xs:sequence> - <xs:element minOccurs="0" name="field1" + <xs:element minOccurs="0" name="return" type="xs:string" /> - <xs:element minOccurs="0" name="field2" + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetingsCBeanResponse"> + <xs:sequence> + <xs:element minOccurs="0" name="return" + type="xs:string" /> + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetingsBeanArrayResponse"> + <xs:sequence> + <xs:element minOccurs="0" name="return" + type="xs:string" /> + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetingsResponse"> + <xs:sequence> + <xs:element minOccurs="0" name="return" + type="xs:string" /> + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetings"> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" type="xs:string" /> </xs:sequence> </xs:complexType> - <xs:complexType final="#all" name="aBeanArray"> + <xs:complexType name="getGreetingsBeanResponse"> + <xs:sequence> + <xs:element minOccurs="0" name="return" + type="xs:string" /> + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetingsBean"> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" + type="ns1:aBean" /> + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetingsCBean"> + <xs:sequence> + <xs:element minOccurs="0" name="arg0"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" + name="field1" type="xs:string" /> + <xs:element minOccurs="0" + name="field2" type="xs:string" /> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetingsBBean"> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" + type="tns:bBean" /> + </xs:sequence> + </xs:complexType> + <xs:complexType name="getGreetingsBeanArray"> <xs:sequence> <xs:element maxOccurs="unbounded" - minOccurs="0" name="item" nillable="true" type="tns:aBean" /> + minOccurs="0" name="arg0" nillable="true" type="ns1:aBean" /> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="bBean"> + <xs:sequence> + <xs:element minOccurs="0" name="field1" + type="xs:string" /> + <xs:element minOccurs="0" name="field2" + type="xs:string" /> </xs:sequence> </xs:complexType> </xs:schema> - <xs:schema attributeFormDefault="qualified" - elementFormDefault="unqualified" targetNamespace="http://helloworld/" - xmlns:ns0="http://test" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:import namespace="http://test" /> - <xs:element name="getGreetingsBean"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="arg0" - nillable="true" type="ns0:aBean" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="getGreetings"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="arg0" - nillable="true" type="xs:string" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="getGreetingsResponse"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="return" - nillable="true" type="xs:string" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="getGreetingsBeanResponse"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="return" - nillable="true" type="xs:string" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="getGreetingsBeanArrayResponse"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="return" - nillable="true" type="xs:string" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="getGreetingsBeanArray"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" - minOccurs="0" name="arg0" nillable="true" - type="ns0:aBean" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xs:schema targetNamespace="http://test" version="1.0" + xmlns:__nnns="http://helloworld/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + <xs:import namespace="http://helloworld/" /> + + <xs:complexType name="aBean"> + <xs:sequence> + <xs:element minOccurs="0" name="field1" + type="xs:string" /> + <xs:element minOccurs="0" name="field2" + type="xs:string" /> + <xs:element minOccurs="0" name="field3" + type="__nnns:bBean" /> + </xs:sequence> + </xs:complexType> </xs:schema> </wsdl:types> <wsdl:message name="getGreetingsBean"> @@ -101,12 +139,27 @@ <wsdl:message name="getGreetings"> <wsdl:part name="getGreetings" element="tns:getGreetings"> </wsdl:part> + + </wsdl:message> + <wsdl:message name="getGreetingsCBean"> + <wsdl:part name="getGreetingsCBean" element="tns:getGreetingsCBean"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="getGreetingsCBeanResponse"> + <wsdl:part name="getGreetingsCBeanResponse" element="tns:getGreetingsCBeanResponse"> + </wsdl:part> + </wsdl:message> + + <wsdl:message name="getGreetingsBBean"> + <wsdl:part name="getGreetingsBBean" element="tns:getGreetingsBBean"> + </wsdl:part> </wsdl:message> <wsdl:message name="getGreetingsResponse"> <wsdl:part name="getGreetingsResponse" element="tns:getGreetingsResponse"> </wsdl:part> </wsdl:message> <wsdl:message name="getGreetingsBeanResponse"> + <wsdl:part name="getGreetingsBeanResponse" element="tns:getGreetingsBeanResponse"> </wsdl:part> </wsdl:message> @@ -115,6 +168,11 @@ element="tns:getGreetingsBeanArrayResponse"> </wsdl:part> </wsdl:message> + <wsdl:message name="getGreetingsBBeanResponse"> + <wsdl:part name="getGreetingsBBeanResponse" element="tns:getGreetingsBBeanResponse"> + + </wsdl:part> + </wsdl:message> <wsdl:message name="getGreetingsBeanArray"> <wsdl:part name="getGreetingsBeanArray" element="tns:getGreetingsBeanArray"> </wsdl:part> @@ -122,6 +180,7 @@ <wsdl:portType name="HelloWorldService"> <wsdl:operation name="getGreetings"> <wsdl:input message="tns:getGreetings"> + </wsdl:input> <wsdl:output message="tns:getGreetingsResponse"> </wsdl:output> @@ -131,6 +190,7 @@ </wsdl:input> <wsdl:output message="tns:getGreetingsBeanResponse"> </wsdl:output> + </wsdl:operation> <wsdl:operation name="getGreetingsBeanArray"> <wsdl:input message="tns:getGreetingsBeanArray"> @@ -138,64 +198,70 @@ <wsdl:output message="tns:getGreetingsBeanArrayResponse"> </wsdl:output> </wsdl:operation> + <wsdl:operation name="getGreetingsBBean"> + <wsdl:input message="tns:getGreetingsBBean"> + + </wsdl:input> + <wsdl:output message="tns:getGreetingsBBeanResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="getGreetingsCBean"> + <wsdl:input message="tns:getGreetingsCBean"> + </wsdl:input> + <wsdl:output message="tns:getGreetingsCBeanResponse"> + </wsdl:output> + + </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloWorldJmsBinding" type="tns:HelloWorldService"> <SOAP:binding style="document" - transport="http://schemas.xmlsoap.org/soap/jms" /> + transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getGreetings"> - <SOAP:operation soapAction="urn:getGreetings" /> + <SOAP:operation /> <wsdl:input> <SOAP:body use="literal" /> </wsdl:input> + <wsdl:output> <SOAP:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getGreetingsBean"> - <SOAP:operation soapAction="urn:getGreetingsBean" /> + <SOAP:operation /> <wsdl:input> <SOAP:body use="literal" /> </wsdl:input> + <wsdl:output> <SOAP:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="getGreetingsBeanArray"> - <SOAP:operation soapAction="urn:getGreetingsBeanArray" /> - <wsdl:input> - <SOAP:body use="literal" /> - </wsdl:input> - <wsdl:output> - <SOAP:body use="literal" /> - </wsdl:output> - </wsdl:operation> - </wsdl:binding> - <wsdl:binding name="HelloWorldWSBinding" type="tns:HelloWorldService"> - <SOAP:binding style="document" - transport="http://schemas.xmlsoap.org/soap/http" /> - <wsdl:operation name="getGreetings"> <SOAP:operation /> <wsdl:input> <SOAP:body use="literal" /> </wsdl:input> + <wsdl:output> <SOAP:body use="literal" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getGreetingsBean"> + <wsdl:operation name="getGreetingsBBean"> <SOAP:operation /> <wsdl:input> <SOAP:body use="literal" /> </wsdl:input> + <wsdl:output> <SOAP:body use="literal" /> </wsdl:output> </wsdl:operation> - <wsdl:operation name="getGreetingsBeanArray"> + <wsdl:operation name="getGreetingsCBean"> <SOAP:operation /> <wsdl:input> <SOAP:body use="literal" /> </wsdl:input> + <wsdl:output> <SOAP:body use="literal" /> </wsdl:output> diff --git a/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java b/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java new file mode 100644 index 0000000000..d52db8e812 --- /dev/null +++ b/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class HttpTransportTestCase{ + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + scaDomain = SCADomain.newInstance("helloworld1.composite"); + } + + @Test + public void testComponent1() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent1/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + + @Ignore + @Test + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + @After + public void stopServer() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + } + +} |