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 Paul Fremantle <pz...@gmail.com> on 2007/07/26 14:23:16 UTC

Supporting content types in Synapse and Axiom

Hi

As Synapse is getting more interest I see a number of people looking
to use it and extend it for binary and text content types as well as
XML.

We already support those from some transports (e.g. JMS) but each
transport defines its own way of handling these things, and so I can't
be sure that a message coming in as binary/jms can go out correctly as
binary/http post.

So here is what I'd like to do:

I'd like to have explicit methods:

OMElement get/setPayload()
DataHandler get/setBytesPayload()
String get/setTextPayload()
boolean isBinary();
boolean isText();
int getPayloadType()

In order to make this work, we should have two well defined QNames -
one for binary and one for text.

For example binary payload will be in a wrapper element called:
<a:binary xmlns:a="http://ws.apache.org/commons/axiom/ns/data">

And text payload could be in
<a:text  xmlns:a="http://ws.apache.org/commons/axiom/ns/data">

So if I setBinaryPayload, basically what happens (under the covers is)

OMElement el = fac.createOMElement("binary", axNS);
OMText bin = fac.createOMText(dh, true);
el.addChild(bin);
getBody().setFirstChild(el);

Now I'd be very happy to do this just in Synapse, but it makes much
more sense to do it in Axiom. That would mean everyone using this
(axis2 transports, synapse mediators, etc) would inherit the same
definitions and use the data in a consistent way. Which is the point
of this.

Paul


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

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


Re: Supporting content types in Synapse and Axiom

Posted by Paul Fremantle <pz...@gmail.com>.
Asankha

I thought of this because Esper is creating Map messages and I had to
create my own mapping from Map to Axiom. So it would make my life
easier :-)

Paul

On 7/27/07, Asankha C. Perera <as...@wso2.com> wrote:
>
>  Paul
>
>  I may be wrong, however, I haven't seen many people actually using JMS Map
> messages.. The Axis2 JMS transport thus supports bytes and text messages. So
> I would think this is a cool feature, but only few many find it actually
> useful...
>
>  asankha
>
>  Paul Fremantle wrote:
>  One more thought. A number of systems use a java Map message as a core
> data type. Especially a Map<String,Object> where Object is actually a
> simple type object such as Float, Double, String, Boolean
>
> In particular JMS supports these. I think it would be valuable to
> define this as a core Synapse datatype. For example, it would be cool
> to be able to mediate between a JMS Map message and another JMS Map
> message, and have a well-defined schema for what the Axiom
> representation would look like in Synapse.
>
> Paul
>
> On 7/26/07, Paul Fremantle <pz...@gmail.com> wrote:
>
>
>  Hi
>
> As Synapse is getting more interest I see a number of people looking
> to use it and extend it for binary and text content types as well as
> XML.
>
> We already support those from some transports (e.g. JMS) but each
> transport defines its own way of handling these things, and so I can't
> be sure that a message coming in as binary/jms can go out correctly as
> binary/http post.
>
> So here is what I'd like to do:
>
> I'd like to have explicit methods:
>
> OMElement get/setPayload()
> DataHandler get/setBytesPayload()
> String get/setTextPayload()
> boolean isBinary();
> boolean isText();
> int getPayloadType()
>
> In order to make this work, we should have two well defined QNames -
> one for binary and one for text.
>
> For example binary payload will be in a wrapper element called:
> <a:binary
> xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> And text payload could be in
> <a:text
> xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> So if I setBinaryPayload, basically what happens (under the covers is)
>
> OMElement el = fac.createOMElement("binary", axNS);
> OMText bin = fac.createOMText(dh, true);
> el.addChild(bin);
> getBody().setFirstChild(el);
>
> Now I'd be very happy to do this just in Synapse, but it makes much
> more sense to do it in Axiom. That would mean everyone using this
> (axis2 transports, synapse mediators, etc) would inherit the same
> definitions and use the data in a consistent way. Which is the point
> of this.
>
> Paul
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

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


Re: Supporting content types in Synapse and Axiom

Posted by Paul Fremantle <pz...@gmail.com>.
Asankha

