You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Sylvain Legault <sy...@gmail.com> on 2008/05/09 20:25:35 UTC

POX proxy with custom Content-Type

Hi,



I'm trying to do a simple XML proxy were the contenttype is not
application/xml but rather application/vnd.xyz.xml where is xyz may be few
different values but in this case let's assume it is xyz.



First I found that I needed to modify my axis2.xml (is there another way?),
otherwise I get that the incoming HTTP post is not SOAP and there is no
Envelope



    <messageFormatters>

:::

        <messageFormatter contentType="application/vnd.xyzxml"


class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>

    </messageFormatters>





    <messageBuilders>

:::

        <messageBuilder contentType="application/vnd.xyz.xml"


class="org.apache.axis2.builder.ApplicationXMLBuilder"/>

    </messageBuilders>



I'm also using the following definition



<definitions xmlns="http://ws.apache.org/ns/synapse">
    <!-- filtering of messages with XPath and regex matches -->
    <filter source="get-property('To')" regex=".*/xyz.*">
        <send>
            <endpoint>
                <address uri="*http://10.4.3.110:1563/xyz*" format="pox"/>
            </endpoint>
        </send>
        <drop/>
    </filter>
    <send/>
</definitions>



My problem is that the message goes thru but ended up on the other side with
application/xml.



I have also try to create my own java mediator with another definition but
still fails to change the content type and before I go too far I would like
to know if anyone had tried it before and how?



Thanks

Sylvain Legault

Re: POX proxy with custom Content-Type

Posted by Ruwan Linton <ru...@gmail.com>.
Paul,

Are you proposing to modify the axis configuration at the proxy build time
to add this entry to the builder and formatter maps? I couldn't think of any
other way. Even then we will have to ask user to specify the Builder and
Formatter impl to be used with the ContentType they configure. If not
provided we can take it as ApplicationXML?

Is that what you mean?

Thanks,
Ruwan.

On Sat, May 10, 2008 at 1:33 PM, Paul Fremantle <pz...@gmail.com> wrote:

> Folks
>
> What do you think about us adding this into the proxy definition (the
> XML type) and automatically configuring Axis2 so that the user doesn't
> need to modify the axis2.xml?
>
> Paul
>
>
> ---------- Forwarded message ----------
> From: Ruwan Linton <ru...@gmail.com>
> Date: Sat, May 10, 2008 at 2:30 AM
> Subject: Re: POX proxy with custom Content-Type
> To: user@synapse.apache.org
>
>
> Hi Sylvain,
>
> I am afraid, the property name contentType has to be modified as
> ContentType. [first letter capitalized] messageType remains as it is.
>
> Thanks,
> Ruwan
>
> On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
> wrote:
>
> > Hi Sylvain,
> >
> > Please see my comments in-line;
> >
> > On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
> > wrote:
> >
> >> Hi,
> >>
> >> I'm trying to do a simple XML proxy were the contenttype is not
> >> application/xml but rather application/vnd.xyz.xml where is xyz may be
> few
> >> different values but in this case let's assume it is xyz.
> >>
> >> First I found that I needed to modify my axis2.xml (is there another
> >> way?),
> >> otherwise I get that the incoming HTTP post is not SOAP and there is no
> >> Envelope
> >
> >
> > No there is no other way to tell Synapse that this message has to be
> built
> > using this message builder. So you have to have that mapping.
> >
> >
> >>    <messageFormatters>
> >> :::
> >>        <messageFormatter contentType="application/vnd.xyzxml"
> >> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
> >>    </messageFormatters>
> >>    <messageBuilders>
> >> :::
> >>        <messageBuilder contentType="application/vnd.xyz.xml"
> >> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> >>    </messageBuilders>
> >>
> >> I'm also using the following definition
> >>
> >> <definitions xmlns="http://ws.apache.org/ns/synapse">
> >>    <!-- filtering of messages with XPath and regex matches -->
> >>    <filter source="get-property('To')" regex=".*/xyz.*">
> >
> >            <property name="messageType" value="application/vnd.xyzxml"
> > scope="axis2"/>
> >            <property name="contentType" value="application/vnd.xyzxml"
> > scope="axis2"/>
> >
> >>
> >>        <send>
> >>            <endpoint>
> >>                <address uri="*http://10.4.3.110:1563/xyz*"
> format="pox"/>
> >>            </endpoint>
> >>        </send>
> >>        <drop/>
> >>    </filter>
> >>    <send/>
> >> </definitions>
> >>
> >> My problem is that the message goes thru but ended up on the other side
> >> with
> >> application/xml.
> >>
> >> I have also try to create my own java mediator with another definition
> but
> >> still fails to change the content type and before I go too far I would
> >> like
> >> to know if anyone had tried it before and how?
> >
> >
> > I have modified the above configuration, and you can try that
> > configuration. I think it will work.
> >
> > Thanks,
> > Ruwan
> >
> > --
> > Ruwan Linton
> > http://www.wso2.org - "Oxygenating the Web Services Platform"
>
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>
>
>
> --
> Paul Fremantle
> Co-Founder and CTO, WSO2
> Apache Synapse PMC Chair
> 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: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>


-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Fwd: POX proxy with custom Content-Type

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

What do you think about us adding this into the proxy definition (the
XML type) and automatically configuring Axis2 so that the user doesn't
need to modify the axis2.xml?

Paul


---------- Forwarded message ----------
From: Ruwan Linton <ru...@gmail.com>
Date: Sat, May 10, 2008 at 2:30 AM
Subject: Re: POX proxy with custom Content-Type
To: user@synapse.apache.org


Hi Sylvain,

I am afraid, the property name contentType has to be modified as
ContentType. [first letter capitalized] messageType remains as it is.

Thanks,
Ruwan

On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
wrote:

> Hi Sylvain,
>
> Please see my comments in-line;
>
> On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm trying to do a simple XML proxy were the contenttype is not
>> application/xml but rather application/vnd.xyz.xml where is xyz may be few
>> different values but in this case let's assume it is xyz.
>>
>> First I found that I needed to modify my axis2.xml (is there another
>> way?),
>> otherwise I get that the incoming HTTP post is not SOAP and there is no
>> Envelope
>
>
> No there is no other way to tell Synapse that this message has to be built
> using this message builder. So you have to have that mapping.
>
>
>>    <messageFormatters>
>> :::
>>        <messageFormatter contentType="application/vnd.xyzxml"
>> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
>>    </messageFormatters>
>>    <messageBuilders>
>> :::
>>        <messageBuilder contentType="application/vnd.xyz.xml"
>> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>>    </messageBuilders>
>>
>> I'm also using the following definition
>>
>> <definitions xmlns="http://ws.apache.org/ns/synapse">
>>    <!-- filtering of messages with XPath and regex matches -->
>>    <filter source="get-property('To')" regex=".*/xyz.*">
>
>            <property name="messageType" value="application/vnd.xyzxml"
> scope="axis2"/>
>            <property name="contentType" value="application/vnd.xyzxml"
> scope="axis2"/>
>
>>
>>        <send>
>>            <endpoint>
>>                <address uri="*http://10.4.3.110:1563/xyz*" format="pox"/>
>>            </endpoint>
>>        </send>
>>        <drop/>
>>    </filter>
>>    <send/>
>> </definitions>
>>
>> My problem is that the message goes thru but ended up on the other side
>> with
>> application/xml.
>>
>> I have also try to create my own java mediator with another definition but
>> still fails to change the content type and before I go too far I would
>> like
>> to know if anyone had tried it before and how?
>
>
> I have modified the above configuration, and you can try that
> configuration. I think it will work.
>
> Thanks,
> Ruwan
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"




--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"



-- 
Paul Fremantle
Co-Founder and CTO, WSO2
Apache Synapse PMC Chair
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: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: POX proxy with custom Content-Type

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Sylvain,

On Sat, May 10, 2008 at 7:26 PM, Sylvain Legault <sy...@gmail.com>
wrote:

> Hi Ruwan,
>
> I updated my svn view and is is working (I verified and it is not working
> with the release 1.1.1).


