You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rodney Kite <rk...@yahoo.com.INVALID> on 2017/01/25 06:34:52 UTC

CXF overriding Content-Transfer-Encoding in MTOM attachement

I'm using JBoss/Wildfly 10.1 which includes CXF 3.0.6.   I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.   My content type header is Content-Type: multipart/related; type="application/xop+xml".    It appears in CXF if application/xop+xml is set then it will always put Content-Transfer-Encoding: binary in the MTOM attachement headers but the IRS states they want 7bit and 8bit.   
I have created an Out Interceptor which allows me to set some headers but the content transfer encoding in the attachement is always set to binary. 

Does anyone know how to stop CXF from overriding the Content-Transfer-Encoding: 8bit setting?

ThanksRodney




    




Re: CXF overriding Content-Transfer-Encoding in MTOM attachement 7bit and 8bit

Posted by Sergey Beryozkin <sb...@gmail.com>.
Create an independent CXF out interceptor which implements handleMessage 
(and runs at the same or earlier phase AttachmentOutInterceptor runs at) 
and register it with your JAXWS client, or do not even deal with the 
interceptors and simply set a request property (search for how it can be 
done for JAX-WS)

Sergey
On 30/01/17 12:33, Rodney Kite wrote:
> How do I override the handleMessage if I don't extend it?  I left out the constructor.
>
>     public EntAttachmentOutInterceptor() {
>         super();
>     }
>
>
>       From: Sergey Beryozkin <sb...@gmail.com>
>  To: users@cxf.apache.org
>  Sent: Monday, January 30, 2017 5:33 AM
>  Subject: Re: CXF overriding Content-Transfer-Encoding in MTOM attachement 7bit and 8bit
>
> Does this interceptor run before the actual AttachmentOutInterceptor
> which CXF uses ? (You probably do not need to extend it.)
>
> Sergey
>
>
> On 30/01/17 04:43, Rodney Kite wrote:
>>
>>
>>
>> I'm using JBoss/Wildfly 10.1 which includes CXF 3.1.6.  I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.  My content type header is Content-Type: multipart/related; type="application/xop+xml".  The client is supposed to have 2 Content-Transfer-Encoding headers one set to 8bit before the soap envelope and the other set to 7bit in the Content-Transfer-Encoding before the attachment.
>> The following Interceptor puts 8bit in both CONTENT_TRANSFER_ENCODINGs in the header.  How do I make one before the envelope 8bit and attachments 7bit?
>> public class EntAttachmentOutInterceptor extends AttachmentOutInterceptor {
>>     @Override
>>     public void handleMessage(Message message){
>>         message.put(Message.CONTENT_TRANSFER_ENCODING, "8bit");
>>     }
>> }
>>
>>
>> Here is an example of what they want.  I don't know how to get the attachments Content-Transfer-Encoding to be different value.
>> ---------------------------
>> ID: 3
>> Address: https://la.www4.irs.gov/airp/aca/a2a/1095BC_Transmission_AATS
>> Encoding: UTF-8
>> Http-Method: POST
>> Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c"; start="<ro...@cxf.apache.org>"; start-info="text/xml"
>> Headers: {Accept=[*/*], Accept-Encoding=[gzip,deflate,gzip;q=1.0, identity; q=0.5, *;q=0], Connection=[Keep-Alive], Content-Encoding=[gzip], HOST=[www.polardocs.com], MIME-Version=[1.0], SOAPAction=["BulkRequestTransmitter"]}
>> Payload: --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
>> Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
>> Content-Transfer-Encoding: 8bit
>> Content-ID: <ro...@cxf.apache.org>
>>
>> <soapenv:Envelope>Removed Stuff</soapenv:Envelope>
>> --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
>> Content-Type: text/xml; charset=us-ascii
>> Content-Transfer-Encoding: 7bit
>> Content-ID: <f059a2f0-585e-475b-bf00-90adb744bcb3-3@urn:us:gov:treasury:irs:common>
>> Content-Disposition: attachment; name="1094C_Request_BBBLP_20170130T040244203Z.xml"
>>
>> <?xml version="1.0" encoding="UTF-8"?><n1:Form109495CTransmittalUpstream>Removed Stuff</n1:Form109495CTransmittalUpstream>
>> --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c--
>> --------------------------------------
>>
>>
>>
>>
>>
>> ThanksRodney
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: CXF overriding Content-Transfer-Encoding in MTOM attachement 7bit and 8bit

Posted by Rodney Kite <rk...@yahoo.com.INVALID>.
How do I override the handleMessage if I don't extend it?  I left out the constructor.  

    public EntAttachmentOutInterceptor() {
        super();
    }


      From: Sergey Beryozkin <sb...@gmail.com>
 To: users@cxf.apache.org 
 Sent: Monday, January 30, 2017 5:33 AM
 Subject: Re: CXF overriding Content-Transfer-Encoding in MTOM attachement 7bit and 8bit
   
Does this interceptor run before the actual AttachmentOutInterceptor 
which CXF uses ? (You probably do not need to extend it.)

Sergey


On 30/01/17 04:43, Rodney Kite wrote:
>
>
>
> I'm using JBoss/Wildfly 10.1 which includes CXF 3.1.6.  I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.  My content type header is Content-Type: multipart/related; type="application/xop+xml".  The client is supposed to have 2 Content-Transfer-Encoding headers one set to 8bit before the soap envelope and the other set to 7bit in the Content-Transfer-Encoding before the attachment.
> The following Interceptor puts 8bit in both CONTENT_TRANSFER_ENCODINGs in the header.  How do I make one before the envelope 8bit and attachments 7bit?
> public class EntAttachmentOutInterceptor extends AttachmentOutInterceptor {
>    @Override
>    public void handleMessage(Message message){
>        message.put(Message.CONTENT_TRANSFER_ENCODING, "8bit");
>    }
> }
>
>
> Here is an example of what they want.  I don't know how to get the attachments Content-Transfer-Encoding to be different value.
> ---------------------------
> ID: 3
> Address: https://la.www4.irs.gov/airp/aca/a2a/1095BC_Transmission_AATS
> Encoding: UTF-8
> Http-Method: POST
> Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c"; start="<ro...@cxf.apache.org>"; start-info="text/xml"
> Headers: {Accept=[*/*], Accept-Encoding=[gzip,deflate,gzip;q=1.0, identity; q=0.5, *;q=0], Connection=[Keep-Alive], Content-Encoding=[gzip], HOST=[www.polardocs.com], MIME-Version=[1.0], SOAPAction=["BulkRequestTransmitter"]}
> Payload: --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
> Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
> Content-Transfer-Encoding: 8bit
> Content-ID: <ro...@cxf.apache.org>
>
> <soapenv:Envelope>Removed Stuff</soapenv:Envelope>
> --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
> Content-Type: text/xml; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> Content-ID: <f059a2f0-585e-475b-bf00-90adb744bcb3-3@urn:us:gov:treasury:irs:common>
> Content-Disposition: attachment; name="1094C_Request_BBBLP_20170130T040244203Z.xml"
>
> <?xml version="1.0" encoding="UTF-8"?><n1:Form109495CTransmittalUpstream>Removed Stuff</n1:Form109495CTransmittalUpstream>
> --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c--
> --------------------------------------
>
>
>
>
>
> ThanksRodney
>
>
>
>
>
>
>
>
>
>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/


   

