同时启动2个一样OA系统(这两个系统数据库和代码必须独立)怎样要实现的是这2个系统共享人员表,(即,第一个OA系统新建了人员在第二个OA系统中可以突显出来
解决方案 »
- J2EE SSH+ckeditor3.6.2+ckfinder2.1.1上传图片出错
- 关于在J2EE中使用CAB包的问题
- 急! 急! 急!跪求正则表达式高手帮忙!!!
- 谁能给我介绍一个免费的mib文件编辑工具
- 高分求陈天河《struts hibernate spring集成开发宝典》随书源码
- commons.fileupload 上传图片到oracle 急!答案正确给50分!
- 新手菜鸟,配置SSH出现的问题,跪求大牛们给小弟指点一二
- 关于diaplaytag的问题???
- jboss-3.2.6的8080端口与ORACLE的8080端口冲突如何解决
- 帮我看看这tomcat报错日志,经常导致网站进不了!
- JBDC连接问题出现异常!!
- 在页面使用struts2的标签,界面就报错,
2、有个实现类
3、配置文件中配置接口代码
import javax.jws.WebService;@WebService
public interface ServerWebService { public String sayHello(String userName);}
实现类代码
import javax.jws.WebService;import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;import cn.gacinfo.server.service.ServerWebService;@Service
@Transactional
@WebService(endpointInterface = "cn.aa.bb.ServerWebService ")//参数是Service的路径
public class ServerWebServiceImpl implements ServerWebService {
@Override
public String sayHello(String userName) {
return "hello," + userName;
}
}
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
<bean id="jaxws-and-aegis-service-factory"
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="dataBinding" ref="aegisBean" />
</bean> <!-- ServerWebService接口-->
<jaxws:endpoint id="uploadws" implementor="#serverWebServiceImpl" address="/ServerWebService">
<jaxws:serviceFactory>
<ref bean='jaxws-and-aegis-service-factory' />
</jaxws:serviceFactory>
</jaxws:endpoint> </beans>
4、把服务器端的接口拷贝到客户端--接口的路径可以改变。
5、调用和测试代码
6、客户端配置文件5、调用和测试代码
import org.springframework.context.support.ClassPathXmlApplicationContext;import cn.aa.bb.ServerWebService;public final class CommonWebService {
private static ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[] { "classpath*:spring/applicationContext*" }); public CommonWebService() {
} public static String sayHello(String userName) {
ServerWebService client = (ServerWebService) context.getBean("client");
String result = null;
try {
result = client.sayHello(userName);
} catch (Exception e) {
e.printStackTrace();
}
if (!("".equals(result) || result == null)) {
System.out.println("result = " + result);
return result;
}
return null;
} public static void main(String[] args) {
sayHello("gac");
}
}