I thought of this because Esper is creating Map messages and I had to
create my own mapping from Map to Axiom. So it would make my life
easier :-)

Paul

On 7/27/07, Asankha C. Perera <as...@wso2.com> wrote:
>
>  Paul
>
>  I may be wrong, however, I haven't seen many people actually using JMS Map
> messages.. The Axis2 JMS transport thus supports bytes and text messages. So
> I would think this is a cool feature, but only few many find it actually
> useful...
>
>  asankha
>
>  Paul Fremantle wrote:
>  One more thought. A number of systems use a java Map message as a core
> data type. Especially a Map<String,Object> where Object is actually a
> simple type object such as Float, Double, String, Boolean
>
> In particular JMS supports these. I think it would be valuable to
> define this as a core Synapse datatype. For example, it would be cool
> to be able to mediate between a JMS Map message and another JMS Map
> message, and have a well-defined schema for what the Axiom
> representation would look like in Synapse.
>
> Paul
>
> On 7/26/07, Paul Fremantle <pz...@gmail.com> wrote:
>
>
>  Hi
>
> As Synapse is getting more interest I see a number of people looking
> to use it and extend it for binary and text content types as well as
> XML.
>
> We already support those from some transports (e.g. JMS) but each
> transport defines its own way of handling these things, and so I can't
> be sure that a message coming in as binary/jms can go out correctly as
> binary/http post.
>
> So here is what I'd like to do:
>
> I'd like to have explicit methods:
>
> OMElement get/setPayload()
> DataHandler get/setBytesPayload()
> String get/setTextPayload()
> boolean isBinary();
> boolean isText();
> int getPayloadType()
>
> In order to make this work, we should have two well defined QNames -
> one for binary and one for text.
>
> For example binary payload will be in a wrapper element called:
> <a:binary
> xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> And text payload could be in
> <a:text
> xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> So if I setBinaryPayload, basically what happens (under the covers is)
>
> OMElement el = fac.createOMElement("binary", axNS);
> OMText bin = fac.createOMText(dh, true);
> el.addChild(bin);
> getBody().setFirstChild(el);
>
> Now I'd be very happy to do this just in Synapse, but it makes much
> more sense to do it in Axiom. That would mean everyone using this
> (axis2 transports, synapse mediators, etc) would inherit the same
> definitions and use the data in a consistent way. Which is the point
> of this.
>
> Paul
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

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


Re: Supporting content types in Synapse and Axiom

Posted by Paul Fremantle <pz...@gmail.com>.
One more thought. A number of systems use a java Map message as a core
data type. Especially a Map<String,Object> where Object is actually a
simple type object such as Float, Double, String, Boolean

In particular JMS supports these. I think it would be valuable to
define this as a core Synapse datatype. For example, it would be cool
to be able to mediate between a JMS Map message and another JMS Map
message, and have a well-defined schema for what the Axiom
representation would look like in Synapse.

Paul

On 7/26/07, Paul Fremantle <pz...@gmail.com> wrote:
> Hi
>
> As Synapse is getting more interest I see a number of people looking
> to use it and extend it for binary and text content types as well as
> XML.
>
> We already support those from some transports (e.g. JMS) but each
> transport defines its own way of handling these things, and so I can't
> be sure that a message coming in as binary/jms can go out correctly as
> binary/http post.
>
> So here is what I'd like to do:
>
> I'd like to have explicit methods:
>
> OMElement get/setPayload()
> DataHandler get/setBytesPayload()
> String get/setTextPayload()
> boolean isBinary();
> boolean isText();
> int getPayloadType()
>
> In order to make this work, we should have two well defined QNames -
> one for binary and one for text.
>
> For example binary payload will be in a wrapper element called:
> <a:binary xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> And text payload could be in
> <a:text  xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> So if I setBinaryPayload, basically what happens (under the covers is)
>
> OMElement el = fac.createOMElement("binary", axNS);
> OMText bin = fac.createOMText(dh, true);
> el.addChild(bin);
> getBody().setFirstChild(el);
>
> Now I'd be very happy to do this just in Synapse, but it makes much
> more sense to do it in Axiom. That would mean everyone using this
> (axis2 transports, synapse mediators, etc) would inherit the same
> definitions and use the data in a consistent way. Which is the point
> of this.
>
> Paul
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

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


