[jboss下webservice开发配置文件]JBoss下WebService开发配置实例

时间:2020-10-14  来源:WebService  阅读:

在web.xml中配置servlet:


      WSServlet
      com.ais.demo.service.impl.LocationServiceImpl 
      1


      WSServlet
      /v1/location

 

写接口

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节点下可以看到:

浏览器访问:http://ip:port/JBossWS/v1/location?wsdl

[jboss下webservice开发配置文件]JBoss下WebService开发配置实例

http://m.bbyears.com/asp/104660.html

推荐访问:
相关阅读 猜你喜欢
本类排行 本类最新