我们使用Java客户端访问的IRS ACA Web服务要求我们不要在include和Content-ID的href部分中发送%符号,因此不能发送URL编码。 Apache CXF会自动完成这项工作,但我们希望像这样发送SOAP请求:
<soap:Body>
<ns2:ACABulkRequestTransmitter version="1.0" xmlns="urn:us:gov:treasury:irs:common" xmlns:ns2="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter" xmlns:ns3="urn:us:gov:treasury:irs:ext:aca:air:7.0" xmlns:ns4="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns5="http://www.w3.org/2000/09/xmldsig#" xmlns:ns6="urn:us:gov:treasury:irs:msg:acabusinessheader" xmlns:ns7="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns8="urn:us:gov:treasury:irs:msg:acasecurityheader">
<BulkExchangeFile>
<xop:Include href="cid:129aa5d3-1815-49b8-847e-b9e51c0cd650-1@urn:us:gov:treasury:irs:common" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
</BulkExchangeFile>
</ns2:ACABulkRequestTransmitter>
如果我们这样发送
129aa5d3-1815-49b8-847e-b9e51c0cd650-1@urn%3Aus%3Agov%3Atreasury%3Airs%3Acommon
美国国税局不接受这个请求。有关如何在Apache CXF中删除此URL编码的任何想法吗?
编辑我为实现IRS期望而采取的措施
原来你可以保留href和Content-ID URL编码。这就是我为了获得工作要求而采取的措施。
我编辑了src / main / java / org / apache / cxf / attachment / AttachmentSerializer.java 以便它输出IRS期望的内容
Content-Type: application/xml
Content-Transfer-Encoding: 7bit
Content-ID: <6920edd2-a3c7-463b-b336-323a422041d4-1@blahurn:us:gov:treasury:irs:common>
Content-Disposition: attachment;name="1094B_Request_BBBBB_20151019T121002000Z.xml"
CXF正在制作Content-Transfer-Encoding二进制文件和Content-Type应用程序/八位字节流