【问题标题】:jax-ws: how to get a handle to start/end of processing incoming soap messagejax-ws:如何获取处理传入肥皂消息的开始/结束句柄
【发布时间】:2026-02-01 10:00:01
【问题描述】:

情况:Weblogic appserver 上的 jax-ws web 服务; wsdl 首次开发,外部绑定文件中的 jaxb 自定义。

我想获得一个实际 jaxb 上下文的句柄,该上下文将处理传入的 soap xml 消息,它被解组为 java 对象。

然后我想获取这个 jaxb 上下文的解组器 - 在解组过程中实际使用的解组器。然后设置这个 unmarshaller 的一些属性(例如 listener 和 idresolver)。

【问题讨论】:

    标签: java jaxb jax-ws


    【解决方案1】:

    新的@UsesJAXBContex 注释JAXBContextFactoryin jaxws 2.1.5 - jaxb 2.2 可能是我需要的。 但是 weblogic 10.3.1 使用 jaxws 2.1.1、jaxb 2.1.3。

    另一种解决方案是使用:

    @WebServiceProvider(portName = "Port", serviceName = "Service", targetNamespace = "tns",                                                                                                        wsdlLocation = "/wsdls/x.wsdl")
    @BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http")
    @ServiceMode(value = javax.xml.ws.Service.Mode.MESSAGE)
    public class ServiceProvider implements Provider<SOAPMessage>
    

    这可以访问soap xml 消息。我还得弄清楚在哪里可以找到方法名。

    代替:

    @WebService(portName = "Port", serviceName = "Service", targetNamespace = "tns",
    wsdlLocation = "/wsdls/x.wsdl", endpointInterface = "tns.PortType")
    @BindingType("http://schemas.xmlsoap.org/wsdl/soap/http")
    public class ServicePort implements PortType
    

    【讨论】:

      最近更新 更多