我通过使用stub._getServiceClient().getLastOperationContext().getMessageContext("In").getEnvelope().getHeader()
获取SOAPHeader
然后我需要解析其中的particullar元素的值,搜索很多,但是我得到的是null。
我已经尝试过soapHeader.getAttribute(QName)
soapHeader.examineAllHeaderBlocks()
等,并且在获得Iterator之后,我无法在header中获取particullar元素的文本。
最佳答案
此时,您需要在IDE中为客户端创建2个类,分别是HeaderHandler
和HeaderHandlerResolver
,您可以右键单击并单击new webservice client
并指向wsdl url。看看这个http://www.javadb.com/using-a-message-handler-to-alter-the-soap-header-in-a-web-service-client/