我想将属性添加到soap标头中,如
<soapenv:Header attr="somevalue"attr1="somevalue"/>
使用Axis 1.但API不允许我这样做。我将这个元素放在一个像
这样的标题元素中 <soapenv:Header>
<soapenv:Header attr="somevalue"attr1="somevalue"/>
</soapenv:Header>
感谢任何帮助。
以下是添加标题
的代码SOAPFactory factory = SOAPFactory.newInstance();
String prefix = "soapenv";
String uri="http://schemas.xmlsoap.org/soap/envelope/";
SOAPElement Elem;
Elem = factory.createElement("Header",prefix,uri);
Elem.addAttribute(QName.valueOf("attr"), "value");
Elem.addAttribute(QName.valueOf("attr"), "value");
SOAPHeaderElement soapheader=new SOAPHeaderElement(Elem);
stub.setHeader(soapheader);