日期:2014-05-17 浏览次数:20779 次
package helloworld; import org.osoa.sca.annotations.Remotable; @Remotable public interface HelloWorld { public void sayHello(String name); }
package launch; import org.apache.tuscany.sca.host.embedded.SCADomain; public class Launcher { public static void main(String[] args) throws InterruptedException { SCADomain.newInstance("helloworld.composite"); System.out.println("Server started..."); while(true){ Thread.sleep(1000000); } } }
<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:c="http://helloworld" targetNamespace="http://helloworld" name="helloworld"> <component name="HelloWorldComponent"> <implementation.java //以java方式实现 class="helloworld.HelloWorldImpl"/> <service name="HelloWorld"> <interface.java interface="helloworld.HelloWorld" /> //接口是java类 <binding.ws uri="http://localhost:8080/HelloWorld"/> //以web service方式发布服务 </service> </component> </composite>
<?xml version="1.0" encoding="UTF-8" ?> - <wsdl:definitions name="HelloWorldService" 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 attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://helloworld/" xmlns:tns="http://helloworld/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="sayHelloResponse"> <xs:complexType /> </xs:element> - <xs:element name="sayHello"> - <xs:complexType> - <xs:sequence> <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </wsdl:types> - <wsdl:message name="sayHelloResponse"> <wsdl:part name="sayHelloResponse" element="tns:sayHelloResponse" /> </wsdl:message> - <wsdl:message name="sayHello"> <wsdl:part name="sayHello" element="tns:sayHello" /> </wsdl:message> - <wsdl:portType name="HelloWorld"> - <wsdl:operation name="sayHello"> <wsdl:input message="tns:sayHello" /> <wsdl:output message="tns