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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> > 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 <[EMAIL PROTECTED]> >> 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 <[EMAIL PROTECTED]> >> > wrote: >> > >> > > Hi Sylvain, >> > > >> > > Please see my comments in-line; >> > > >> > > On Fri, May 9, 2008 at 11:55 PM, Sylvain Legault <[EMAIL PROTECTED] >> > >> > > 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"
