On Sat, Oct 9, 2010 at 12:37 AM, Hiranya Jayathilaka <[email protected]> wrote: > On Fri, Oct 8, 2010 at 11:58 PM, Abid Khan-EXT <[email protected]> wrote: >> Hiranya, >> >> Thanks for the quick response, but I cannot put the URL either since >> different messages will have different namespace and or URL.
Another option is to use the XSLT mediator and remove namespaces from all incoming messages. Then you can use the switch mediator. (Not a very 'nice' solution of course but it will work) Thanks, Hiranya > > So you get different messages with the same XML format but with > different (unknown) namespaces? That is very unusual. Usually > messaging systems deal with a previously agreed upon standard set of > namespaces. Otherwise it becomes an interop nightmare. > > However if the messages are namespace qualified you need to define the > exact namespaces in the switch mediator. Otherwise it won't work. I'm > not a Xpath pro so I'm not sure whether there's a way to write an > XPath expression in a namespace independent manner. Please see if you > can find something like that. May be somebody else in the list will > have an idea how to do that... > > Thanks, > Hiranya > >> >> Thanks & Regards, >> Abid >> >> >> -----Original Message----- >> From: Hiranya Jayathilaka [mailto:[email protected]] >> Sent: Friday, October 08, 2010 12:25 PM >> To: [email protected] >> Subject: Re: If the message has name space setting the switch mediator does >> not work? >> >> On Fri, Oct 8, 2010 at 9:42 PM, Abid Khan-EXT <[email protected]> wrote: >>> Hello Andreas, >>> >>> I understand that, but what if the message has no-prefix namespace >>> something like: >> >> That's fine. As far as the functionality is concerned, URL is he >> important part in the namespace. Prefix could be anything. The prefix >> used in your XPath doesn't have to match to the prefix in the message. >> In fact message doesn't have to have a prefix at all. >> >> Thanks, >> Hiranya >> >> >>> >>> <Message xmlns="http://www.company.com/test"/> >>> .... >>> ... >>> </Message> >>> >>> This what I have most of the messages that I am processing with Synapse, >>> have not prefix name space or default namespace declaration. Which is the >>> problem I am facing. >>> >>> >>> >>> Thanks & Regards, >>> Abid >>> >>> >>> -----Original Message----- >>> From: Andreas Veithen [mailto:[email protected]] >>> Sent: Friday, October 08, 2010 10:07 AM >>> To: [email protected] >>> Subject: Re: If the message has name space setting the switch mediator does >>> not work? >>> >>> Try with something like this: >>> >>> <switch source="//p:Message/p:header/p:msgType" >>> xmlns:p="http://www.company.com/test"> >>> >>> Note that XPath expressions in Synapse configuration files are >>> supposed to work the same way as XPath expressions in XSLT, so if you >>> have a colleague who is familiar with XSLT, he may help you to figure >>> out the details. >>> >>> Andreas >>> >>> On Fri, Oct 8, 2010 at 17:46, Abid Khan-EXT <[email protected]> wrote: >>>> I am not sure what is the difference in both ways here is how I am >>>> creating the switch: >>>> >>>> <switch source="//Message/header/msgType"> >>>> <case regex="RequesResponse"> >>>> <validate> >>>> <schema key="Message01"/> >>>> <on-fail> >>>> <sequence key="ValidationFaultSequence" /> >>>> </on-fail> >>>> </validate> >>>> </case> >>>> <case regex="Publish"> >>>> <validate> >>>> <schema key=" Message02"/> >>>> <on-fail> >>>> <sequence key="ValidationFaultSequence" /> >>>> </on-fail> >>>> </validate>^M >>>> </case> >>>> </switch> >>>> >>>> This exact switch works if the name space of the document is removed, and >>>> does not work otherwise. >>>> >>>> Please advise. >>>> >>>> Thanks & Regards, >>>> Abid >>>> >>>> -----Original Message----- >>>> From: Supun Kamburugamuva [mailto:[email protected]] >>>> Sent: Thursday, October 07, 2010 8:29 PM >>>> To: [email protected] >>>> Subject: Re: If the message has name space setting the switch mediator >>>> does not work? >>>> >>>> I believe you are using XPath to get a value of a element. You can write a >>>> Xpath in such a way that it works both with namespace qualified elements as >>>> well as normal elements. >>>> >>>> Thanks, >>>> Supun.. >>>> >>>> On Tue, Sep 28, 2010 at 9:12 PM, Abid Khan-EXT >>>> <[email protected]>wrote: >>>> >>>>> Hello all, >>>>> >>>>> I am receiving a message and the switch works if I take the namespace >>>>> string out of the message, but I cannot tell the sender to remove it. Is >>>>> there anything I can do that synapse can handle the name space. >>>>> >>>>> Message that starts with something like this is not handled properly, by >>>>> "switch" mediator. >>>>> >>>>> <Request xmlns="http://www.company.com/test" xmlns:xsi=" >>>>> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" >>>>> http://www.company.com/test ../test/Request.xsd"> >>>>> >>>>> >>>>> Thanks & Regards, >>>>> >>>>> Abid Khan >>>>> Java Consultant >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> Tech Lead, WSO2 Inc >>>> http://wso2.org >>>> supunk.blogspot.com >>>> >>> >> >> >> >> -- >> Hiranya Jayathilaka >> Senior Software Engineer; >> WSO2 Inc.; http://wso2.org >> E-mail: [email protected]; Mobile: +94 77 633 3491 >> Blog: http://techfeast-hiranya.blogspot.com >> > > > > -- > Hiranya Jayathilaka > Senior Software Engineer; > WSO2 Inc.; http://wso2.org > E-mail: [email protected]; Mobile: +94 77 633 3491 > Blog: http://techfeast-hiranya.blogspot.com > -- Hiranya Jayathilaka Senior Software Engineer; WSO2 Inc.; http://wso2.org E-mail: [email protected]; Mobile: +94 77 633 3491 Blog: http://techfeast-hiranya.blogspot.com
