2016-09-19 46 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將被暴露。