Cool, as expected :-)


>
>
> One thing that worry me is that it is copied in the
> setNonReplicableProperty().
> Does this means that it would not work in clustered? I have not setup a
> clustered environment so I cannot tell for sure, but by the look of the
> method name/description this would be the case.


Yes. These properties will not be replicated among the cluster (if there is
a one). This cloned message is used just for sending out the message and
hence no other server in the cluster has to know about this cloned message
and its properties. Further if in any case these properties are required to
replicate it will be handled by the required party, this is because most of
the part of the ESB is stateless and does not require replication of state,
so the stateful parts (like load balancing, caching and throttling) are
responsible for the state replication if required. Otherwise it is going to
be a huge performance issue when hosted as a cluster.

I can guarantee that this has been done intentionally and will have no
impact on execution over a clustered environment.


>
>
> Thanks for the help, let me know if you need more from me.


You're  welcome. You may test this over a cluster and see, it will work as
you expected. :-)

Thanks,
Ruwan


>
> Sylvain Legault
>
> On Sat, May 10, 2008 at 8:30 AM, Ruwan Linton <ru...@gmail.com>
> wrote:
>
> > Sylvain,
> >
> > I think now it is fixed on the 1.2 branch. 2 # days back Rod has reported
> > the issue with message context properties and I have resolved that [1]
> >
> > So if you can get a build out of the 1.2 branch this should be working.
> >
> > [1] - https://issues.apache.org/jira/browse/SYNAPSE-295
> >
> > Thanks,
> > Ruwan
> >
> > On Sat, May 10, 2008 at 5:41 PM, Ruwan Linton <ru...@gmail.com>
> >  wrote:
> >
> > > Hi Sylvain,
> > >
> > > I hope not just this property, but all the axis2 message context
> > properties
> > > has to be copied by the clonePartially method.
> > >
> > > Could you please report this through the JIRA. I will fix it ASAP and
> we
> > > will be doing a QA build 2 on Monday so that you can test that build
> for
> > the
> > > verification.
> > >
> > > Thanks for pointing this.
> > >
> > > Thanks,
> > > Rwuan
> > >
> > >
> > > On Sat, May 10, 2008 at 4:49 PM, Sylvain Legault <sy...@gmail.com>
> > > wrote:
> > >
> > >> Hi Ruwan,
> > >>
> > >> thansk for the quick reply, I think you are right but sadly I also
> think
> > >> there is a but the prevent it to be copied correclty. I did what you
> > said
> > >> witht he ContentType and I also did a java mediator and both give the
> > same
> > >> result. I trace the program step by step in debuger mode and found the
> > >> following (I'm using the trunck from early this week):
> > >>
> > >> When Axis2FlexibleMEPClient.java axisOutMsgCtx see:
> > >>        MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
> > >> The result is that the axisOutMsgCtx does not contains the properties
> > >> anymore :( since only properties explicitely state are copied over.
> This
> > >> could be done in two places:
> > >>
> > >> private static MessageContext cloneForSend(MessageContext ori) throws
> > >> AxisFault {
> > >>        MessageContext newMC = MessageHelper.clonePartially(ori);
> > >>        newMC.setEnvelope(ori.getEnvelope());
> > >>        removeAddressingHeaders(newMC);
> > >>
> > >>
> > >>
> >
> newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
> > >>
> > >>
> > >>
> >
> ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
> > >>
> > >>  // FIX for content type
> > >>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
> > >>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
> > >>        return newMC;
> > >>    }
> > >>
> > >> Or in MessageHelper.java
> > >>
> > >>        org.apache.axis2.context.MessageContext ori) throws AxisFault {
> > >>        org.apache.axis2.context.MessageContext newMC
> > >>            = new org.apache.axis2.context.MessageContext();
> > >>
> > >>        // do not copy options from the original
> > >>        newMC.setConfigurationContext(ori.getConfigurationContext());
> > >>        newMC.setMessageID(UUIDGenerator.getUUID());
> > >>        newMC.setTo(ori.getTo());
> > >>        newMC.setSoapAction(ori.getSoapAction());
> > >>
> > >>
> > >>
> >
> newMC.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
> > >>
> > >>
> > >>
> >
> ori.getProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING));
> > >>
> > >>
> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
> > >>
> > >>
> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM));
> > >>
> > >> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA,
> > >>
> > >> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA));
> > >>        newMC.setProperty(Constants.Configuration.HTTP_METHOD,
> > >>            ori.getProperty(Constants.Configuration.HTTP_METHOD));
> > >>        //coping the Message type from req to res to get the message
> > >> formatters working correctly.
> > >>        newMC.setProperty(Constants.Configuration.MESSAGE_TYPE,
> > >>                ori.getProperty(Constants.Configuration.MESSAGE_TYPE));
> > >>
> > >> // FIX for content type
> > >>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
> > >>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
> > >>
> > >> Both fix work just fine with the following defintion:
> > >>
> > >>
> > >> <definitions xmlns="http://ws.apache.org/ns/synapse">
> > >>    <!-- filtering of messages with XPath and regex matches -->
> > >>    <filter source="get-property('To')" regex=".*/xyz.*">
> > >>         <property name="ContentType" value="application/vnd.xyz.xml"
> > >>                   scope="axis2"/>
> > >>        <send>
> > >>            <endpoint>
> > >>                <address uri="http://10.4.3.110:1563/xyz"
> format="pox"/>
> > >>            </endpoint>
> > >>        </send>
> > >>        <drop/>
> > >>    </filter>
> > >>    <send/>
> > >> </definitions>
> > >>
> > >> Let me know what you think or anyone else and if I  should report this
> > as
> > >> a
> > >> bug.
> > >>
> > >> Thanks
> > >> Sylvain
> > >>
> > >> On Fri, May 9, 2008 at 9:30 PM, Ruwan Linton <ru...@gmail.com>
> > >> wrote:
> > >>
> > >> > Hi Sylvain,
> > >> >
> > >> > I am afraid, the property name contentType has to be modified as
> > >> > ContentType. [first letter capitalized] messageType remains as it
> is.
> > >> >
> > >> > Thanks,
> > >> > Ruwan
> > >> >
> > >> > On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <
> ruwan.linton@gmail.com
> > >
> > >> > wrote:
> > >> >
> > >> > > Hi Sylvain,
> > >> > >
> > >> > > Please see my comments in-line;
> > >> > >
> > >> > > On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <
> > syl20lego@gmail.com
> > >> >
> > >> > > wrote:
> > >> > >
> > >> > >> Hi,
> > >> > >>
> > >> > >> I'm trying to do a simple XML proxy were the contenttype is not
> > >> > >> application/xml but rather application/vnd.xyz.xml where is xyz
> may
> > >> be
> > >> > few
> > >> > >> different values but in this case let's assume it is xyz.
> > >> > >>
> > >> > >> First I found that I needed to modify my axis2.xml (is there
> > another
> > >> > >> way?),
> > >> > >> otherwise I get that the incoming HTTP post is not SOAP and there
> > is
> > >> no
> > >> > >> Envelope
> > >> > >
> > >> > >
> > >> > > No there is no other way to tell Synapse that this message has to
> be
> > >> > built
> > >> > > using this message builder. So you have to have that mapping.
> > >> > >
> > >> > >
> > >> > >>    <messageFormatters>
> > >> > >> :::
> > >> > >>        <messageFormatter contentType="application/vnd.xyzxml"
> > >> > >> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
> > >> > >>    </messageFormatters>
> > >> > >>    <messageBuilders>
> > >> > >> :::
> > >> > >>        <messageBuilder contentType="application/vnd.xyz.xml"
> > >> > >> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> > >> > >>    </messageBuilders>
> > >> > >>
> > >> > >> I'm also using the following definition
> > >> > >>
> > >> > >> <definitions xmlns="http://ws.apache.org/ns/synapse">
> > >> > >>    <!-- filtering of messages with XPath and regex matches -->
> > >> > >>    <filter source="get-property('To')" regex=".*/xyz.*">
> > >> > >
> > >> > >            <property name="messageType"
> > value="application/vnd.xyzxml"
> > >> > > scope="axis2"/>
> > >> > >            <property name="contentType"
> > value="application/vnd.xyzxml"
> > >> > > scope="axis2"/>
> > >> > >
> > >> > >>
> > >> > >>        <send>
> > >> > >>            <endpoint>
> > >> > >>                <address uri="*http://10.4.3.110:1563/xyz*"
> > >> > format="pox"/>
> > >> > >>            </endpoint>
> > >> > >>        </send>
> > >> > >>        <drop/>
> > >> > >>    </filter>
> > >> > >>    <send/>
> > >> > >> </definitions>
> > >> > >>
> > >> > >> My problem is that the message goes thru but ended up on the
> other
> > >> side
> > >> > >> with
> > >> > >> application/xml.
> > >> > >>
> > >> > >> I have also try to create my own java mediator with another
> > >> definition
> > >> > but
> > >> > >> still fails to change the content type and before I go too far I
> > >> would
> > >> > >> like
> > >> > >> to know if anyone had tried it before and how?
> > >> > >
> > >> > >
> > >> > > I have modified the above configuration, and you can try that
> > >> > > configuration. I think it will work.
> > >> > >
> > >> > > Thanks,
> > >> > > Ruwan
> > >> > >
> > >> > > --
> > >> > > Ruwan Linton
> > >> > > http://www.wso2.org - "Oxygenating the Web Services Platform"
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > Ruwan Linton
> > >> > http://www.wso2.org - "Oxygenating the Web Services Platform"
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > Ruwan Linton
> > > http://www.wso2.org - "Oxygenating the Web Services Platform"
> > >
> >
> >
> >
> > --
> >  Ruwan Linton
> > http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: POX proxy with custom Content-Type