Re: CXF overriding Content-Transfer-Encoding in MTOM attachement 7bit and 8bit

Posted by Sergey Beryozkin <sb...@gmail.com>.
Does this interceptor run before the actual AttachmentOutInterceptor 
which CXF uses ? (You probably do not need to extend it.)

Sergey


On 30/01/17 04:43, Rodney Kite wrote:
>
>
>
> I'm using JBoss/Wildfly 10.1 which includes CXF 3.1.6.   I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.   My content type header is Content-Type: multipart/related; type="application/xop+xml".  The client is supposed to have 2 Content-Transfer-Encoding headers one set to 8bit before the soap envelope and the other set to 7bit in the Content-Transfer-Encoding before the attachment.
> The following Interceptor puts 8bit in both CONTENT_TRANSFER_ENCODINGs in the header.   How do I make one before the envelope 8bit and attachments 7bit?
> public class EntAttachmentOutInterceptor extends AttachmentOutInterceptor {
>     @Override
>     public void handleMessage(Message message){
>         message.put(Message.CONTENT_TRANSFER_ENCODING, "8bit");
>     }
> }
>
>
> Here is an example of what they want.  I don't know how to get the attachments Content-Transfer-Encoding to be different value.
> ---------------------------
> ID: 3
> Address: https://la.www4.irs.gov/airp/aca/a2a/1095BC_Transmission_AATS
> Encoding: UTF-8
> Http-Method: POST
> Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c"; start="<ro...@cxf.apache.org>"; start-info="text/xml"
> Headers: {Accept=[*/*], Accept-Encoding=[gzip,deflate,gzip;q=1.0, identity; q=0.5, *;q=0], Connection=[Keep-Alive], Content-Encoding=[gzip], HOST=[www.polardocs.com], MIME-Version=[1.0], SOAPAction=["BulkRequestTransmitter"]}
> Payload: --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
> Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
> Content-Transfer-Encoding: 8bit
> Content-ID: <ro...@cxf.apache.org>
>
> <soapenv:Envelope>Removed Stuff</soapenv:Envelope>
> --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
> Content-Type: text/xml; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> Content-ID: <f059a2f0-585e-475b-bf00-90adb744bcb3-3@urn:us:gov:treasury:irs:common>
> Content-Disposition: attachment; name="1094C_Request_BBBLP_20170130T040244203Z.xml"
>
> <?xml version="1.0" encoding="UTF-8"?><n1:Form109495CTransmittalUpstream>Removed Stuff</n1:Form109495CTransmittalUpstream>
> --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c--
> --------------------------------------
>
>
>
>
>
> ThanksRodney
>
>
>
>
>
>
>
>
>
>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

CXF overriding Content-Transfer-Encoding in MTOM attachement 7bit and 8bit

Posted by Rodney Kite <rk...@yahoo.com.INVALID>.


I'm using JBoss/Wildfly 10.1 which includes CXF 3.1.6.   I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.   My content type header is Content-Type: multipart/related; type="application/xop+xml".  The client is supposed to have 2 Content-Transfer-Encoding headers one set to 8bit before the soap envelope and the other set to 7bit in the Content-Transfer-Encoding before the attachment.      
The following Interceptor puts 8bit in both CONTENT_TRANSFER_ENCODINGs in the header.   How do I make one before the envelope 8bit and attachments 7bit?
public class EntAttachmentOutInterceptor extends AttachmentOutInterceptor {
    @Override
    public void handleMessage(Message message){
        message.put(Message.CONTENT_TRANSFER_ENCODING, "8bit");
    }
}


Here is an example of what they want.  I don't know how to get the attachments Content-Transfer-Encoding to be different value. 
---------------------------
ID: 3
Address: https://la.www4.irs.gov/airp/aca/a2a/1095BC_Transmission_AATS
Encoding: UTF-8
Http-Method: POST
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c"; start="<ro...@cxf.apache.org>"; start-info="text/xml"
Headers: {Accept=[*/*], Accept-Encoding=[gzip,deflate,gzip;q=1.0, identity; q=0.5, *;q=0], Connection=[Keep-Alive], Content-Encoding=[gzip], HOST=[www.polardocs.com], MIME-Version=[1.0], SOAPAction=["BulkRequestTransmitter"]}
Payload: --uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID: <ro...@cxf.apache.org>

