xml - SOAP 请求消息头无法记录
问题描述
我有一个工作肥皂客户端代码发送请求并获得响应。但是当我尝试使用soap处理程序将我的请求记录到数据库时,标题部分没有出现,并且我收到以下消息。
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/> //missing part
<S:Body>
"bla bla bla"
</S:Body>
</S:Envelope>
我的消息处理程序是,
@Override
public boolean handleMessage(SOAPMessageContext context) {
Boolean isRequest = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
SOAPMessage message = context.getMessage();
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
message.writeTo(out);
} catch (SOAPException | IOException e) {
e.printStackTrace();
}
if (isRequest) {
MyLogService.saveResponse(logRefNo, "", "", "", "", "", "", "", out.toByteArray());
} else {
MyLogService.saveResponse(logRefNo, "", "", out.toByteArray());
}
return true;
}
我期待在 DB 中看到完整的请求标头,例如;
<s:Header>
<o:Security s:mustUnderstand=1 xmlns:o=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd>
<o:UsernameToken u:Id=uuid-0df61a7941-1436-41157-8368-d1c85c01d6cac31-1>
<o:Username>?</o:Username>
<o:Password Type=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText>?</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
解决方案
推荐阅读
- flutter - 在bottomNavigationBar下方显示bottomSheet
- azure - 通过 Release/CD 导入 AppInsight Instrumentation Key 并在应用程序的 appsettings 中更新 Instrumentation 密钥
- java - 如何在java中设置没有身份验证的smtp服务器
- java - Android允许用户在地图上只选择公交车站
- android - 听众在我的片段中不起作用
- javascript - 如何创建二维数组?
- swift - 无法使用 UserDefaults (Swift) 让欢迎 ViewController 仅显示一次
- database - 数据库系统实现演示项目
- c - 客户端经过的时间不起作用 TCP SOCKET
- java - 使用 Java8 映射到列表