Posted by Sylvain Legault <sy...@gmail.com>.
Hi Ruwan,

I updated my svn view and is is working (I verified and it is not working
with the release 1.1.1).

One thing that worry me is that it is copied in the
setNonReplicableProperty().
Does this means that it would not work in clustered? I have not setup a
clustered environment so I cannot tell for sure, but by the look of the
method name/description this would be the case.

Thanks for the help, let me know if you need more from me.
Sylvain Legault

On Sat, May 10, 2008 at 8:30 AM, Ruwan Linton <ru...@gmail.com>
wrote:

> Sylvain,
>
> I think now it is fixed on the 1.2 branch. 2 # days back Rod has reported
> the issue with message context properties and I have resolved that [1]
>
> So if you can get a build out of the 1.2 branch this should be working.
>
> [1] - https://issues.apache.org/jira/browse/SYNAPSE-295
>
> Thanks,
> Ruwan
>
> On Sat, May 10, 2008 at 5:41 PM, Ruwan Linton <ru...@gmail.com>
>  wrote:
>
> > Hi Sylvain,
> >
> > I hope not just this property, but all the axis2 message context
> properties
> > has to be copied by the clonePartially method.
> >
> > Could you please report this through the JIRA. I will fix it ASAP and we
> > will be doing a QA build 2 on Monday so that you can test that build for
> the
> > verification.
> >
> > Thanks for pointing this.
> >
> > Thanks,
> > Rwuan
> >
> >
> > On Sat, May 10, 2008 at 4:49 PM, Sylvain Legault <sy...@gmail.com>
> > wrote:
> >
> >> Hi Ruwan,
> >>
> >> thansk for the quick reply, I think you are right but sadly I also think
> >> there is a but the prevent it to be copied correclty. I did what you
> said
> >> witht he ContentType and I also did a java mediator and both give the
> same
> >> result. I trace the program step by step in debuger mode and found the
> >> following (I'm using the trunck from early this week):
> >>
> >> When Axis2FlexibleMEPClient.java axisOutMsgCtx see:
> >>        MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
> >> The result is that the axisOutMsgCtx does not contains the properties
> >> anymore :( since only properties explicitely state are copied over. This
> >> could be done in two places:
> >>
> >> private static MessageContext cloneForSend(MessageContext ori) throws
> >> AxisFault {
> >>        MessageContext newMC = MessageHelper.clonePartially(ori);
> >>        newMC.setEnvelope(ori.getEnvelope());
> >>        removeAddressingHeaders(newMC);
> >>
> >>
> >>
> newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
> >>
> >>
> >>
> ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
> >>
> >>  // FIX for content type
> >>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
> >>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
> >>        return newMC;
> >>    }
> >>
> >> Or in MessageHelper.java
> >>
> >>        org.apache.axis2.context.MessageContext ori) throws AxisFault {
> >>        org.apache.axis2.context.MessageContext newMC
> >>            = new org.apache.axis2.context.MessageContext();
> >>
> >>        // do not copy options from the original
> >>        newMC.setConfigurationContext(ori.getConfigurationContext());
> >>        newMC.setMessageID(UUIDGenerator.getUUID());
> >>        newMC.setTo(ori.getTo());
> >>        newMC.setSoapAction(ori.getSoapAction());
> >>
> >>
> >>
> newMC.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
> >>
> >>
> >>
> ori.getProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING));
> >>
> >> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
> >>
> >> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM));
> >>
> >> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA,
> >>
> >> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA));
> >>        newMC.setProperty(Constants.Configuration.HTTP_METHOD,
> >>            ori.getProperty(Constants.Configuration.HTTP_METHOD));
> >>        //coping the Message type from req to res to get the message
> >> formatters working correctly.
> >>        newMC.setProperty(Constants.Configuration.MESSAGE_TYPE,
> >>                ori.getProperty(Constants.Configuration.MESSAGE_TYPE));
> >>
> >> // FIX for content type
> >>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
> >>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
> >>
> >> Both fix work just fine with the following defintion:
> >>
> >>
> >> <definitions xmlns="http://ws.apache.org/ns/synapse">
> >>    <!-- filtering of messages with XPath and regex matches -->
> >>    <filter source="get-property('To')" regex=".*/xyz.*">
> >>         <property name="ContentType" value="application/vnd.xyz.xml"
> >>                   scope="axis2"/>
> >>        <send>
> >>            <endpoint>
> >>                <address uri="http://10.4.3.110:1563/xyz" format="pox"/>
> >>            </endpoint>
> >>        </send>
> >>        <drop/>
> >>    </filter>
> >>    <send/>
> >> </definitions>
> >>
> >> Let me know what you think or anyone else and if I  should report this
> as
> >> a
> >> bug.
> >>
> >> Thanks
> >> Sylvain
> >>
> >> On Fri, May 9, 2008 at 9:30 PM, Ruwan Linton <ru...@gmail.com>
> >> wrote:
> >>
> >> > Hi Sylvain,
> >> >
> >> > I am afraid, the property name contentType has to be modified as
> >> > ContentType. [first letter capitalized] messageType remains as it is.
> >> >
> >> > Thanks,
> >> > Ruwan
> >> >
> >> > On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ruwan.linton@gmail.com
> >
> >> > wrote:
> >> >
> >> > > Hi Sylvain,
> >> > >
> >> > > Please see my comments in-line;
> >> > >
> >> > > On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <
> syl20lego@gmail.com
> >> >
> >> > > wrote:
> >> > >
> >> > >> Hi,
> >> > >>
> >> > >> I'm trying to do a simple XML proxy were the contenttype is not
> >> > >> application/xml but rather application/vnd.xyz.xml where is xyz may
> >> be
> >> > few
> >> > >> different values but in this case let's assume it is xyz.
> >> > >>
> >> > >> First I found that I needed to modify my axis2.xml (is there
> another
> >> > >> way?),
> >> > >> otherwise I get that the incoming HTTP post is not SOAP and there
> is
> >> no
> >> > >> Envelope
> >> > >
> >> > >
> >> > > No there is no other way to tell Synapse that this message has to be
> >> > built
> >> > > using this message builder. So you have to have that mapping.
> >> > >
> >> > >
> >> > >>    <messageFormatters>
> >> > >> :::
> >> > >>        <messageFormatter contentType="application/vnd.xyzxml"
> >> > >> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
> >> > >>    </messageFormatters>
> >> > >>    <messageBuilders>
> >> > >> :::
> >> > >>        <messageBuilder contentType="application/vnd.xyz.xml"
> >> > >> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> >> > >>    </messageBuilders>
> >> > >>
> >> > >> I'm also using the following definition
> >> > >>
> >> > >> <definitions xmlns="http://ws.apache.org/ns/synapse">
> >> > >>    <!-- filtering of messages with XPath and regex matches -->
> >> > >>    <filter source="get-property('To')" regex=".*/xyz.*">
> >> > >
> >> > >            <property name="messageType"
> value="application/vnd.xyzxml"
> >> > > scope="axis2"/>
> >> > >            <property name="contentType"
> value="application/vnd.xyzxml"
> >> > > scope="axis2"/>
> >> > >
> >> > >>
> >> > >>        <send>
> >> > >>            <endpoint>
> >> > >>                <address uri="*http://10.4.3.110:1563/xyz*"
> >> > format="pox"/>
> >> > >>            </endpoint>
> >> > >>        </send>
> >> > >>        <drop/>
> >> > >>    </filter>
> >> > >>    <send/>
> >> > >> </definitions>
> >> > >>
> >> > >> My problem is that the message goes thru but ended up on the other
> >> side
> >> > >> with
> >> > >> application/xml.
> >> > >>
> >> > >> I have also try to create my own java mediator with another
> >> definition
> >> > but
> >> > >> still fails to change the content type and before I go too far I
> >> would
> >> > >> like
> >> > >> to know if anyone had tried it before and how?
> >> > >
> >> > >
> >> > > I have modified the above configuration, and you can try that
> >> > > configuration. I think it will work.
> >> > >
> >> > > Thanks,
> >> > > Ruwan
> >> > >
> >> > > --
> >> > > Ruwan Linton
> >> > > http://www.wso2.org - "Oxygenating the Web Services Platform"
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Ruwan Linton
> >> > http://www.wso2.org - "Oxygenating the Web Services Platform"
> >> >
> >>
> >
> >
> >
> > --
> > Ruwan Linton
> > http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
>
>
>
> --
>  Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>

