基本上,每次调用SOAP Web服务的方法都需要用户身份验证。 所以这就是SOAP标题应该是这样的:
<soap:Header>
<HTNGHeader xmlns="http://htng.org/1.1/Header/">
<From>
<systemId />
<Credential>
<userName>string</userName>
<password>string</password>
</Credential>
</From>
<To>
<systemId />
</To>
<timestamp />
<echoToken />
<transactionId />
<action />
</HTNGHeader>
</soap:Header>
这是我到目前为止所发现的link。 我确信我必须在这个块中进行更改
try {
SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope();
SOAPHeader header = envelope.addHeader();
SOAPElement security =
header.addChildElement("Security", "wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
SOAPElement usernameToken =
security.addChildElement("UsernameToken", "wsse");
usernameToken.addAttribute(new QName("xmlns:wsu"), "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
SOAPElement username =
usernameToken.addChildElement("Username", "wsse");
username.addTextNode("TestUser");
SOAPElement password =
usernameToken.addChildElement("Password", "wsse");
password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
password.addTextNode("TestPassword");
//Print out the outbound SOAP message to System.out
message.writeTo(System.out);
System.out.println("");
} catch (Exception e) {
e.printStackTrace();
}
但我无法做对。我很感激你的想法。
由于