1.org.fkjava.cfx.ws.HelloWorld,接口,存根是远端服务器的代理,所以远端服务器和存根都要实现共同的
接口,此接口即是org.fkjava.cfx.ws.HelloWorld
package org.fkjava.cfx.ws;
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.2.2
* Thu Jul 19 15:54:40 CST 2012
* Generated source version: 2.2.2
* 存根是远端服务器的代理,所以远端服务器和存根都要实现共同的
* 接口,此接口即是org.fkjava.cfx.ws.HelloWorld
*/
@WebService(targetNamespace = "http://ws.cfx.fkjava.org/", name = "HelloWorld")
@XmlSeeAlso({ObjectFactory.class})
public interface HelloWorld {
@WebResult(name = "return", targetNamespace = "")
@RequestWrapper(localName = "sayHi", targetNamespace = "http://ws.cfx.fkjava.org/", className = "org.fkjava.cfx.ws.SayHi")
@ResponseWrapper(localName = "sayHiResponse", targetNamespace = "http://ws.cfx.fkjava.org/", className = "org.fkjava.cfx.ws.SayHiResponse")
@WebMethod
public java.lang.String sayHi(
@WebParam(name = "arg0", targetNamespace = "")
java.lang.String arg0
);
}
3.org.fkjava.cfx.ws.impl.HelloWorldWs实现接口javax.xml.ws.Service
/*
*
*/
package org.fkjava.cfx.ws.impl;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service;
import org.fkjava.cfx.ws.HelloWorld;
/**
* This class was generated by Apache CXF 2.2.2
* Thu Jul 19 15:54:40 CST 2012
* Generated source version: 2.2.2
* 实现接口javax.xml.ws.Service(这个接口能够得到远端服务器的代理,即是能得到存根)
*/
@WebServiceClient(name = "HelloWorldWs",
wsdlLocation = "http://192.168.1.2/HelloWorld?WSDL",
targetNamespace = "http://impl.ws.cfx.fkjava.org/")
public class HelloWorldWs extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://impl.ws.cfx.fkjava.org/", "HelloWorldWs");
public final static QName HelloWorldWsPort = new QName("http://impl.ws.cfx.fkjava.org/", "HelloWorldWsPort");
static {
URL url = null;
try {
url = new URL("http://192.168.1.2/HelloWorld?WSDL");
} catch (MalformedURLException e) {
System.err.println("Can not initialize the default wsdl from http://192.168.1.2/HelloWorld?WSDL");
// e.printStackTrace();
}
WSDL_LOCATION = url;
}
public HelloWorldWs(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public HelloWorldWs(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public HelloWorldWs() {
super(WSDL_LOCATION, SERVICE);
}
/**
*
* @return
* returns HelloWorld
*/
@WebEndpoint(name = "HelloWorldWsPort")
public HelloWorld getHelloWorldWsPort() {
return super.getPort(HelloWorldWsPort, HelloWorld.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns HelloWorld
*/
@WebEndpoint(name = "HelloWorldWsPort")
public HelloWorld getHelloWorldWsPort(WebServiceFeature... features) {
return super.getPort(HelloWorldWsPort, HelloWorld.class, features);
}
}