Re: POX proxy with custom Content-Type

Posted by Ruwan Linton <ru...@gmail.com>.
Sylvain,

I think now it is fixed on the 1.2 branch. 2 # days back Rod has reported
the issue with message context properties and I have resolved that [1]

So if you can get a build out of the 1.2 branch this should be working.

[1] - https://issues.apache.org/jira/browse/SYNAPSE-295

Thanks,
Ruwan

On Sat, May 10, 2008 at 5:41 PM, Ruwan Linton <ru...@gmail.com>
wrote:

> Hi Sylvain,
>
> I hope not just this property, but all the axis2 message context properties
> has to be copied by the clonePartially method.
>
> Could you please report this through the JIRA. I will fix it ASAP and we
> will be doing a QA build 2 on Monday so that you can test that build for the
> verification.
>
> Thanks for pointing this.
>
> Thanks,
> Rwuan
>
>
> On Sat, May 10, 2008 at 4:49 PM, Sylvain Legault <sy...@gmail.com>
> wrote:
>
>> Hi Ruwan,
>>
>> thansk for the quick reply, I think you are right but sadly I also think
>> there is a but the prevent it to be copied correclty. I did what you said
>> witht he ContentType and I also did a java mediator and both give the same
>> result. I trace the program step by step in debuger mode and found the
>> following (I'm using the trunck from early this week):
>>
>> When Axis2FlexibleMEPClient.java axisOutMsgCtx see:
>>        MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
>> The result is that the axisOutMsgCtx does not contains the properties
>> anymore :( since only properties explicitely state are copied over. This
>> could be done in two places:
>>
>> private static MessageContext cloneForSend(MessageContext ori) throws
>> AxisFault {
>>        MessageContext newMC = MessageHelper.clonePartially(ori);
>>        newMC.setEnvelope(ori.getEnvelope());
>>        removeAddressingHeaders(newMC);
>>
>>
>> newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
>>
>>
>> ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
>>
>>  // FIX for content type
>>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>>        return newMC;
>>    }
>>
>> Or in MessageHelper.java
>>
>>        org.apache.axis2.context.MessageContext ori) throws AxisFault {
>>        org.apache.axis2.context.MessageContext newMC
>>            = new org.apache.axis2.context.MessageContext();
>>
>>        // do not copy options from the original
>>        newMC.setConfigurationContext(ori.getConfigurationContext());
>>        newMC.setMessageID(UUIDGenerator.getUUID());
>>        newMC.setTo(ori.getTo());
>>        newMC.setSoapAction(ori.getSoapAction());
>>
>>
>> newMC.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
>>
>>
>> ori.getProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING));
>>
>> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
>>
>> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM));
>>
>> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA,
>>
>> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA));
>>        newMC.setProperty(Constants.Configuration.HTTP_METHOD,
>>            ori.getProperty(Constants.Configuration.HTTP_METHOD));
>>        //coping the Message type from req to res to get the message
>> formatters working correctly.
>>        newMC.setProperty(Constants.Configuration.MESSAGE_TYPE,
>>                ori.getProperty(Constants.Configuration.MESSAGE_TYPE));
>>
>> // FIX for content type
>>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>>
>> Both fix work just fine with the following defintion:
>>
>>
>> <definitions xmlns="http://ws.apache.org/ns/synapse">
>>    <!-- filtering of messages with XPath and regex matches -->
>>    <filter source="get-property('To')" regex=".*/xyz.*">
>>         <property name="ContentType" value="application/vnd.xyz.xml"
>>                   scope="axis2"/>
>>        <send>
>>            <endpoint>
>>                <address uri="http://10.4.3.110:1563/xyz" format="pox"/>
>>            </endpoint>
>>        </send>
>>        <drop/>
>>    </filter>
>>    <send/>
>> </definitions>
>>
>> Let me know what you think or anyone else and if I  should report this as
>> a
>> bug.
>>
>> Thanks
>> Sylvain
>>
>> On Fri, May 9, 2008 at 9:30 PM, Ruwan Linton <ru...@gmail.com>
>> wrote:
>>
>> > Hi Sylvain,
>> >
>> > I am afraid, the property name contentType has to be modified as
>> > ContentType. [first letter capitalized] messageType remains as it is.
>> >
>> > Thanks,
>> > Ruwan
>> >
>> > On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
>> > wrote:
>> >
>> > > Hi Sylvain,
>> > >
>> > > Please see my comments in-line;
>> > >
>> > > On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <syl20lego@gmail.com
>> >
>> > > wrote:
>> > >
>> > >> Hi,
>> > >>
>> > >> I'm trying to do a simple XML proxy were the contenttype is not
>> > >> application/xml but rather application/vnd.xyz.xml where is xyz may
>> be
>> > few
>> > >> different values but in this case let's assume it is xyz.
>> > >>
>> > >> First I found that I needed to modify my axis2.xml (is there another
>> > >> way?),
>> > >> otherwise I get that the incoming HTTP post is not SOAP and there is
>> no
>> > >> Envelope
>> > >
>> > >
>> > > No there is no other way to tell Synapse that this message has to be
>> > built
>> > > using this message builder. So you have to have that mapping.
>> > >
>> > >
>> > >>    <messageFormatters>
>> > >> :::
>> > >>        <messageFormatter contentType="application/vnd.xyzxml"
>> > >> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
>> > >>    </messageFormatters>
>> > >>    <messageBuilders>
>> > >> :::
>> > >>        <messageBuilder contentType="application/vnd.xyz.xml"
>> > >> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>> > >>    </messageBuilders>
>> > >>
>> > >> I'm also using the following definition
>> > >>
>> > >> <definitions xmlns="http://ws.apache.org/ns/synapse">
>> > >>    <!-- filtering of messages with XPath and regex matches -->
>> > >>    <filter source="get-property('To')" regex=".*/xyz.*">
>> > >
>> > >            <property name="messageType" value="application/vnd.xyzxml"
>> > > scope="axis2"/>
>> > >            <property name="contentType" value="application/vnd.xyzxml"
>> > > scope="axis2"/>
>> > >
>> > >>
>> > >>        <send>
>> > >>            <endpoint>
>> > >>                <address uri="*http://10.4.3.110:1563/xyz*"
>> > format="pox"/>
>> > >>            </endpoint>
>> > >>        </send>
>> > >>        <drop/>
>> > >>    </filter>
>> > >>    <send/>
>> > >> </definitions>
>> > >>
>> > >> My problem is that the message goes thru but ended up on the other
>> side
>> > >> with
>> > >> application/xml.
>> > >>
>> > >> I have also try to create my own java mediator with another
>> definition
>> > but
>> > >> still fails to change the content type and before I go too far I
>> would
>> > >> like
>> > >> to know if anyone had tried it before and how?
>> > >
>> > >
>> > > I have modified the above configuration, and you can try that
>> > > configuration. I think it will work.
>> > >
>> > > Thanks,
>> > > Ruwan
>> > >
>> > > --
>> > > Ruwan Linton
>> > > http://www.wso2.org - "Oxygenating the Web Services Platform"
>> >
>> >
>> >
>> >
>> > --
>> > Ruwan Linton
>> > http://www.wso2.org - "Oxygenating the Web Services Platform"
>> >
>>
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: POX proxy with custom Content-Type

