问题描述
我面临这个问题超过一个月,所以我真的很高兴你的帮助,事实上我问的是一种可以让我解析SOAP消息(请求)的方法,可以检索所需的信息,如安全信息,如果消息正文中有任何信息和信息
I am facing this problem for over than one month , so i would be realy pleased by your help , in fact i am asking about a way that can let me parse a SOAP message (request) to can retrieve the needed information , such as the security information if there is any and informations from the body of the message
感谢您回答我,但知道我正在处理另一个问题,即WS-SecurityPolicy,我必须最终解析像这样的xml文件:
<?xml version =1.0encoding =UTF-8 ?>
Thanks for answering me , but know i am dealing with another problerm which is the WS-SecurityPolicy and i have to finaly parse an xml file like this one :<?xml version="1.0" encoding="UTF-8"?>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
</wsp:Policy>
</sp:SignedSupportingTokens>
'
知道这个XML文件被命名为Policy.xml并包含必须存在的WS-SecurityPolicy规则。
knowing that this XML file is named Policy.xml and contains the rules of WS-SecurityPolicy, which must be present.
推荐答案
这取决于你的内部信息。您已使用 jaxb
标记了您的问题,这使我认为您在soap消息中有xml序列化数据。如果是这种情况,您可以使用JAXB unmarshaller将消息转换为Java类的实例:
It depends on what's inside your message. You've tagged your question with jaxb
which makes me think that you have xml-serialized data inside soap message. If this is the case you could use JAXB unmarshaller to convert your message to an instance of Java class:
JAXBContext jbc = JAXBContext.newInstance("com.mypackage");
Unmarshaller um = jbc.createUnmarshaller();
JAXBElement<MyClass> element = um.unmarshal(parameterNode, MyClass.class);
MyClass data = element.getValue();
这篇关于将SOAP消息解组到java /或简单地解析SOAP消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!