CXF

根据已经存在的WSDL(XSD)来生成Java代码

利用CXF的wsdl2java命令
@echo This batch file depends on the Apache CXF 2.x tool set.
@echo The ApacheCXF\bin\wsdl2java.bat needs for this running.
@echo Please modify the environment variables for your installation.
@echo Generate the java stub code ...

set JAVA_HOME=C:\Java\jdk1.6.0_02
set CXF_HOME=C:\apache-cxf-2.3.9

call "%CXF_HOME%\bin\wsdl2java.bat" -ant -impl -all -frontend jaxws21 -b binding.xml -d stub -p test CISCIAsset.wsdl


binding.xml 是去掉反射时的空格

利用教程里的方法和上述bat文件生成的java,建立服务器端

public class DeployHelloWorldService {

	public static void deployService() {
		System.out.println("Server start ……");
		//HelloWorldService service = new HelloWorldService();
		CISCIAssetImpl service = new CISCIAssetImpl();
		//String address = "http://localhost:9000/helloWorld";
		String address = "http://localhost:8091/CIS-service/services/BasicHttpBinding_ITwoWayAsync";
		Endpoint.publish(address, service);
	}

	public static void main(String[] args) throws InterruptedException {
		// 发布WebService
		deployService();
		System.out.println("server ready ……");
		Thread.sleep(1000 * 600);
		System.out.println("server exiting");
		// 休眠600秒后就退出
		System.exit(0);
	}
}

你可能感兴趣的:(CXF)