You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Cathal Callaghan (JIRA)" <ji...@apache.org> on 2008/03/11 11:32:55 UTC

[jira] Created: (AXIS2-3591) MTOM doesnt work over JMS

MTOM doesnt work over JMS
-------------------------

                 Key: AXIS2-3591
                 URL: https://issues.apache.org/jira/browse/AXIS2-3591
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: transports
    Affects Versions: 1.3
         Environment: OS: Windows XP Pro 2002 Service Pack 2
            Reporter: Cathal Callaghan


Performing MTOM optimization over the JMS transport does not work correctly.

There are three main issues involved here:

1) MessageContext.setDoingMTOM()

For the JMS transport a call to MessageContext.setDoingMTOM() will always return false. This is due to the fact that, unlike the HTTP transport, the JMS transport never checks whether enableMTOM has been set in config or programmatically. This means that a JMS message containing binary content will never be optimized.

2) JMSByteMessage always sent as soap1.1 format

The OMOutputFormat class defaults its soap version to soap1.1. The HTTP transport sets this according to the soap namespace used in the soap envolope. JMS however does not do this and the byte message is always sent as soap1.1

3) contentType of JMS message is never set

The contentType of a JMS message is never set. This passes unnoticed on the server when attachments are not involved. However when a message contains attachments the expected contentType of 'multipart/related' is never present and the message is perceived as a non soap/xml message which is incorrect.

I have attached a working solution for the above issue so can submit if agreed

Thanks,

Cathal Callaghan

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3591) MTOM doesnt work over JMS

Posted by "Satyanarayana Murthy Godavarti (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12759692#action_12759692 ] 

Satyanarayana Murthy Godavarti commented on AXIS2-3591:
-------------------------------------------------------

Hi,

We are using Axis2 1.4 version. With Axis HTTP client, MTOM is working.   We are trying to send MTOM attachment using AXIS JMS Client. This is not working. We are not receiving any MTOM attachment on other side.  I am giving the code snippet which I am using in my current project. Please help me.


//Block 1 : Converting Input Stream as an attachment and creating OMElement

OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2/mtomsample/", "mtom");
OMNamespace omNs1 = fac.createOMNamespace("http://www.w3.org/2005/05/xmlmime", "xm");

OMElement root = fac.createOMElement("AttachmentRequest", omNs);
OMElement filename = fac.createOMElement("fileName", omNs);

filename.setText("sample.xml");
	
OMElement attachment = fac.createOMElement("binaryData", omNs);
attachment.addAttribute(fac.createOMAttribute("contentType", omNs1, "application/?"));
javax.mail.util.ByteArrayDataSource bData = null;
bData = new javax.mail.util.ByteArrayDataSource(is,"application/octet-stream");
DataHandler dataHandler = new DataHandler(bData);
OMText textData = fac.createOMText(dataHandler, true);
root.addChild(filename);
root.addChild(attachment);


Block 2 : Choosing JMS Transport and Enabling MTOM
TransportOutDescription transportOutDesc = new TransportOutDescription(Constants.TRANSPORT_JMS);			 
org.apache.axis2.transport.jms.JMSSender sender = new org.apache.axis2.transport.jms.JMSSender();			 
transportOutDesc.setSender(sender);
Options opts = new Options();
EndpointReference epr = new EndpointReference(providerURL);	
opts.setProperty(Constants.Configuration.TRANSPORT_URL, url);
opts.setTo(epr);
opts.setTransportOut(transportOutDesc);
opts.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
opts.setAction(messageName);
opts.setTimeOutInMilliSeconds(timeoutms);
client.setOptions(opts);

Block 3 : Calling Axis JMS method to send MTOM
res = client.sendReceive(req);

Block 4 : on Receiver side

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
	<soapenv:Body>
	<mtom:AttachmentRequest xmlns:mtom="http://ws.apache.org/axis2/mtomsample/">
		<mtom:fileName>Sample.xml</mtom:fileName>
		<mtom:binaryData xmlns:xm="http://www.w3.org/2005/05/xmlmime" xm:contentType="application/?"></mtom:binaryData>
	</mtom:AttachmentRequest>
	</soapenv:Body>
</soapenv:Envelope>


Regards,
Satya

> MTOM doesnt work over JMS
> -------------------------
>
>                 Key: AXIS2-3591
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3591
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.3
>         Environment: OS: Windows XP Pro 2002 Service Pack 2
>            Reporter: Cathal Callaghan
>         Attachments: JMSSender.java
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Performing MTOM optimization over the JMS transport does not work correctly.
> There are three main issues involved here:
> 1) MessageContext.setDoingMTOM()
> For the JMS transport a call to MessageContext.setDoingMTOM() will always return false. This is due to the fact that, unlike the HTTP transport, the JMS transport never checks whether enableMTOM has been set in config or programmatically. This means that a JMS message containing binary content will never be optimized.
> 2) JMSByteMessage always sent as soap1.1 format
> The OMOutputFormat class defaults its soap version to soap1.1. The HTTP transport sets this according to the soap namespace used in the soap envolope. JMS however does not do this and the byte message is always sent as soap1.1
> 3) contentType of JMS message is never set
> The contentType of a JMS message is never set. This passes unnoticed on the server when attachments are not involved. However when a message contains attachments the expected contentType of 'multipart/related' is never present and the message is perceived as a non soap/xml message which is incorrect.
> I have attached a working solution for the above issue so can submit if agreed
> Thanks,
> Cathal Callaghan

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AXIS2-3591) MTOM doesnt work over JMS

