(jax-ws-ri)获取soap主体请求,将其注入回请求头中

t8e9dugd  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(164)

我使用wsimport和jax-ws-ri生成了类。使用@requestwrapper和@responsewrapper,我无法访问实际的soap内容。我的目标是向soap头添加数字签名。
如何检索请求soap消息、提取soap正文并将内容插入soap头中?
这就是我目前所拥有的。

ServiceUser serviceUser = new ServiceUser(new URL(wsdlUrl));
    ServiceUserSoap service = serviceUser.getServiceUserSoap();

    int soapTimeOut = 5;
    ((BindingProvider) service).getRequestContext().put(Constants.RESPONSE_TIMEOUT_PROPERTY,
        Integer.toString((soapTimeOut))); // Timeout in seconds
    ((BindingProvider) service).getRequestContext().put(Constants.CONNECTION_TIMEOUT_PROPERTY,
        Integer.toString((soapTimeOut))); // Timeout in seconds

    retRec = service.getRecords(active, user);
@WebMethod(action = "http://www.server.com/userlist/getRecords")
    @WebResult(name = "getRecordsResult", targetNamespace = "")
    @RequestWrapper(localName = "getRecords", targetNamespace = "http://www.server.com/userlist", className = "com.wsclient.api.GetRecords")
    @ResponseWrapper(localName = "getRecordsResponse", targetNamespace = "http://www.server.com/userlist", className = "com.wsclient.api.GetRecordsResponse")
    public List<com.userlist.api.GetRecordsResponse.GetRecordsResult> getRecords(

        @WebParam(name = "u_active", targetNamespace = "")
        Boolean active,

        @WebParam(name = "u_user", targetNamespace = "")
        String user);

    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题