example-client.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="baseService" class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean" lazy-init="false" abstract="true"/>
<bean id="echoService" parent="baseService">
<property name="serviceClass">
<value>com.hyw.example.Echo</value>
</property>
<property name="wsdlDocumentUrl">
<value>http://localhost:8080/MyWebService/EchoService?wsdl</value>
</property>
</bean>
<bean id="userService" parent="baseService">
<property name="serviceClass">
<value>com.hyw.example.UserService</value>
</property>
<property name="wsdlDocumentUrl">
<value>http://localhost:8080/MyWebService/UserService?wsdl</value>
</property>
</bean>
</beans>
WebServiceClientTest.java文件
package test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.hyw.example.Echo;
public class WebServiceClientTest {
/**
* @param args
*/
public static void main(String[] args) {
WebServiceClientTest test = new WebServiceClientTest();
test.client();
}
public void client() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("example-client.xml");
Echo echoService = (Echo) ctx.getBean("echoService");
System.out.println(echoService.echo("根据服务地址创建客户端调用程序"));
}
}
UserWebServiceClient.java文件
package test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.hyw.example.User;
import com.hyw.example.UserService;
public class UserWebServiceClient {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
UserWebServiceClient test = new UserWebServiceClient();
test.client();
}
public void client() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("example-client.xml");
UserService userService = (UserService)ctx.getBean("userService");
System.out.println("================== getUser() ==================");
User user = userService.getUser("用户1");
System.out.println(user);
}
}
分享到:
相关推荐
spring+xfire( 编写webservice完整配置+案例)
spring+xfire集成解决方案spring+xfire集成解决方案
使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service使用XFire+Spring构建Web Service
xfire+spring+安全认证,包含服务端和客户端,xfire jar包可以从我的资源下面下或网上很多。
spring +xfire整合 1. xfire + spring 发布webservice 2. 利用 javascript 调用发布的webservice
XFire中实现WS-Security完整编 Spring+xFire+wss4j配置Helloworld实例 完整说明文档 Myeclipse项目 服务端工程 客户端工程
Spring+xFire实现webService
Spring+xFire+wss4j配置Helloworld完整Demo.rar
NULL 博文链接:https://jishiweili.iteye.com/blog/2087930
Spring+xfire实现WebService
使用XFire+Spring使用XFire+Spring构建Web Service(二).doc构建使用XFire+Spring构建Web Service(二).docWeb Service(二).doc
李君老师JavaEE笔记-Spring+XFire
Spring+Hibernate+Xfire+发布WebService教程文档
webservice+spring+xfire完整项目(包含jar包),只要导入myeclipse就可以直接使用,已经导入所需的所有jar包了
实现 xFire与 Spring 的集成
使用XFire+Spring构建Web Service步骤以及源代码.rar