Re: Supporting content types in Synapse and Axiom

Posted by Paul Fremantle <pz...@gmail.com>.
> > We already support those from some transports (e.g. JMS) but each
> > transport defines its own way of handling these things,
>
> This is not clear to me , what each transport does is depending on the
> content type it get the correct builder and asked him to build the Axiom
> . And the transport will give the input stream to the builder.
>
> When it come to write to the wire , transport will pick the correct
> message formatter and give him the output stream and the Axiom and that
> guy will serialize the message accordingly .
> > and so I can't
> > be sure that a message coming in as binary/jms can go out correctly as
> > binary/http post.
> >
> You mean you want to know the exact wire format ?

No. I guess I wasn't very clear about the relationship with
transports. Let me try to be clearer.

At the moment, if you send a binary message into Axis2 over JMS then
it goes into a wrapper element:
<soap:body>
   <axis2ns:jmsMessage>LAKJDF98ADFHASDLKJDFALKJ==</axis2ns:jmsMessage>
</soap:body>

In addition there is a property set to indicate this is a BytesMessage
(e.g. binary).

Now, if I create a FileTransport that also deals with binary files,
and it looks/sets binary data into a default wrapper:
<soap:body>
  <axis2ns:fileMessage>DlKjlkajsdlkj982w3lhjasdljkh0==</axis2ns:fileMessage>
</soap:body>

Now I need to write a mediator to change the element name - simply in
order to map between these two transports. Also I have to write logic
to find out what type of message it is and whether there really is a
wrapper element.

Instead, I'm suggesting we have a well-defined element QName for any
binary content *regardless* of which transport it came in through our
goes out of.

Is that clearer?

Paul

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


Re: Supporting content types in Synapse and Axiom

Posted by Deepal jayasinghe <de...@gmail.com>.
> Hi
>
> As Synapse is getting more interest I see a number of people looking
> to use it and extend it for binary and text content types as well as
> XML.
>   
Not only in Synapse but also in Axis2 I can see a lot of guys are asking
for this.
> We already support those from some transports (e.g. JMS) but each
> transport defines its own way of handling these things, 

This is not clear to me , what each transport does is depending on the
content type it get the correct builder and asked him to build the Axiom
. And the transport will give the input stream to the builder.

When it come to write to the wire , transport will pick the correct
message formatter and give him the output stream and the Axiom and that
guy will serialize the message accordingly .
> and so I can't
> be sure that a message coming in as binary/jms can go out correctly as
> binary/http post.
>   
You mean you want to know the exact wire format ?
> So here is what I'd like to do:
>
> I'd like to have explicit methods:
>
> OMElement get/setPayload()
>   
This is not clear to me , what do you mean by set and get Payload , isnt
that you getting and setting a child node ?
> DataHandler get/setBytesPayload()
>   
+1
> String get/setTextPayload()
> boolean isBinary();
> boolean isText();
> int getPayloadType()
>   
What would be the result ?
> In order to make this work, we should have two well defined QNames -
> one for binary and one for text.
>
> For example binary payload will be in a wrapper element called:
> <a:binary xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> And text payload could be in
> <a:text  xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>   
What do you mean by text pay load , what is the difference between
Omelement.getText and Omelement.getTextPayload() ?
> So if I setBinaryPayload, basically what happens (under the covers is)
>
> OMElement el = fac.createOMElement("binary", axNS);
> OMText bin = fac.createOMText(dh, true);
> el.addChild(bin);
> getBody().setFirstChild(el);
>   
+1 , that will be very convenient.
> Now I'd be very happy to do this just in Synapse, but it makes much
> more sense to do it in Axiom. 
Yes.
> That would mean everyone using this
> (axis2 transports, synapse mediators, etc) would inherit the same
> definitions and use the data in a consistent way. Which is the point
> of this.
>
> Paul
>
>
>   
Thanks
Deepal


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


Re: Supporting content types in Synapse and Axiom

