我有一个基于Web Service Client class(Proxyclient.java)
的代理来点击部署在我本地服务器上的web服务。当我尝试通过客户端类中的main函数(Proxyclient.java
)来访问weservice时,我能够得到响应没有任何错误。但是当我从基于Struts的Web应用程序收到请求时,没有问题,直到请求到达我的客户端类(Proxyclient.java
)。但是一旦它到达特定行中的类,如下所示
JaxWsProxyFactoryBean factory= new JaxWsProxyFactoryBean();
当执行到此行时,我收到错误响应,如下所示
SEVERE: Servlet.service() for servlet action threw exception
java.lang.ClassNotFoundException: org.apache.cxf.jaxws.JaxWsProxyFactoryBean
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at com.tmb.clientimpl.ProxyClient.checkUserId(ProxyClient.java:18)
at com.tmb.client.action.DetailsFetcher.getStatus(DetailsFetcher.java:14).... more
我正在使用此Web服务命中所需的所有必需的jar文件。我是否需要在struts-config.xml中添加任何更改或添加任何其他jar来纠正问题..?请帮助我...
以下是我的客户端类:
public class ProxyClient {
public UserIdExistsBean checkUserId(String UserId){
UserIdExistsBean userIdExistsBean=new UserIdExistsBean();
try{
System.out.println("entering before fact");
JaxWsProxyFactoryBean factory= new JaxWsProxyFactoryBean();
System.out.println("factory ready");
factory.setServiceClass(IUserDetails.class);
factory.setAddress("http://xx.xx.xx:YYYY/UserDetailsService");
IUserDetails serviceRef=(IUserDetails)factory.create();
System.out.println("after creating");
userIdExistsBean=(UserIdExistsBean)serviceRef.checkuserId(UserId);
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return userIdExistsBean;
}
public static void main(String[] args) {
UserIdExistsBean userIdExistsBean=new UserIdExistsBean();
ProxyClient proxy=new ProxyClient();
userIdExistsBean=proxy.checkUserId("test");
System.out.println("exists "+userIdExistsBean.isExists());
System.out.println("response "+userIdExistsBean.getRespString());
}