Posted by "Cathal Callaghan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cathal Callaghan updated AXIS2-3591:
------------------------------------

    Attachment: JMSSender.java

Attaching proposed solution

> MTOM doesnt work over JMS
> -------------------------
>
>                 Key: AXIS2-3591
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3591
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.3
>         Environment: OS: Windows XP Pro 2002 Service Pack 2
>            Reporter: Cathal Callaghan
>         Attachments: JMSSender.java
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Performing MTOM optimization over the JMS transport does not work correctly.
> There are three main issues involved here:
> 1) MessageContext.setDoingMTOM()
> For the JMS transport a call to MessageContext.setDoingMTOM() will always return false. This is due to the fact that, unlike the HTTP transport, the JMS transport never checks whether enableMTOM has been set in config or programmatically. This means that a JMS message containing binary content will never be optimized.
> 2) JMSByteMessage always sent as soap1.1 format
> The OMOutputFormat class defaults its soap version to soap1.1. The HTTP transport sets this according to the soap namespace used in the soap envolope. JMS however does not do this and the byte message is always sent as soap1.1
> 3) contentType of JMS message is never set
> The contentType of a JMS message is never set. This passes unnoticed on the server when attachments are not involved. However when a message contains attachments the expected contentType of 'multipart/related' is never present and the message is perceived as a non soap/xml message which is incorrect.
> I have attached a working solution for the above issue so can submit if agreed
> Thanks,
> Cathal Callaghan

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-3591) MTOM doesnt work over JMS

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davanum Srinivas resolved AXIS2-3591.
-------------------------------------

    Resolution: Fixed

Fixed in svn revision 636328

thanks,
dims

> MTOM doesnt work over JMS
> -------------------------
>
>                 Key: AXIS2-3591
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3591
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.3
>         Environment: OS: Windows XP Pro 2002 Service Pack 2
>            Reporter: Cathal Callaghan
>         Attachments: JMSSender.java
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Performing MTOM optimization over the JMS transport does not work correctly.
> There are three main issues involved here:
> 1) MessageContext.setDoingMTOM()
> For the JMS transport a call to MessageContext.setDoingMTOM() will always return false. This is due to the fact that, unlike the HTTP transport, the JMS transport never checks whether enableMTOM has been set in config or programmatically. This means that a JMS message containing binary content will never be optimized.
> 2) JMSByteMessage always sent as soap1.1 format
> The OMOutputFormat class defaults its soap version to soap1.1. The HTTP transport sets this according to the soap namespace used in the soap envolope. JMS however does not do this and the byte message is always sent as soap1.1
> 3) contentType of JMS message is never set
> The contentType of a JMS message is never set. This passes unnoticed on the server when attachments are not involved. However when a message contains attachments the expected contentType of 'multipart/related' is never present and the message is perceived as a non soap/xml message which is incorrect.
> I have attached a working solution for the above issue so can submit if agreed
> Thanks,
> Cathal Callaghan

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3591) MTOM doesnt work over JMS

Posted by "Cathal Callaghan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12760174#action_12760174 ] 

Cathal Callaghan commented on AXIS2-3591:
-----------------------------------------

Hi Satya,

In order to enable MTOM over JMS with Axis2 you must ensure the following properties are set on your client:

/* enable MTOM - all binary elements will be serialised as MTOM attachments */
options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); 

/* send JMS messages as byte messages, Axis2 only allows the use of MTOM with byte messages in JMS */
options.setProperty(JMSConstants.JMS_MESSAGE_TYPE, JMSConstants.JMS_BYTE_MESSAGE); 
		
/* use doom axiom tree - this is required when using MTOM and rampart together, if not set
* MTOM will be ignored and all binary data will be sent unoptimised in the SOAP envelope */
options.setProperty(WSSHandlerConstants.USE_DOOM, Constants.VALUE_TRUE); 

If you ensure that these properties are set, you already have Constants.Configuration.ENABLE_MTOM set, you should have no problem.

Thanks,
Cathal

> MTOM doesnt work over JMS
> -------------------------
>
>                 Key: AXIS2-3591
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3591
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.3
>         Environment: OS: Windows XP Pro 2002 Service Pack 2
>            Reporter: Cathal Callaghan
>         Attachments: JMSSender.java
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> Performing MTOM optimization over the JMS transport does not work correctly.
> There are three main issues involved here:
> 1) MessageContext.setDoingMTOM()
> For the JMS transport a call to MessageContext.setDoingMTOM() will always return false. This is due to the fact that, unlike the HTTP transport, the JMS transport never checks whether enableMTOM has been set in config or programmatically. This means that a JMS message containing binary content will never be optimized.
> 2) JMSByteMessage always sent as soap1.1 format
> The OMOutputFormat class defaults its soap version to soap1.1. The HTTP transport sets this according to the soap namespace used in the soap envolope. JMS however does not do this and the byte message is always sent as soap1.1
> 3) contentType of JMS message is never set
> The contentType of a JMS message is never set. This passes unnoticed on the server when attachments are not involved. However when a message contains attachments the expected contentType of 'multipart/related' is never present and the message is perceived as a non soap/xml message which is incorrect.
> I have attached a working solution for the above issue so can submit if agreed
> Thanks,
> Cathal Callaghan

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.