CXF编写客户端为什么报这样的错,求大神帮忙解答
客户端调试代码如下:
package com.oking.ws;
import javax.xml.namespace.QName;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
public class TexstClient {
public static void main(String[] args) {
try {
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
String serviceURL;
if (args != null && args.length > 0 && !"".equals(args[0])) {
serviceURL = args[0];
} else {
serviceURL = "http://localhost:8080/sz-dzda/dorado/webservice/UserService.wsdl";
}
factory.setServiceName(new QName("http://www.bstek.com/ws",
"User"));
factory.setAddress(serviceURL);
factory.setWsdlURL(serviceURL);
System.out.println(serviceURL);
factory.getServiceFactory().setDataBinding(new AegisDatabinding());
User client = factory.create(User.class);
System.out.println("Invoke sayHi()....");
System.out.println(client.getUsername());
// System.out.println(client.sayHi(System.getProperty("user.name")));
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}
}
}
然后测试就报这样的错了
2014-10-11 14:51:46 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
信息: Creating Service {http://www.bstek.com/ws}User from WSDL: http://localhost:8080/sz-dzda/dorado/webservice/UserService.wsdl
org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://www.bstek.com/ws}User.
at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:171)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:546)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:156)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:93)
at com.oking.ws.TexstClient.main(TexstClient.java:24)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请问如何解决?
这个错误我也遇见了,请问您是否解决?能否告知解决方法?谢谢。
这个我是使用BDF2做出来的,它里面就是这样写的