Posted by Ruwan Linton <ru...@gmail.com>.
Asankha,

I think you are missing part of this thread :-(

Thanks,
Ruwan

On Sat, May 10, 2008 at 8:20 PM, Asankha C. Perera <as...@wso2.com> wrote:

> Sylvain / Ruwan
>
> If you want a property set (e.g. ContentType and messageType) at the Axis2
> message context level (and not synapse level) you must set the scope
> attribute to "axis2 <
> http://synapse.apache.org/Synapse_Configuration_Language.html#property>"..
> I think the problem is there?
>
> asankha
>
>
> Ruwan Linton wrote:
>
>> Hi Sylvain,
>>
>> I hope not just this property, but all the axis2 message context
>> properties
>> has to be copied by the clonePartially method.
>>
>> Could you please report this through the JIRA. I will fix it ASAP and we
>> will be doing a QA build 2 on Monday so that you can test that build for
>> the
>> verification.
>>
>> Thanks for pointing this.
>>
>> Thanks,
>> Rwuan
>>
>> On Sat, May 10, 2008 at 4:49 PM, Sylvain Legault <sy...@gmail.com>
>> wrote:
>>
>>
>>
>>> Hi Ruwan,
>>>
>>> thansk for the quick reply, I think you are right but sadly I also think
>>> there is a but the prevent it to be copied correclty. I did what you said
>>> witht he ContentType and I also did a java mediator and both give the
>>> same
>>> result. I trace the program step by step in debuger mode and found the
>>> following (I'm using the trunck from early this week):
>>>
>>> When Axis2FlexibleMEPClient.java axisOutMsgCtx see:
>>>       MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
>>> The result is that the axisOutMsgCtx does not contains the properties
>>> anymore :( since only properties explicitely state are copied over. This
>>> could be done in two places:
>>>
>>> private static MessageContext cloneForSend(MessageContext ori) throws
>>> AxisFault {
>>>       MessageContext newMC = MessageHelper.clonePartially(ori);
>>>       newMC.setEnvelope(ori.getEnvelope());
>>>       removeAddressingHeaders(newMC);
>>>
>>>
>>>
>>> newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
>>>
>>>
>>>
>>> ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
>>>
>>>  // FIX for content type
>>>       newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>>>           ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>>>       return newMC;
>>>   }
>>>
>>> Or in MessageHelper.java
>>>
>>>       org.apache.axis2.context.MessageContext ori) throws AxisFault {
>>>       org.apache.axis2.context.MessageContext newMC
>>>           = new org.apache.axis2.context.MessageContext();
>>>
>>>       // do not copy options from the original
>>>       newMC.setConfigurationContext(ori.getConfigurationContext());
>>>       newMC.setMessageID(UUIDGenerator.getUUID());
>>>       newMC.setTo(ori.getTo());
>>>       newMC.setSoapAction(ori.getSoapAction());
>>>
>>>
>>>
>>> newMC.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
>>>
>>>
>>>
>>> ori.getProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING));
>>>
>>> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
>>>
>>> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM));
>>>
>>> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA,
>>>
>>> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA));
>>>       newMC.setProperty(Constants.Configuration.HTTP_METHOD,
>>>           ori.getProperty(Constants.Configuration.HTTP_METHOD));
>>>       //coping the Message type from req to res to get the message
>>> formatters working correctly.
>>>       newMC.setProperty(Constants.Configuration.MESSAGE_TYPE,
>>>               ori.getProperty(Constants.Configuration.MESSAGE_TYPE));
>>>
>>> // FIX for content type
>>>       newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>>>           ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>>>
>>> Both fix work just fine with the following defintion:
>>>
>>>
>>> <definitions xmlns="http://ws.apache.org/ns/synapse">
>>>   <!-- filtering of messages with XPath and regex matches -->
>>>   <filter source="get-property('To')" regex=".*/xyz.*">
>>>        <property name="ContentType" value="application/vnd.xyz.xml"
>>>                  scope="axis2"/>
>>>       <send>
>>>           <endpoint>
>>>               <address uri="http://10.4.3.110:1563/xyz" format="pox"/>
>>>           </endpoint>
>>>       </send>
>>>       <drop/>
>>>   </filter>
>>>   <send/>
>>> </definitions>
>>>
>>> Let me know what you think or anyone else and if I  should report this as
>>> a
>>> bug.
>>>
>>> Thanks
>>> Sylvain
>>>
>>> On Fri, May 9, 2008 at 9:30 PM, Ruwan Linton <ru...@gmail.com>
>>> wrote:
>>>
>>>
>>>
>>>> Hi Sylvain,
>>>>
>>>> I am afraid, the property name contentType has to be modified as
>>>> ContentType. [first letter capitalized] messageType remains as it is.
>>>>
>>>> Thanks,
>>>> Ruwan
>>>>
>>>> On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
>>>> wrote:
>>>>
>>>>
>>>>
>>>>> Hi Sylvain,
>>>>>
>>>>> Please see my comments in-line;
>>>>>
>>>>> On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to do a simple XML proxy were the contenttype is not
>>>>>> application/xml but rather application/vnd.xyz.xml where is xyz may be
>>>>>>
>>>>>>
>>>>> few
>>>>
>>>>
>>>>> different values but in this case let's assume it is xyz.
>>>>>>
>>>>>> First I found that I needed to modify my axis2.xml (is there another
>>>>>> way?),
>>>>>> otherwise I get that the incoming HTTP post is not SOAP and there is
>>>>>>
>>>>>>
>>>>> no
>>>
>>>
>>>> Envelope
>>>>>>
>>>>>>
>>>>> No there is no other way to tell Synapse that this message has to be
>>>>>
>>>>>
>>>> built
>>>>
>>>>
>>>>> using this message builder. So you have to have that mapping.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>   <messageFormatters>
>>>>>> :::
>>>>>>       <messageFormatter contentType="application/vnd.xyzxml"
>>>>>> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
>>>>>>   </messageFormatters>
>>>>>>   <messageBuilders>
>>>>>> :::
>>>>>>       <messageBuilder contentType="application/vnd.xyz.xml"
>>>>>> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>>>>>>   </messageBuilders>
>>>>>>
>>>>>> I'm also using the following definition
>>>>>>
>>>>>> <definitions xmlns="http://ws.apache.org/ns/synapse">
>>>>>>   <!-- filtering of messages with XPath and regex matches -->
>>>>>>   <filter source="get-property('To')" regex=".*/xyz.*">
>>>>>>
>>>>>>
>>>>>           <property name="messageType" value="application/vnd.xyzxml"
>>>>> scope="axis2"/>
>>>>>           <property name="contentType" value="application/vnd.xyzxml"
>>>>> scope="axis2"/>
>>>>>
>>>>>
>>>>>
>>>>>>       <send>
>>>>>>           <endpoint>
>>>>>>               <address uri="*http://10.4.3.110:1563/xyz*"
>>>>>>
>>>>>>
>>>>> format="pox"/>
>>>>
>>>>
>>>>>           </endpoint>
>>>>>>       </send>
>>>>>>       <drop/>
>>>>>>   </filter>
>>>>>>   <send/>
>>>>>> </definitions>
>>>>>>
>>>>>> My problem is that the message goes thru but ended up on the other
>>>>>>
>>>>>>
>>>>> side
>>>
>>>
>>>> with
>>>>>> application/xml.
>>>>>>
>>>>>> I have also try to create my own java mediator with another definition
>>>>>>
>>>>>>
>>>>> but
>>>>
>>>>
>>>>> still fails to change the content type and before I go too far I would
>>>>>> like
>>>>>> to know if anyone had tried it before and how?
>>>>>>
>>>>>>
>>>>> I have modified the above configuration, and you can try that
>>>>> configuration. I think it will work.
>>>>>
>>>>> Thanks,
>>>>> Ruwan
>>>>>
>>>>> --
>>>>> Ruwan Linton
>>>>> http://www.wso2.org - "Oxygenating the Web Services Platform"
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Ruwan Linton
>>>> http://www.wso2.org - "Oxygenating the Web Services Platform"
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>>
>