Posted by Paul Fremantle <pz...@gmail.com>.
One more thought. A number of systems use a java Map message as a core
data type. Especially a Map<String,Object> where Object is actually a
simple type object such as Float, Double, String, Boolean

In particular JMS supports these. I think it would be valuable to
define this as a core Synapse datatype. For example, it would be cool
to be able to mediate between a JMS Map message and another JMS Map
message, and have a well-defined schema for what the Axiom
representation would look like in Synapse.

Paul

On 7/26/07, Paul Fremantle <pz...@gmail.com> wrote:
> Hi
>
> As Synapse is getting more interest I see a number of people looking
> to use it and extend it for binary and text content types as well as
> XML.
>
> We already support those from some transports (e.g. JMS) but each
> transport defines its own way of handling these things, and so I can't
> be sure that a message coming in as binary/jms can go out correctly as
> binary/http post.
>
> So here is what I'd like to do:
>
> I'd like to have explicit methods:
>
> OMElement get/setPayload()
> DataHandler get/setBytesPayload()
> String get/setTextPayload()
> boolean isBinary();
> boolean isText();
> int getPayloadType()
>
> In order to make this work, we should have two well defined QNames -
> one for binary and one for text.
>
> For example binary payload will be in a wrapper element called:
> <a:binary xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> And text payload could be in
> <a:text  xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> So if I setBinaryPayload, basically what happens (under the covers is)
>
> OMElement el = fac.createOMElement("binary", axNS);
> OMText bin = fac.createOMText(dh, true);
> el.addChild(bin);
> getBody().setFirstChild(el);
>
> Now I'd be very happy to do this just in Synapse, but it makes much
> more sense to do it in Axiom. That would mean everyone using this
> (axis2 transports, synapse mediators, etc) would inherit the same
> definitions and use the data in a consistent way. Which is the point
> of this.
>
> Paul
>
>
> --
> Paul Fremantle
> Co-Founder and VP of Technical Sales, WSO2
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

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


Re: Supporting content types in Synapse and Axiom

Posted by Deepal jayasinghe <de...@gmail.com>.
> Hi
>
> As Synapse is getting more interest I see a number of people looking
> to use it and extend it for binary and text content types as well as
> XML.
>   
Not only in Synapse but also in Axis2 I can see a lot of guys are asking
for this.
> We already support those from some transports (e.g. JMS) but each
> transport defines its own way of handling these things, 

This is not clear to me , what each transport does is depending on the
content type it get the correct builder and asked him to build the Axiom
. And the transport will give the input stream to the builder.

When it come to write to the wire , transport will pick the correct
message formatter and give him the output stream and the Axiom and that
guy will serialize the message accordingly .
> and so I can't
> be sure that a message coming in as binary/jms can go out correctly as
> binary/http post.
>   
You mean you want to know the exact wire format ?
> So here is what I'd like to do:
>
> I'd like to have explicit methods:
>
> OMElement get/setPayload()
>   
This is not clear to me , what do you mean by set and get Payload , isnt
that you getting and setting a child node ?
> DataHandler get/setBytesPayload()
>   
+1
> String get/setTextPayload()
> boolean isBinary();
> boolean isText();
> int getPayloadType()
>   
What would be the result ?
> In order to make this work, we should have two well defined QNames -
> one for binary and one for text.
>
> For example binary payload will be in a wrapper element called:
> <a:binary xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>
> And text payload could be in
> <a:text  xmlns:a="http://ws.apache.org/commons/axiom/ns/data">
>   
What do you mean by text pay load , what is the difference between
Omelement.getText and Omelement.getTextPayload() ?
> So if I setBinaryPayload, basically what happens (under the covers is)
>
> OMElement el = fac.createOMElement("binary", axNS);
> OMText bin = fac.createOMText(dh, true);
> el.addChild(bin);
> getBody().setFirstChild(el);
>   
+1 , that will be very convenient.
> Now I'd be very happy to do this just in Synapse, but it makes much
> more sense to do it in Axiom. 
Yes.
> That would mean everyone using this
> (axis2 transports, synapse mediators, etc) would inherit the same
> definitions and use the data in a consistent way. Which is the point
> of this.
>
> Paul
>
>
>   
Thanks
Deepal


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