Apache Tuscany
Address: http://tuscany.apache.org
Ready to work:
> Download SCA-Java-2.0 package
Address: http: //tuscany.apache.org/sca-java-2x-releases.html
Binary select the corresponding type of packet system, decompressing
> Add the jar package
Was added under tuscany / lib directory, the following three jar package:
tuscany-base-runtime-aggregation-2.0.jar
tuscany-binding-ws-runtime-axis2-aggregation-2.0.jar
tuscany-sca-api-2.0.jar
1, edit the web.xml file
Add URL Filtering
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>SOAPServer</display-name> <filter> <filter-name>tuscany</filter-name> <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class> </filter> <filter-mapping> <filter-name>tuscany</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
2, the new Service interface file
Mark interface @Remotable
Define open service method
package com.example.service; import org.oasisopen.sca.annotation.Remotable; @Remotable public interface IHelloWorldService { public String say(String from); }
3, the new Service Interface implementation class
package com.example.service.impl; import com.example.service.IHelloWorldService; public class HelloWorldServiceImpl implements IHelloWorldService { @Override public String say(String from) { return "Hello, " + from; } }
4, New .composite profile
Defining component (<component>) helloworld, implementation class (<implementation.java>) is "com.example.service.impl.HelloWorldServiceImpl"
Define service (<service>), called "IHelloWorldService", bind web service (<blinding.ws>)
<?xml version="1.0" encoding="UTF-8"?> <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://service.example.com" name="helloworld"> <component name="helloworld"> <implementation.java class="com.example.service.impl.HelloWorldServiceImpl"/> <service name="IHelloWorldService"> <binding.ws/> </service> </component> </composite>
test:
http://localhost:8080/HelloWorldServer/helloworld/IHelloWorldService?wsdl
Reproduced in: https: //www.cnblogs.com/dyingbleed/archive/2013/01/18/2866070.html