我有这样的代码:
import javax.xml.transform.Source;
import org.apache.cxf.binding.soap.SoapMessage;
public class MyProvider implements Provider<Source> {
public Source invoke(Source request) {
SoapMessage message= ???
}
}
现在我想从 request 中提取我知道在里面的 SoapMessage。有人知道怎么做吗????
请注意,我想要一个 org.apache.cxf.binding.soap.SoapMessage
而不是 javax.xml.soap.SOAPMessage
。
我的真正目的是从 request 中读取 UserToken,如果我有 org.apache.cxf.binding.soap.SoapMessage 我知道该怎么做。 但是,如果有人知道如何直接从 Source 或其他一些方法阅读它,我会很感激。
最佳答案
我假设您的 UserToken 包含在 SOAP header 中。如果是这种情况,则必须使用 ServiceMode“MESSAGE”来获取整个 SOAP 信封,而不仅仅是主体。或者,您可以使用 Handler 将提取的用户 token 放入请求上下文中以进行进一步处理。
关于java - SoapMessage 的来源(用于读取 UserToken),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13740012/