<soapenv:Envelope>Removed Stuff</soapenv:Envelope>
--uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c
Content-Type: text/xml; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-ID: <f059a2f0-585e-475b-bf00-90adb744bcb3-3@urn:us:gov:treasury:irs:common>
Content-Disposition: attachment; name="1094C_Request_BBBLP_20170130T040244203Z.xml"

<?xml version="1.0" encoding="UTF-8"?><n1:Form109495CTransmittalUpstream>Removed Stuff</n1:Form109495CTransmittalUpstream>
--uuid:4b92f285-b0d8-49d3-9b9e-b7d8067a124c--
--------------------------------------





ThanksRodney




    





   

Re: CXF overriding Content-Transfer-Encoding in MTOM attachement

Posted by Sergey Beryozkin <sb...@gmail.com>.
I'm not sure how you do it with JAX-WS proxies, please check the 
archives/search, you'd probably cast it to the CXF JAX-WS ClientImpl and 
then set a property on the request context, something like that.

Or register a custom out interceptor which will sit before 
AttachmentOutInterceptor and which will do 
message.put(Message.CONTENT_TRANSFER_ENCODING, true).

Cheers, Sergey
On 26/01/17 05:08, Rodney Kite wrote:
> I am now running CXF 3.1.6.
>
> How do you set Message.CONTENT_TRANSFER_ENCODING ?   I created an Out Interceptor that inherits from AttachmentOutInterceptor.   There is no value that exists in  message.get(Message.CONTENT_TRANSFER_ENCODING) in the handleMessage function.
>
> ThanksRodney
>
>       From: Sergey Beryozkin <sb...@gmail.com>
>  To: users@cxf.apache.org
>  Sent: Wednesday, January 25, 2017 6:55 AM
>  Subject: Re: CXF overriding Content-Transfer-Encoding in MTOM attachement
>
> Hi
>
> Not sure about CXF 3.0.6, but the latest code shows that
> AttachmentOutInterceptor checks a message contextual property,
> Message.CONTENT_TRANSFER_ENCODING, and if it is set it propagates it to
> AttachmentSerializer
>
> Try the latest CXF 3.0.x
>
> Sergey
> On 25/01/17 06:34, Rodney Kite wrote:
>>
>> I'm using JBoss/Wildfly 10.1 which includes CXF 3.0.6.  I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.  My content type header is Content-Type: multipart/related; type="application/xop+xml".    It appears in CXF if application/xop+xml is set then it will always put Content-Transfer-Encoding: binary in the MTOM attachement headers but the IRS states they want 7bit and 8bit.
>> I have created an Out Interceptor which allows me to set some headers but the content transfer encoding in the attachement is always set to binary.
>>
>> Does anyone know how to stop CXF from overriding the Content-Transfer-Encoding: 8bit setting?
>>
>> ThanksRodney
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Re: CXF overriding Content-Transfer-Encoding in MTOM attachement

