如何删除命名空间xmlns:xsi =“http://www.w3.org/2001/XMLSchema-instance”

时间:2014-06-25 20:47:40

标签: java axis2 wsdl2java

我的请求是soapenv:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

我想删除 xmlns:xsi =“http://www.w3.org/2001/XMLSchema-instance”

我可以从Service_BindingStub执行此操作吗? 也许可以用一些属性设置org.apache.axis.client.Call对象......我不知道。

1 个答案:

答案 0 :(得分:0)

如果您的问题在根目录中有 xsi名称空间,请扩展SoapSerializationEnvelope,然后覆盖方法:write,如:

@Override
    public void write(XmlSerializer writer) throws IOException {
//        writer.setPrefix("i", this.xsi);
        writer.setPrefix("d", this.xsd);
        writer.setPrefix("c", this.enc);
        writer.setPrefix("v", this.env);
        writer.startTag(this.env, "Envelope");
        writer.startTag(this.env, "Header");
        this.writeHeader(writer);
        writer.endTag(this.env, "Header");
        writer.startTag(this.env, "Body");
        this.writeBody(writer);
        writer.endTag(this.env, "Body");
        writer.endTag(this.env, "Envelope");
    }