最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
JBoss下WebService开发配置实例
时间:2016-07-07 编辑:简简单单 来源:一聚教程网
在web.xml中配置servlet:
写接口
package com.ais.demo.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(targetNamespace = "http://www.jboss.org/jbossas/quickstarts/wshelloworld/Location")
public interface LocationService {
@WebMethod
String doCreate(@WebParam(name="longitude")String longitude, @WebParam(name="latitude")String latitude,
@WebParam(name="addressLine1")String addressLine1, @WebParam(name="addressLine2")String addressLine2,
@WebParam(name="addressLine3")String addressLine3, @WebParam(name="addressLine4")String addressLine4,
@WebParam(name="addressLine5")String addressLine5, @WebParam(name="addressLine6")String addressLine6,
@WebParam(name="addressLine7")String addressLine7, @WebParam(name="addressLine8")String addressLine8,
@WebParam(name="addressLine9")String addressLine9, @WebParam(name="addressLine10")String addressLine10,
@WebParam(name="createTime")String createTime, @WebParam(name="createBy")String createBy);
@WebMethod
String doRetrieveByEmail(@WebParam(name="email")String email);
}
写实现类
package com.ais.demo.service.impl;
import javax.jws.WebService;
import com.ais.demo.service.LocationService;
@WebService(serviceName = "LocationService", portName = "Location", name = "Location", endpointInterface = "com.ais.demo.service.LocationService", targetNamespace = "http://www.jboss.org/jbossas/quickstarts/wshelloworld/Location")
public class LocationServiceImpl implements LocationService {
@Override
public String doCreate(String longitude, String latitude,
String addressLine1, String addressLine2, String addressLine3,
String addressLine4, String addressLine5, String addressLine6,
String addressLine7, String addressLine8, String addressLine9,
String addressLine10, String createTime, String createBy) {
return "replace with json string";
}
@Override
public String doRetrieveByEmail(String email) {
// TODO Auto-generated method stub
return "replace with json string";
}
}
启动服务器可以看到,webservice成功发布的信息:
id=WSServlet
address=http://localhost:8080/JBossWS/v1/location
implementor=com.ais.demo.service.impl.LocationServiceImpl
invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker
serviceName={http://www.jboss.org/jbossas/quickstarts/wshelloworld/Location}LocationService
portName={http://www.jboss.org/jbossas/quickstarts/wshelloworld/Location}Location
wsdlLocation=null
mtomEnabled=false
进入Jboss web console(9990或8080端口都可以进入),在左侧Webservices节点下可以看到:
-
上一个: linux中SSH环境搭建详解
-
下一个: Java Web的安全验证机制的例子
相关文章
- SpringBoot测试配置属性与web启动环境解析 10-24
- vue中将el-switch值true、false改为number类型的1和0解析 10-24
- Vue中的路由配置项meta使用解读 10-24
- SpringBoot自定义bean绑定解析 10-24
- SpringBoot常用计量与bean属性校验和进制数据转换规则解析 10-24
- 工厂方法在Spring框架中的运用介绍 10-24