- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我使用的是 Axis2-1.6.1,并且能够成功发送 SOAP 请求。这是请求的示例:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="true">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>***username***</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">***pass***</wsse:Password>
<wsse:Nonce Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">***nonce***</wsse:Nonce>
<wsu:Created Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">***datetime***</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
<wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://mysite/contract/users/v3/IUsers/EchoAuthenticated</wsa:Action>
</soapenv:Header>
<soapenv:Body>
<ns6:EchoAuthenticated xmlns:ns6="http://mysite/contract/users/v3">
<ns6:value>success</ns6:value>
</ns6:EchoAuthenticated>
</soapenv:Body>
</soapenv:Envelope>
收到响应后,抛出此异常:
org.apache.axis2.AxisFault: Must Understand check failed for header http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd : Security
我的印象是,在进行一些研究之后,Axis2 不喜欢响应中的某些内容。感到困惑,我复制了上面的请求并将其粘贴到 SoapUI 中并触发了它。它有效,我收到以下回复。我还使用 Fiddler 确认,这与我在 Eclipse 中发送此请求时收到的响应相同,只是 Axis2 不喜欢客户端,也许是 mustUnderstand?
这是响应:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://mysite/contract/users/v3/IUsers/EchoAuthenticatedResponse</a:Action>
<a:RelatesTo>urn:uuid:***guid***</a:RelatesTo>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>***datetime***</u:Created>
<u:Expires>***datetime***</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body>
<EchoAuthenticatedResponse xmlns="http://mysite/contract/users/v3">
<EchoAuthenticatedResult>This is the Users service answering back. The value you sent was: success</EchoAuthenticatedResult>
</EchoAuthenticatedResponse>
</s:Body>
</s:Envelope>
我迁移到更新版本的 Axis2 的能力有限,因为它与产品捆绑在一起,但我需要找出如何解决此错误。
最佳答案
我找到了一种解决方案,即在对 false 的响应中设置 mustUnderstand 实例
为此,我做了以下工作:
MustUnderstandHandler.java
import java.util.Iterator;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
public class MustUnderstandHandler extends org.apache.axis2.handlers.AbstractHandler {
@Override
public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {
try{
System.out.println("RemoveMustUnderstandAll: invoke " + messageContext);
SOAPEnvelope env = messageContext.getEnvelope();
SOAPHeader header = env.getHeader();
if(header != null){
for(Iterator<?> itr = header.getChildElements(); itr.hasNext();){
SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) itr.next();
if(headerBlock.getMustUnderstand()){
headerBlock.setMustUnderstand(false);
System.out.println("RemoveMustUnderstandAll (" + messageContext + "): setMustUnderstand(false) to " + headerBlock.getQName());
}
}
}
}
catch(Exception e){
System.out.println(e.toString());
}
return InvocationResponse.CONTINUE;
}
}
在生成的 stub (从 WSDL2Java 创建)中,我找到了它正在执行客户端的实例,并且在每一行之前我包含了以下内容:
MyStub.java
AxisConfiguration axisConfiguration = _messageContext.getConfigurationContext().getAxisConfiguration();
ArrayList arrayList = new ArrayList();
arrayList.add(new MustUnderstandHandler());
axisConfiguration.setInPhasesUptoAndIncludingPostDispatch(arrayList);
// execute the operation client
_operationClient.execute(true);
关于java - Axis2 客户端抛出 AxisFault : Must Understand check failed for header Security,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48158714/
我正在使用 HighCharts 线图,其中我的 x Axis 数据分布不均匀: [4, 10, 40, 100, 400, 1000, etc.] 目前,x 值均匀放置。我希望 x[5] 和 x[4
这是我使用的程序: library(plotly) mydata = read.csv("data_to_plot.txt") df = as.data.frame(mydata) p % gro
我一直在试图找到2之间的差异,但是要减去这个就没有运气了 The primary diff erence between the two representations is that a quate
给定一个没有 Axis 的图,我想使用 axis 添加一个水平 Axis 。在左侧,您会看到给定的“基线”图,在右侧,您会看到所需的结果: 基线图是使用简单生成的 plot(1, axes = FAL
我正在创建 XYPlot,并且需要反转 y Axis 上的顺序(也就是说,我需要较低的数字来使 Axis 上的数字较高)。如果有任何关于如何做到这一点的提示,我将不胜感激。 最佳答案 我也遇到了和你一
我有一个包含两个系列的图表,每个系列都有自己的yAxis。我需要自动将第二个轴最大值设置为第一个轴最大值的 13.5%。例如,如果第一个轴从 0 到 100,那么我希望第二个轴从 0 到 13.5(无
在 google 图表数据表对象中,我可以使用 datatable.getValue(...) 获取当前选择点值(V 轴/Y 轴)。但是,如果我想从 X 轴获取时间/日期/年份(请参见屏幕截图)。我没
我想知道是否有可能(我知道是)将绘图的 Axis 标签保留在绘图的一侧,将绘图的 Axis 标题保留在另一侧,特别是在离散的 geom_tile() 绘图中,如下所示: 最佳答案 您可以在 scale
我正在尝试制作带有自定义 Axis 标签的箱线图,但我似乎无法向图中添加 x Axis 。 例如: test <- data.frame(year=as.integer(rep(1963:2014,
我正在使用 LightningChartJS 创建图表。单击图例框中的系列描述后,系列消失,但 Axis 保留。是否可以将 Axis 与系列一起隐藏? 我的 Axis 和系列如下:- const ax
我有一个关于如何获取另一个 Axis 服务中已部署的 Axis 服务列表的问题。这是场景。我使用 Tomcat 7.0.14 和 Axis 2-1.5.5 作为部署环境。假设目前 Tomcat 上部署
我目前正在尝试使用包含两个 y Axis (一个在左边,一个在右边)的 AChartEngine 创建一个图表。然而,我似乎无法弄清楚如何才能真正添加第二个 y Axis 。一个 XYMultip
我正在使用 Core Plot 库在 iOS 上绘制图形。我想在 yAxis 的网格线之间添加颜色。我已经设法通过设置轴的 alternatingBandFills 属性来做到这一点。但是,我也必须在
我想知道是否有办法改变 x 轴刻度和 y 轴刻度背景的背景颜色以及字体颜色。 例如在 example in this link ,您可以看到代码的 x 轴(0,2,4,5..)和 y 轴(12,10,
我部署在 Weblogic 集群上的 Java 应用程序调用了如下两个 Web 服务。 • 它通过 HTTPS 向互联网上的外部应用程序发送 SOAP 客户端请求。(通过 Axis 1.4 创建的 J
我正在尝试为 x 和 y 设置 Axis ,但每次尝试时,热图都会缩小到绘图的一角。我试试 plt.xlim(0, 60) plt.ylim(0, 30) 我也试过: ax.set_ylim(0, 3
使用 DC js,尝试将 rowChart 设置为固定 X Axis 为 0-100。但是将其绘制为一条线? 我设置了 .elasticX(false) 并且看起来像上面那样。设置为 true 看起来
我有一些法语等级的学生成绩数据(双值,范围从 0 到 20)。 目前,在允许将日期作为 X 轴的散点图(用线连接点)上,我的 Y 轴上的成绩是双倍的,而 X 轴上是一系列学期结束日期。 使用以下间隔映
我正在尝试制作一个极坐标“sypder”图,但我在 Axis 标签方面遇到了一些问题。 xaxis 刻度标签似乎总是在 y Axis 网格下方的层上结束(字母被网格线覆盖,如下图所示),我希望它们在顶
我正在尝试使用ggplot2包绘制以下图形,但是以某种方式不会显示轴。刻度线在那里,而不仅仅是轴线。我使用了theme(axis.line=element_line())函数,但无法正常工作。 这是我
我是一名优秀的程序员,十分优秀!