2012-04-17 40 views
0

我有一個無狀態的會話bean,它暴露爲web服務。有兩種方法,都有@webmethod註釋。但是,只有一種方法暴露爲web服務。任何人都可以指出原因行爲,請看下面的代碼:@webmethod - 不公開該方法作爲web服務(JAX-WS)

@WebService(portName = "interfaceSoapHTTPPort", serviceName = "interfaceService", targetNamespace = "http://com.demo.service/interfaceservice", endpointInterface = "com.demo.service.interfacePortType") 
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT) 
@Stateless(mappedName = "InterfaceBean") 

public class InterfaceBean { 
    @PostConstruct 
    @PostActivate 
    public void initializeBean() { 

    } 

    @WebMethod 
    public void processPathEvent(XngEvent pathXngEvent) throws WSException { 

    } 

    @WebMethod 
    public void portAssignmentUpdate(WSHeader wsHeader, 
      PortAssignmentUpdateRequest portAssignmentUpdateRequest, 
      Holder<WSResponseHeader> wsResponseHeader, 
      Holder<PortAssignmentUpdateResponse> portAssignmentUpdateResponse) 
      throws WSException { 

    } 
} 

只有portAssignmentUpdate方法公開爲Web服務,而不是processPathEvent方法。

謝謝。

回答

0

我能解決這個問題。

我們在@webservice註釋中設置了「endpointInterface」屬性。我忘記了將processPathEvent()方法添加到此接口。因此,即使添加了@webmethod註解,該方法也不會暴露。