2016-09-19 45 views
0

我正在将现有的Webservice端点从WebSphere(8)转换为Jboss(EAP 6.3)。 我的端点被创建为EJB3 bean,如下所示: package com.company.project.ridethecar.ejb;使用实际bean名称生成的基于EJB3的Webservice端点

@WebService(
    endpointInterface ="com.company.schemas.project.srm.ridethecarservice.soap_service.v1.RideTheCarSer vicePortType", 
    targetNamespace ="http://schemas.company.com/project/srm/ridethecarservice/soap-service/v1", 
    serviceName = "RideTheCarService", 
    portName = "RideTheCarServiceSoap", 
    wsdlLocation = "META-INF/wsdl/RideTheCarService/v2.00/RideTheCarService.wsdl") 
@Stateless(name="RideTheCarBean") 
    @Local({com.company.schemas.project.srm.ridethecarservice.soap_service.v1.RideTheCarServicePortType.class}) 
@Interceptors(SpringBeanAutowiringInterceptor.class) 
@Service 
@HandlerChain(file="/RideTheCar-handler-chain.xml") 
public class RideTheCarBean implements RideTheCarServicePortType 
{...} 

我也有一个web服务定义WSDL,我使用CXF行家CXF-CODEGEN-插件(版本3.1.7)生成的Java bean。我RideTheCarServicePortType将如下产生:

@WebService(targetNamespace = "http://schemas.company.com/project/srm/ridethecarservice/soap-service/v1", name = "RideTheCarServicePortType") 
@XmlSeeAlso({com.comapny.schemas.project.messaging.v1.ObjectFactory.class, com.company.schemas.project.srm.ridethecarservice.service.v1.ObjectFactory.class }) 
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) 
public interface RideTheCarServicePortType { 

    @WebMethod(action = "http://schemas.company.com/project/srm/ridethecarservice/soap-service/v1/EnvRideTheCarService") 
    @Action(input = "http://schemas.company.com/project/srm/ridethecarservice/soap-service/v1/RideValidationRq", output = "http://schemas.company.com/project/srm/ridethecarservice/soap-service/v1/RideValidationRs") 
    @WebResult(name = "PbaValidationRs", targetNamespace = "http://schemas.company.com/project/srm/ridethecarservice/service/v1", partName = "RideValidationRs") 
public com.company.schemas.project.srm.ridethecarservice.service.v1.RideValidationRs rideValidation(
    @WebParam(partName = "RideValidationRq", name = "RideValidationRq", targetNamespace = "http://schemas.company.com/project/srm/ridethecarservice/service/v1") 
    com.company.schemas.project.srm.ridethecarservice.service.v1.RideValidationRq rideValidationRq 
); 

} 

我包装所有的代码为WAR文件,使用Maven和它部署到JBoss的 。 JBoss能够识别EJB和Webservice,但不幸的是它会自动创建一个端点为

http://localhost:8080/root/RideTheCarService/RideTheCarBean?wsdl。 我希望看到http://localhost:8080/root/RideTheCarService?wsdl,没有RideTheCarBean部分 - 因为它在WebSphere中的工作方式如此。

请帮助我理解为什么Jboss使用bean定义端点,而不是在@Webservice的“servicename”属性中定义的实际服务名称。

谢谢。

回答

0

解决方案非常简单 - 必须在EJB包的META-INF文件夹中使用jboss-webservices.xml文件。

<context-root>/RideTheCarService</context-root> 
<port-component> 
    <ejb-name>RideTheCarBean</ejb-name> 
    <port-component-name>RideTheCarSoap</port-component-name> 
    <port-component-uri>/RideTheCar</port-component-uri> 
</port-component> 

这将确保RideTheCar URL将被暴露。