-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: POX proxy with custom Content-Type

Posted by "Asankha C. Perera" <as...@wso2.com>.
Sylvain / Ruwan

If you want a property set (e.g. ContentType and messageType) at the 
Axis2 message context level (and not synapse level) you must set the 
scope attribute to "axis2 
<http://synapse.apache.org/Synapse_Configuration_Language.html#property>".. 
I think the problem is there?

asankha

Ruwan Linton wrote:
> Hi Sylvain,
>
> I hope not just this property, but all the axis2 message context properties
> has to be copied by the clonePartially method.
>
> Could you please report this through the JIRA. I will fix it ASAP and we
> will be doing a QA build 2 on Monday so that you can test that build for the
> verification.
>
> Thanks for pointing this.
>
> Thanks,
> Rwuan
>
> On Sat, May 10, 2008 at 4:49 PM, Sylvain Legault <sy...@gmail.com>
> wrote:
>
>   
>> Hi Ruwan,
>>
>> thansk for the quick reply, I think you are right but sadly I also think
>> there is a but the prevent it to be copied correclty. I did what you said
>> witht he ContentType and I also did a java mediator and both give the same
>> result. I trace the program step by step in debuger mode and found the
>> following (I'm using the trunck from early this week):
>>
>> When Axis2FlexibleMEPClient.java axisOutMsgCtx see:
>>        MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
>> The result is that the axisOutMsgCtx does not contains the properties
>> anymore :( since only properties explicitely state are copied over. This
>> could be done in two places:
>>
>> private static MessageContext cloneForSend(MessageContext ori) throws
>> AxisFault {
>>        MessageContext newMC = MessageHelper.clonePartially(ori);
>>        newMC.setEnvelope(ori.getEnvelope());
>>        removeAddressingHeaders(newMC);
>>
>>
>> newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
>>
>>
>> ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
>>
>>  // FIX for content type
>>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>>        return newMC;
>>    }
>>
>> Or in MessageHelper.java
>>
>>        org.apache.axis2.context.MessageContext ori) throws AxisFault {
>>        org.apache.axis2.context.MessageContext newMC
>>            = new org.apache.axis2.context.MessageContext();
>>
>>        // do not copy options from the original
>>        newMC.setConfigurationContext(ori.getConfigurationContext());
>>        newMC.setMessageID(UUIDGenerator.getUUID());
>>        newMC.setTo(ori.getTo());
>>        newMC.setSoapAction(ori.getSoapAction());
>>
>>
>> newMC.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
>>
>>
>> ori.getProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING));
>>
>> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
>>
>> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM));
>>
>> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA,
>>
>> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA));
>>        newMC.setProperty(Constants.Configuration.HTTP_METHOD,
>>            ori.getProperty(Constants.Configuration.HTTP_METHOD));
>>        //coping the Message type from req to res to get the message
>> formatters working correctly.
>>        newMC.setProperty(Constants.Configuration.MESSAGE_TYPE,
>>                ori.getProperty(Constants.Configuration.MESSAGE_TYPE));
>>
>> // FIX for content type
>>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>>
>> Both fix work just fine with the following defintion:
>>
>>
>> <definitions xmlns="http://ws.apache.org/ns/synapse">
>>    <!-- filtering of messages with XPath and regex matches -->
>>    <filter source="get-property('To')" regex=".*/xyz.*">
>>         <property name="ContentType" value="application/vnd.xyz.xml"
>>                   scope="axis2"/>
>>        <send>
>>            <endpoint>
>>                <address uri="http://10.4.3.110:1563/xyz" format="pox"/>
>>            </endpoint>
>>        </send>
>>        <drop/>
>>    </filter>
>>    <send/>
>> </definitions>
>>
>> Let me know what you think or anyone else and if I  should report this as a
>> bug.
>>
>> Thanks
>> Sylvain
>>
>> On Fri, May 9, 2008 at 9:30 PM, Ruwan Linton <ru...@gmail.com>
>> wrote:
>>
>>     
>>> Hi Sylvain,
>>>
>>> I am afraid, the property name contentType has to be modified as
>>> ContentType. [first letter capitalized] messageType remains as it is.
>>>
>>> Thanks,
>>> Ruwan
>>>
>>> On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
>>> wrote:
>>>
>>>       
>>>> Hi Sylvain,
>>>>
>>>> Please see my comments in-line;
>>>>
>>>> On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
>>>> wrote:
>>>>
>>>>         
>>>>> Hi,
>>>>>
>>>>> I'm trying to do a simple XML proxy were the contenttype is not
>>>>> application/xml but rather application/vnd.xyz.xml where is xyz may be
>>>>>           
>>> few
>>>       
>>>>> different values but in this case let's assume it is xyz.
>>>>>
>>>>> First I found that I needed to modify my axis2.xml (is there another
>>>>> way?),
>>>>> otherwise I get that the incoming HTTP post is not SOAP and there is
>>>>>           
>> no
>>     
>>>>> Envelope
>>>>>           
>>>> No there is no other way to tell Synapse that this message has to be
>>>>         
>>> built
>>>       
>>>> using this message builder. So you have to have that mapping.
>>>>
>>>>
>>>>         
>>>>>    <messageFormatters>
>>>>> :::
>>>>>        <messageFormatter contentType="application/vnd.xyzxml"
>>>>> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
>>>>>    </messageFormatters>
>>>>>    <messageBuilders>
>>>>> :::
>>>>>        <messageBuilder contentType="application/vnd.xyz.xml"
>>>>> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>>>>>    </messageBuilders>
>>>>>
>>>>> I'm also using the following definition
>>>>>
>>>>> <definitions xmlns="http://ws.apache.org/ns/synapse">
>>>>>    <!-- filtering of messages with XPath and regex matches -->
>>>>>    <filter source="get-property('To')" regex=".*/xyz.*">
>>>>>           
>>>>            <property name="messageType" value="application/vnd.xyzxml"
>>>> scope="axis2"/>
>>>>            <property name="contentType" value="application/vnd.xyzxml"
>>>> scope="axis2"/>
>>>>
>>>>         
>>>>>        <send>
>>>>>            <endpoint>
>>>>>                <address uri="*http://10.4.3.110:1563/xyz*"
>>>>>           
>>> format="pox"/>
>>>       
>>>>>            </endpoint>
>>>>>        </send>
>>>>>        <drop/>
>>>>>    </filter>
>>>>>    <send/>
>>>>> </definitions>
>>>>>
>>>>> My problem is that the message goes thru but ended up on the other
>>>>>           
>> side
>>     
>>>>> with
>>>>> application/xml.
>>>>>
>>>>> I have also try to create my own java mediator with another definition
>>>>>           
>>> but
>>>       
>>>>> still fails to change the content type and before I go too far I would
>>>>> like
>>>>> to know if anyone had tried it before and how?
>>>>>           
>>>> I have modified the above configuration, and you can try that
>>>> configuration. I think it will work.
>>>>
>>>> Thanks,
>>>> Ruwan
>>>>
>>>> --
>>>> Ruwan Linton
>>>> http://www.wso2.org - "Oxygenating the Web Services Platform"
>>>>         
>>>
>>>
>>> --
>>> Ruwan Linton
>>> http://www.wso2.org - "Oxygenating the Web Services Platform"
>>>
>>>       
>
>
>
>   

