webService AxisFault
今天看了一下webService,写了一个测试,在测试的途中遇到一些问题。记录一下。。。
Service端的代码
package com.test.ws;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface HelloWS {
@WebMethod
public String sayHello(String name);
}
package com.test.ws;
import javax.jws.WebService;
@WebService
public class HelloWSImp implements HelloWS{
@Override
public String sayHello(String name) {
System.out.println("HelloWS"+name);
return "Hello"+name;
}
}
package com.test.ws;
import javax.xml.ws.Endpoint;
public class publicService {
public static void main(String[] args) {
String address = "http://127.0.0.1:8080/test-webservice/hellows"; 就是下面的endPoint
Endpoint.publish(address, new HelloWSImp());
System.out.println("success!!!!");
}
}
结果报错了
后来才知道
call.setOperationName(new QName(endPointURL,serviceName));
endPointURL应该是nameSpace serviceName应该是name,方法名。
成功了!!!