(接上文)配置CXF_HOME,JAVA_HOME,PATH路径
使用wsdl2java -p com.bjpowernode.cxf -client http://localhost:9000/helloWorld?wsdl命令
会生成
HelloWorld_HelloWorldPort_Client.java
HelloWorld.java
HelloWorldService.java
ObjectFactory.java
package-info.java
Say.java
SayResponse.java
这些java类
修改HelloWorld_HelloWorldPort_Client
package com.chuangfuwu.cxf;
/**
* Please modify this class to meet your needs
* This class is not complete
*/
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
* This class was generated by Apache CXF 2.7.17
* 2015-10-06T09:09:44.161+08:00
* Generated source version: 2.7.17
*
*/
public final class HelloWorld_HelloWorldPort_Client {
private static final QName SERVICE_NAME = new QName("http://cxf.chuangfuwu/", "HelloWorldService");
private HelloWorld_HelloWorldPort_Client() {
}
public static void main(String args[]) throws java.lang.Exception {
URL wsdlURL = HelloWorldService.WSDL_LOCATION;
HelloWorldService ss = new HelloWorldService(wsdlURL, SERVICE_NAME);
HelloWorld port = ss.getHelloWorldPort();
System.out.println(port.say("王五"));
}
}