从soap标头中删除mustUnderstand属性

编程入门 行业动态 更新时间:2024-10-25 18:34:43
本文介绍了从soap标头中删除mustUnderstand属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何从轴client中的soap头中删除mustunderstand属性。我特别设置它,当我设置soap header info mustundertand时,actor属性会自动添加到soap message.Does有人知道如何删除它们吗? 我正在使用Axis2 1.4版本的wsdl2java来创建我的ws客户端。

How to remove mustunderstand attribute from soap header in axis client.even i dont set it especially, when i set soap header info mustundertand and actor attributes are automatically added to soap message.Does anybody know how to remove them ? I am using Axis2 1.4 version's wsdl2java to create my ws client.

推荐答案

这些解决方案都不适用于我, as:

None of those solutions worked for me, as:

  • 我正在使用Axis(不是Axis2)
  • 我不想要要指定的属性,因为我的服务器副本不支持它(' http ://schemas.xmlsoap/soap/envelope/:mustUnderstand '属性未声明在这种情况下是典型答案。
  • I am working with Axis (not Axis2)
  • I don't want the attribute to be specified at all, as my server counterpart doesn't support it ("The 'schemas.xmlsoap/soap/envelope/:mustUnderstand' attribute is not declared" is a typical answer in such a case).

查看的答案将ws-security添加到wsdl2java生成的类帮助我编写了一个对我有用的解决方案:

Looking at the answer to "Adding ws-security to wsdl2java generated classes" helped me to write a solution that worked for me:

void addSecurityHeader(Stub stub, final String username, final String password) { QName headerName = new QName("docs.oasis-open/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security"); // Or any other namespace that fits in your case AtomicReference<SOAPHeaderElement> header = new AtomicReference<SOAPHeaderElement> (new SOAPHeaderElement(headerName) { { SOAPElement utElem = addChildElement("UsernameToken"); utElem.addChildElement("Username").setValue(username); utElem.addChildElement("Password").setValue(password); } @Override public void setAttribute(String namespace, String localName, String value) { if (!Constants.ATTR_MUST_UNDERSTAND.equals(localName)) { // Or any other attribute name you'd want to avoid super.setAttribute(namespace, localName, value); } } }); SOAPHeaderElement soapHeaderElement = header.get(); soapHeaderElement.setActor(null); // No intermediate actors are involved. stub.setHeader(soapHeaderElement); // Finally, attach the header to the stub }

更多推荐

从soap标头中删除mustUnderstand属性

本文发布于:2023-11-09 15:58:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572799.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   soap   标头中   mustUnderstand

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!