如何从位于 SOAP 主体下的 requestHeader 获取 clientCode?
<soapenv:Body>
<ser:GS>
<!--Optional:-->
<requestHeader>
<!--Optional:-->
<req:clientCode>KL7MU</req:clientCode>
<!--Optional:-->
<req:clientUsername>BLABLA</req:clientUsername>
</requestHeader>
</ser:GS>
</soapenv:Body>
我试图得到但iterator.hasNext()
返回false
。
SOAPBody soapBody = context.getMessage().getSOAPBody();
java.util.Iterator iterator = soapBody.getChildElements();
while (iterator.hasNext()) {
SOAPBodyElement bodyElement = (SOAPBodyElement) iterator.next();
String val = bodyElement.getValue();
System.out.println("The Value is:" + val);
}