Re: POX proxy with custom Content-Type

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Sylvain,

I hope not just this property, but all the axis2 message context properties
has to be copied by the clonePartially method.

Could you please report this through the JIRA. I will fix it ASAP and we
will be doing a QA build 2 on Monday so that you can test that build for the
verification.

Thanks for pointing this.

Thanks,
Rwuan

On Sat, May 10, 2008 at 4:49 PM, Sylvain Legault <sy...@gmail.com>
wrote:

> Hi Ruwan,
>
> thansk for the quick reply, I think you are right but sadly I also think
> there is a but the prevent it to be copied correclty. I did what you said
> witht he ContentType and I also did a java mediator and both give the same
> result. I trace the program step by step in debuger mode and found the
> following (I'm using the trunck from early this week):
>
> When Axis2FlexibleMEPClient.java axisOutMsgCtx see:
>        MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
> The result is that the axisOutMsgCtx does not contains the properties
> anymore :( since only properties explicitely state are copied over. This
> could be done in two places:
>
> private static MessageContext cloneForSend(MessageContext ori) throws
> AxisFault {
>        MessageContext newMC = MessageHelper.clonePartially(ori);
>        newMC.setEnvelope(ori.getEnvelope());
>        removeAddressingHeaders(newMC);
>
>
> newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
>
>
> ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
>
>  // FIX for content type
>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>        return newMC;
>    }
>
> Or in MessageHelper.java
>
>        org.apache.axis2.context.MessageContext ori) throws AxisFault {
>        org.apache.axis2.context.MessageContext newMC
>            = new org.apache.axis2.context.MessageContext();
>
>        // do not copy options from the original
>        newMC.setConfigurationContext(ori.getConfigurationContext());
>        newMC.setMessageID(UUIDGenerator.getUUID());
>        newMC.setTo(ori.getTo());
>        newMC.setSoapAction(ori.getSoapAction());
>
>
> newMC.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
>
>
> ori.getProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING));
>
> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
>
> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM));
>
> newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA,
>
> ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA));
>        newMC.setProperty(Constants.Configuration.HTTP_METHOD,
>            ori.getProperty(Constants.Configuration.HTTP_METHOD));
>        //coping the Message type from req to res to get the message
> formatters working correctly.
>        newMC.setProperty(Constants.Configuration.MESSAGE_TYPE,
>                ori.getProperty(Constants.Configuration.MESSAGE_TYPE));
>
> // FIX for content type
>        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
>            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
>
> Both fix work just fine with the following defintion:
>
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>    <!-- filtering of messages with XPath and regex matches -->
>    <filter source="get-property('To')" regex=".*/xyz.*">
>         <property name="ContentType" value="application/vnd.xyz.xml"
>                   scope="axis2"/>
>        <send>
>            <endpoint>
>                <address uri="http://10.4.3.110:1563/xyz" format="pox"/>
>            </endpoint>
>        </send>
>        <drop/>
>    </filter>
>    <send/>
> </definitions>
>
> Let me know what you think or anyone else and if I  should report this as a
> bug.
>
> Thanks
> Sylvain
>
> On Fri, May 9, 2008 at 9:30 PM, Ruwan Linton <ru...@gmail.com>
> wrote:
>
> > Hi Sylvain,
> >
> > I am afraid, the property name contentType has to be modified as
> > ContentType. [first letter capitalized] messageType remains as it is.
> >
> > Thanks,
> > Ruwan
> >
> > On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
> > wrote:
> >
> > > Hi Sylvain,
> > >
> > > Please see my comments in-line;
> > >
> > > On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
> > > wrote:
> > >
> > >> Hi,
> > >>
> > >> I'm trying to do a simple XML proxy were the contenttype is not
> > >> application/xml but rather application/vnd.xyz.xml where is xyz may be
> > few
> > >> different values but in this case let's assume it is xyz.
> > >>
> > >> First I found that I needed to modify my axis2.xml (is there another
> > >> way?),
> > >> otherwise I get that the incoming HTTP post is not SOAP and there is
> no
> > >> Envelope
> > >
> > >
> > > No there is no other way to tell Synapse that this message has to be
> > built
> > > using this message builder. So you have to have that mapping.
> > >
> > >
> > >>    <messageFormatters>
> > >> :::
> > >>        <messageFormatter contentType="application/vnd.xyzxml"
> > >> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
> > >>    </messageFormatters>
> > >>    <messageBuilders>
> > >> :::
> > >>        <messageBuilder contentType="application/vnd.xyz.xml"
> > >> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> > >>    </messageBuilders>
> > >>
> > >> I'm also using the following definition
> > >>
> > >> <definitions xmlns="http://ws.apache.org/ns/synapse">
> > >>    <!-- filtering of messages with XPath and regex matches -->
> > >>    <filter source="get-property('To')" regex=".*/xyz.*">
> > >
> > >            <property name="messageType" value="application/vnd.xyzxml"
> > > scope="axis2"/>
> > >            <property name="contentType" value="application/vnd.xyzxml"
> > > scope="axis2"/>
> > >
> > >>
> > >>        <send>
> > >>            <endpoint>
> > >>                <address uri="*http://10.4.3.110:1563/xyz*"
> > format="pox"/>
> > >>            </endpoint>
> > >>        </send>
> > >>        <drop/>
> > >>    </filter>
> > >>    <send/>
> > >> </definitions>
> > >>
> > >> My problem is that the message goes thru but ended up on the other
> side
> > >> with
> > >> application/xml.
> > >>
> > >> I have also try to create my own java mediator with another definition
> > but
> > >> still fails to change the content type and before I go too far I would
> > >> like
> > >> to know if anyone had tried it before and how?
> > >
> > >
> > > I have modified the above configuration, and you can try that
> > > configuration. I think it will work.
> > >
> > > Thanks,
> > > Ruwan
> > >
> > > --
> > > Ruwan Linton
> > > http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
> >
> >
> >
> > --
> > Ruwan Linton
> > http://www.wso2.org - "Oxygenating the Web Services Platform"
> >
>



-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: POX proxy with custom Content-Type

Posted by Sylvain Legault <sy...@gmail.com>.
Hi Ruwan,

thansk for the quick reply, I think you are right but sadly I also think
there is a but the prevent it to be copied correclty. I did what you said
witht he ContentType and I also did a java mediator and both give the same
result. I trace the program step by step in debuger mode and found the
following (I'm using the trunck from early this week):

When Axis2FlexibleMEPClient.java axisOutMsgCtx see:
        MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
The result is that the axisOutMsgCtx does not contains the properties
anymore :( since only properties explicitely state are copied over. This
could be done in two places:

private static MessageContext cloneForSend(MessageContext ori) throws
AxisFault {
        MessageContext newMC = MessageHelper.clonePartially(ori);
        newMC.setEnvelope(ori.getEnvelope());
        removeAddressingHeaders(newMC);

newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,

ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));

 // FIX for content type
        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
            ori.getProperty(Constants.Configuration.CONTENT_TYPE));
        return newMC;
    }

Or in MessageHelper.java

        org.apache.axis2.context.MessageContext ori) throws AxisFault {
        org.apache.axis2.context.MessageContext newMC
            = new org.apache.axis2.context.MessageContext();

        // do not copy options from the original
        newMC.setConfigurationContext(ori.getConfigurationContext());
        newMC.setMessageID(UUIDGenerator.getUUID());
        newMC.setTo(ori.getTo());
        newMC.setSoapAction(ori.getSoapAction());

newMC.setProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,

ori.getProperty(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING));

newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,

ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM));

newMC.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA,

ori.getProperty(org.apache.axis2.Constants.Configuration.ENABLE_SWA));
        newMC.setProperty(Constants.Configuration.HTTP_METHOD,
            ori.getProperty(Constants.Configuration.HTTP_METHOD));
        //coping the Message type from req to res to get the message
formatters working correctly.
        newMC.setProperty(Constants.Configuration.MESSAGE_TYPE,
                ori.getProperty(Constants.Configuration.MESSAGE_TYPE));

// FIX for content type
        newMC.setProperty(Constants.Configuration.CONTENT_TYPE,
            ori.getProperty(Constants.Configuration.CONTENT_TYPE));

Both fix work just fine with the following defintion:


<definitions xmlns="http://ws.apache.org/ns/synapse">
    <!-- filtering of messages with XPath and regex matches -->
    <filter source="get-property('To')" regex=".*/xyz.*">
        <property name="ContentType" value="application/vnd.xyz.xml"
                  scope="axis2"/>
        <send>
            <endpoint>
                <address uri="http://10.4.3.110:1563/xyz" format="pox"/>
            </endpoint>
        </send>
        <drop/>
    </filter>
    <send/>
</definitions>

Let me know what you think or anyone else and if I  should report this as a
bug.

Thanks
Sylvain

On Fri, May 9, 2008 at 9:30 PM, Ruwan Linton <ru...@gmail.com> wrote:

> Hi Sylvain,
>
> I am afraid, the property name contentType has to be modified as
> ContentType. [first letter capitalized] messageType remains as it is.
>
> Thanks,
> Ruwan
>
> On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
> wrote:
>
> > Hi Sylvain,
> >
> > Please see my comments in-line;
> >
> > On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
> > wrote:
> >
> >> Hi,
> >>
> >> I'm trying to do a simple XML proxy were the contenttype is not
> >> application/xml but rather application/vnd.xyz.xml where is xyz may be
> few
> >> different values but in this case let's assume it is xyz.
> >>
> >> First I found that I needed to modify my axis2.xml (is there another
> >> way?),
> >> otherwise I get that the incoming HTTP post is not SOAP and there is no
> >> Envelope
> >
> >
> > No there is no other way to tell Synapse that this message has to be
> built
> > using this message builder. So you have to have that mapping.
> >
> >
> >>    <messageFormatters>
> >> :::
> >>        <messageFormatter contentType="application/vnd.xyzxml"
> >> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
> >>    </messageFormatters>
> >>    <messageBuilders>
> >> :::
> >>        <messageBuilder contentType="application/vnd.xyz.xml"
> >> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> >>    </messageBuilders>
> >>
> >> I'm also using the following definition
> >>
> >> <definitions xmlns="http://ws.apache.org/ns/synapse">
> >>    <!-- filtering of messages with XPath and regex matches -->
> >>    <filter source="get-property('To')" regex=".*/xyz.*">
> >
> >            <property name="messageType" value="application/vnd.xyzxml"
> > scope="axis2"/>
> >            <property name="contentType" value="application/vnd.xyzxml"
> > scope="axis2"/>
> >
> >>
> >>        <send>
> >>            <endpoint>
> >>                <address uri="*http://10.4.3.110:1563/xyz*"
> format="pox"/>
> >>            </endpoint>
> >>        </send>
> >>        <drop/>
> >>    </filter>
> >>    <send/>
> >> </definitions>
> >>
> >> My problem is that the message goes thru but ended up on the other side
> >> with
> >> application/xml.
> >>
> >> I have also try to create my own java mediator with another definition
> but
> >> still fails to change the content type and before I go too far I would
> >> like
> >> to know if anyone had tried it before and how?
> >
> >
> > I have modified the above configuration, and you can try that
> > configuration. I think it will work.
> >
> > Thanks,
> > Ruwan
> >
> > --
> > Ruwan Linton
> > http://www.wso2.org - "Oxygenating the Web Services Platform"
>
>
>
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"
>

Re: POX proxy with custom Content-Type

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Sylvain,

I am afraid, the property name contentType has to be modified as
ContentType. [first letter capitalized] messageType remains as it is.

Thanks,
Ruwan

On Sat, May 10, 2008 at 6:51 AM, Ruwan Linton <ru...@gmail.com>
wrote:

> Hi Sylvain,
>
> Please see my comments in-line;
>
> On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm trying to do a simple XML proxy were the contenttype is not
>> application/xml but rather application/vnd.xyz.xml where is xyz may be few
>> different values but in this case let's assume it is xyz.
>>
>> First I found that I needed to modify my axis2.xml (is there another
>> way?),
>> otherwise I get that the incoming HTTP post is not SOAP and there is no
>> Envelope
>
>
> No there is no other way to tell Synapse that this message has to be built
> using this message builder. So you have to have that mapping.
>
>
>>    <messageFormatters>
>> :::
>>        <messageFormatter contentType="application/vnd.xyzxml"
>> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
>>    </messageFormatters>
>>    <messageBuilders>
>> :::
>>        <messageBuilder contentType="application/vnd.xyz.xml"
>> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>>    </messageBuilders>
>>
>> I'm also using the following definition
>>
>> <definitions xmlns="http://ws.apache.org/ns/synapse">
>>    <!-- filtering of messages with XPath and regex matches -->
>>    <filter source="get-property('To')" regex=".*/xyz.*">
>
>            <property name="messageType" value="application/vnd.xyzxml"
> scope="axis2"/>
>            <property name="contentType" value="application/vnd.xyzxml"
> scope="axis2"/>
>
>>
>>        <send>
>>            <endpoint>
>>                <address uri="*http://10.4.3.110:1563/xyz*" format="pox"/>
>>            </endpoint>
>>        </send>
>>        <drop/>
>>    </filter>
>>    <send/>
>> </definitions>
>>
>> My problem is that the message goes thru but ended up on the other side
>> with
>> application/xml.
>>
>> I have also try to create my own java mediator with another definition but
>> still fails to change the content type and before I go too far I would
>> like
>> to know if anyone had tried it before and how?
>
>
> I have modified the above configuration, and you can try that
> configuration. I think it will work.
>
> Thanks,
> Ruwan
>
> --
> Ruwan Linton
> http://www.wso2.org - "Oxygenating the Web Services Platform"




-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Re: POX proxy with custom Content-Type

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Sylvain,

Please see my comments in-line;

On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <sy...@gmail.com>
wrote:

> Hi,
>
> I'm trying to do a simple XML proxy were the contenttype is not
> application/xml but rather application/vnd.xyz.xml where is xyz may be few
> different values but in this case let's assume it is xyz.
>
> First I found that I needed to modify my axis2.xml (is there another way?),
> otherwise I get that the incoming HTTP post is not SOAP and there is no
> Envelope


No there is no other way to tell Synapse that this message has to be built
using this message builder. So you have to have that mapping.


>    <messageFormatters>
> :::
>        <messageFormatter contentType="application/vnd.xyzxml"
> class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
>    </messageFormatters>
>    <messageBuilders>
> :::
>        <messageBuilder contentType="application/vnd.xyz.xml"
> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>    </messageBuilders>
>
> I'm also using the following definition
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
>    <!-- filtering of messages with XPath and regex matches -->
>    <filter source="get-property('To')" regex=".*/xyz.*">

           <property name="messageType" value="application/vnd.xyzxml"
scope="axis2"/>
           <property name="contentType" value="application/vnd.xyzxml"
scope="axis2"/>

>
>        <send>
>            <endpoint>
>                <address uri="*http://10.4.3.110:1563/xyz*" format="pox"/>
>            </endpoint>
>        </send>
>        <drop/>
>    </filter>
>    <send/>
> </definitions>
>
> My problem is that the message goes thru but ended up on the other side
> with
> application/xml.
>
> I have also try to create my own java mediator with another definition but
> still fails to change the content type and before I go too far I would like
> to know if anyone had tried it before and how?


I have modified the above configuration, and you can try that configuration.
I think it will work.

Thanks,
Ruwan

-- 
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"