Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从CXF响应中删除XML节点_Java_Xml_Cxf - Fatal编程技术网

Java 从CXF响应中删除XML节点

Java 从CXF响应中删除XML节点,java,xml,cxf,Java,Xml,Cxf,我希望从web服务得到的XML响应中删除一个节点。我试图通过使用StatTransformFeature来实现这一点,但未能成功删除响应的ns1:ivrOrderRequest0Response节点 final StaxTransformFeature feature = new StaxTransformFeature(); feature.setInDropElements(Collections.singletonList("ns1:ivrOrderRequest0Resp

我希望从web服务得到的XML响应中删除一个节点。我试图通过使用StatTransformFeature来实现这一点,但未能成功删除响应的
ns1:ivrOrderRequest0Response
节点

    final StaxTransformFeature feature = new StaxTransformFeature();
    feature.setInDropElements(Collections.singletonList("ns1:ivrOrderRequest0Response"));
    feature.initialize(client, client.getBus());
我正在处理的XML是:

<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">
  <soapenv:Body>
    <ns1:ivrOrderRequest0Response xmlns:ns1="http://type.webservice.net/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <ivrOrderRequest0Return href="#id0"/>
    </ns1:ivrOrderRequest0Response>
    <multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://type.ivrwebservice.net" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:IVRReturn">
      <DCRIS_RC xsi:type="xsd:string">0326</DCRIS_RC>
      <DCRIS_Return_Description xsi:type="xsd:string">NUMBER-DIRECT RECORD NOT FOUND</DCRIS_Return_Description>
      <dcrisRec1 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec10 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec2 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec3 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec4 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec5 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec6 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec7 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec8 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec9 xsi:type="xsd:string" xsi:nil="true"/>
      <telephoneNumber xsi:type="xsd:string">4024642151</telephoneNumber>
    </multiRef>
  </soapenv:Body>
</soapenv:Envelope>
<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">
  <soapenv:Body>
      <ivrOrderRequest0Return href="#id0"/>
    <multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://type.ivrwebservice.net" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:IVRReturn">
      <DCRIS_RC xsi:type="xsd:string">0326</DCRIS_RC>
      <DCRIS_Return_Description xsi:type="xsd:string">NUMBER-DIRECT RECORD NOT FOUND</DCRIS_Return_Description>
      <dcrisRec1 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec10 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec2 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec3 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec4 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec5 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec6 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec7 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec8 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec9 xsi:type="xsd:string" xsi:nil="true"/>
      <telephoneNumber xsi:type="xsd:string">4024642151</telephoneNumber>
    </multiRef>
  </soapenv:Body>
</soapenv:Envelope>

0326
找不到数字直接记录
4024642151

期望的结果是:

<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">
  <soapenv:Body>
    <ns1:ivrOrderRequest0Response xmlns:ns1="http://type.webservice.net/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <ivrOrderRequest0Return href="#id0"/>
    </ns1:ivrOrderRequest0Response>
    <multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://type.ivrwebservice.net" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:IVRReturn">
      <DCRIS_RC xsi:type="xsd:string">0326</DCRIS_RC>
      <DCRIS_Return_Description xsi:type="xsd:string">NUMBER-DIRECT RECORD NOT FOUND</DCRIS_Return_Description>
      <dcrisRec1 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec10 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec2 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec3 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec4 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec5 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec6 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec7 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec8 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec9 xsi:type="xsd:string" xsi:nil="true"/>
      <telephoneNumber xsi:type="xsd:string">4024642151</telephoneNumber>
    </multiRef>
  </soapenv:Body>
</soapenv:Envelope>
<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">
  <soapenv:Body>
      <ivrOrderRequest0Return href="#id0"/>
    <multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://type.ivrwebservice.net" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:IVRReturn">
      <DCRIS_RC xsi:type="xsd:string">0326</DCRIS_RC>
      <DCRIS_Return_Description xsi:type="xsd:string">NUMBER-DIRECT RECORD NOT FOUND</DCRIS_Return_Description>
      <dcrisRec1 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec10 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec2 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec3 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec4 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec5 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec6 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec7 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec8 xsi:type="xsd:string" xsi:nil="true"/>
      <dcrisRec9 xsi:type="xsd:string" xsi:nil="true"/>
      <telephoneNumber xsi:type="xsd:string">4024642151</telephoneNumber>
    </multiRef>
  </soapenv:Body>
</soapenv:Envelope>

0326
找不到数字直接记录
4024642151
如果任何人有这方面的经验,将不胜感激