Posted by Rodney Kite <rk...@yahoo.com.INVALID>.
I am now running CXF 3.1.6.   

How do you set Message.CONTENT_TRANSFER_ENCODING ?   I created an Out Interceptor that inherits from AttachmentOutInterceptor.   There is no value that exists in  message.get(Message.CONTENT_TRANSFER_ENCODING) in the handleMessage function.    

ThanksRodney

      From: Sergey Beryozkin <sb...@gmail.com>
 To: users@cxf.apache.org 
 Sent: Wednesday, January 25, 2017 6:55 AM
 Subject: Re: CXF overriding Content-Transfer-Encoding in MTOM attachement
   
Hi

Not sure about CXF 3.0.6, but the latest code shows that 
AttachmentOutInterceptor checks a message contextual property, 
Message.CONTENT_TRANSFER_ENCODING, and if it is set it propagates it to 
AttachmentSerializer

Try the latest CXF 3.0.x

Sergey
On 25/01/17 06:34, Rodney Kite wrote:
>
> I'm using JBoss/Wildfly 10.1 which includes CXF 3.0.6.  I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.  My content type header is Content-Type: multipart/related; type="application/xop+xml".    It appears in CXF if application/xop+xml is set then it will always put Content-Transfer-Encoding: binary in the MTOM attachement headers but the IRS states they want 7bit and 8bit.
> I have created an Out Interceptor which allows me to set some headers but the content transfer encoding in the attachement is always set to binary.
>
> Does anyone know how to stop CXF from overriding the Content-Transfer-Encoding: 8bit setting?
>
> ThanksRodney
>
>
>
>
>
>
>
>
>



   

Re: CXF overriding Content-Transfer-Encoding in MTOM attachement

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

Not sure about CXF 3.0.6, but the latest code shows that 
AttachmentOutInterceptor checks a message contextual property, 
Message.CONTENT_TRANSFER_ENCODING, and if it is set it propagates it to 
AttachmentSerializer

Try the latest CXF 3.0.x

Sergey
On 25/01/17 06:34, Rodney Kite wrote:
>
> I'm using JBoss/Wildfly 10.1 which includes CXF 3.0.6.   I'm building a soap client for an IRS web site.  The IRS states to use a MTOM attachement to send an XML document.   My content type header is Content-Type: multipart/related; type="application/xop+xml".    It appears in CXF if application/xop+xml is set then it will always put Content-Transfer-Encoding: binary in the MTOM attachement headers but the IRS states they want 7bit and 8bit.
> I have created an Out Interceptor which allows me to set some headers but the content transfer encoding in the attachement is always set to binary.
>
> Does anyone know how to stop CXF from overriding the Content-Transfer-Encoding: 8bit setting?
>
> ThanksRodney
>
>
>
>
>
>
>
>
>