webService 接口调用配置

本文介绍了如何在Spring环境中配置并使用WebService。主要内容包括:在applicationContext.xml中引入新的XML配置文件;创建XML配置文件的具体内容及结构;以及创建对应的服务类来实现WebService接口调用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

1。配置XML文件,如果新建一个XML文件需要在applicationContext.xm里面配置一下

    <import resource="cxf-client.xml" />
    <import resource="cxf-hand.xml" />
    <import resource="applicationContext-gxpc.xml" />

2。新建一个XML,xml文件模板如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
	http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd 
	http://cxf.apache.org/transports/http/configuration 
	http://cxf.apache.org/schemas/configuration/http-conf.xsd
	http://cxf.apache.org/core 
	http://cxf.apache.org/schemas/core.xsd">
	<!--验证单点登录令牌-->
	<jaxws:client id="ISSOService" address="http://172.16.7.107:9090/com.kutesmart.esb.ldap.sso?wsdl" 
          serviceClass="com.kutesmart.bl.soap.cxf.ldap.ISSOService"> </jaxws:client> </beans>

3。上面的xml文件中的 serviceClass ="com.kutesmart.bl.soap.cxf.ldap.ISSOService",需要在此目录下新建的service类,这个类把wsdl2Java转换出来的源文件接口文件ISSOService.java里面的内容需要的复制出来就好,其中

@XmlSeeAlso({
    ObjectFactory.class
})

  删除就好。

配置这些地方就可以了,然后在 其他类中new一个ISSOService对象传入相应的参数就可以调用这个webservice接口了。

 

 

这是第一次适用调用web service接口,这只是一个简单的方式,这是我自己弄出来得,肯定还有很多,看起来还是很简单的, 但是对于新手来说,很多东西是不知道,百度都不知道百度什么,希望这篇能帮助到菜鸟们。我也是菜鸟

转载于:https://www.cnblogs.com/wushifeng/p/6122266.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值