You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Benjamin Schmeling <be...@googlemail.com> on 2010/12/15 12:22:11 UTC

Synapse2: Question about XPath Expressions in SwitchMediator

Hi,

I am using Apache Synapse 2.0-SNAPSHOT and I have a problem with XPATH
expressions.

I have defined the following configuration:

..
<configuration:switch
source="{http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination">
..

which should be a a valid XPATH expression.

Synapse throws the following exception:

ERROR SynapseServer - Error starting Apache Synapse, trying a clean shutdown...
org.apache.synapse.SynapseException: Invalid XPath for attribute
'source' : {http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination
        at org.apache.synapse.config.xml.SwitchMediatorFactory.createSpecificMediator(SwitchMediatorFactory.java:71)
        at org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:88)
        ......

I've also looked at the code and saw that the SwitchMediatorFactory
directly calls new SynapseXPath(xpathAttrib.getAttributeValue()),
whereas in your test cases you are rather using the
SynapseXPath.parseXPathString(XPATHString) method which does some
preprocessing especially with namespaces. Wouldn't it be better to use
that method in the Switch MediatorFactory instead ?

Thanks,

Benjamin

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


Re: Synapse2: Question about XPath Expressions in SwitchMediator

Posted by Benjamin Schmeling <be...@googlemail.com>.
Hi,

have you already fixed the problem with xpath in switch? I've
installed the 2.0 release of Synapse, but the problem still remains.

Thanks,

Benjamin

On Sat, Dec 18, 2010 at 12:34 AM, Paul Fremantle <pz...@gmail.com> wrote:
> Thanks Benjamin.
>
> Paul
>
> On Fri, Dec 17, 2010 at 5:42 PM, Benjamin Schmeling
> <be...@googlemail.com> wrote:
>> Hi,
>>
>> to fix it you can replace the following line in
>> SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE):
>>
>> LINE 47: xpath = new SynapseXPath(xpathAttrib.getAttributeValue());
>>
>> by xpath = SynapseXPath.parseXPathString(xpathAttrib.getAttributeValue());
>>
>> Thanks,
>>
>> Benjamin
>>
>>
>> On Wed, Dec 15, 2010 at 3:16 PM, Ruwan Linton <ru...@gmail.com> wrote:
>>> I think you are correct, let me have a look at using the parseXPathString
>>> instead of the current one.
>>> Thanks,
>>> Ruwan
>>>
>>> On Wed, Dec 15, 2010 at 5:21 PM, Benjamin Schmeling
>>> <be...@googlemail.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am using Apache Synapse 2.0-SNAPSHOT and I have a problem with XPATH
>>>> expressions.
>>>>
>>>> I have defined the following configuration:
>>>>
>>>> ..
>>>> <configuration:switch
>>>>
>>>> source="{http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination">
>>>> ..
>>>>
>>>> which should be a a valid XPATH expression.
>>>>
>>>> Synapse throws the following exception:
>>>>
>>>> ERROR SynapseServer - Error starting Apache Synapse, trying a clean
>>>> shutdown...
>>>> org.apache.synapse.SynapseException: Invalid XPath for attribute
>>>> 'source' :
>>>> {http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination
>>>>        at
>>>> org.apache.synapse.config.xml.SwitchMediatorFactory.createSpecificMediator(SwitchMediatorFactory.java:71)
>>>>        at
>>>> org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:88)
>>>>        ......
>>>>
>>>> I've also looked at the code and saw that the SwitchMediatorFactory
>>>> directly calls new SynapseXPath(xpathAttrib.getAttributeValue()),
>>>> whereas in your test cases you are rather using the
>>>> SynapseXPath.parseXPathString(XPATHString) method which does some
>>>> preprocessing especially with namespaces. Wouldn't it be better to use
>>>> that method in the Switch MediatorFactory instead ?
>>>>
>>>> Thanks,
>>>>
>>>> Benjamin
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>>>> For additional commands, e-mail: dev-help@synapse.apache.org
>>>>
>>>
>>>
>>>
>>> --
>>> Ruwan Linton
>>> Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
>>> WSO2 Inc.; http://wso2.org
>>>
>>> Lean . Enterprise . Middleware
>>>
>>> phone: +1 408 754 7388 ext 51789
>>> email: ruwan@wso2.com; cell: +94 77 341 3097
>>> blog: http://blog.ruwan.org
>>> linkedin: http://www.linkedin.com/in/ruwanlinton
>>> google: http://www.google.com/profiles/ruwan.linton
>>> tweet: http://twitter.com/ruwanlinton
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> For additional commands, e-mail: dev-help@synapse.apache.org
>>
>>
>
>
>
> --
> 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
>
>

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


Re: Synapse2: Question about XPath Expressions in SwitchMediator

Posted by Paul Fremantle <pz...@gmail.com>.
Thanks Benjamin.

Paul

On Fri, Dec 17, 2010 at 5:42 PM, Benjamin Schmeling
<be...@googlemail.com> wrote:
> Hi,
>
> to fix it you can replace the following line in
> SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE):
>
> LINE 47: xpath = new SynapseXPath(xpathAttrib.getAttributeValue());
>
> by xpath = SynapseXPath.parseXPathString(xpathAttrib.getAttributeValue());
>
> Thanks,
>
> Benjamin
>
>
> On Wed, Dec 15, 2010 at 3:16 PM, Ruwan Linton <ru...@gmail.com> wrote:
>> I think you are correct, let me have a look at using the parseXPathString
>> instead of the current one.
>> Thanks,
>> Ruwan
>>
>> On Wed, Dec 15, 2010 at 5:21 PM, Benjamin Schmeling
>> <be...@googlemail.com> wrote:
>>>
>>> Hi,
>>>
>>> I am using Apache Synapse 2.0-SNAPSHOT and I have a problem with XPATH
>>> expressions.
>>>
>>> I have defined the following configuration:
>>>
>>> ..
>>> <configuration:switch
>>>
>>> source="{http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination">
>>> ..
>>>
>>> which should be a a valid XPATH expression.
>>>
>>> Synapse throws the following exception:
>>>
>>> ERROR SynapseServer - Error starting Apache Synapse, trying a clean
>>> shutdown...
>>> org.apache.synapse.SynapseException: Invalid XPath for attribute
>>> 'source' :
>>> {http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination
>>>        at
>>> org.apache.synapse.config.xml.SwitchMediatorFactory.createSpecificMediator(SwitchMediatorFactory.java:71)
>>>        at
>>> org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:88)
>>>        ......
>>>
>>> I've also looked at the code and saw that the SwitchMediatorFactory
>>> directly calls new SynapseXPath(xpathAttrib.getAttributeValue()),
>>> whereas in your test cases you are rather using the
>>> SynapseXPath.parseXPathString(XPATHString) method which does some
>>> preprocessing especially with namespaces. Wouldn't it be better to use
>>> that method in the Switch MediatorFactory instead ?
>>>
>>> Thanks,
>>>
>>> Benjamin
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>>> For additional commands, e-mail: dev-help@synapse.apache.org
>>>
>>
>>
>>
>> --
>> Ruwan Linton
>> Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
>> WSO2 Inc.; http://wso2.org
>>
>> Lean . Enterprise . Middleware
>>
>> phone: +1 408 754 7388 ext 51789
>> email: ruwan@wso2.com; cell: +94 77 341 3097
>> blog: http://blog.ruwan.org
>> linkedin: http://www.linkedin.com/in/ruwanlinton
>> google: http://www.google.com/profiles/ruwan.linton
>> tweet: http://twitter.com/ruwanlinton
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>



-- 
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: Synapse2: Question about XPath Expressions in SwitchMediator

Posted by Benjamin Schmeling <be...@googlemail.com>.
Hi,

to fix it you can replace the following line in
SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE):

LINE 47: xpath = new SynapseXPath(xpathAttrib.getAttributeValue());

by xpath = SynapseXPath.parseXPathString(xpathAttrib.getAttributeValue());

Thanks,

Benjamin


On Wed, Dec 15, 2010 at 3:16 PM, Ruwan Linton <ru...@gmail.com> wrote:
> I think you are correct, let me have a look at using the parseXPathString
> instead of the current one.
> Thanks,
> Ruwan
>
> On Wed, Dec 15, 2010 at 5:21 PM, Benjamin Schmeling
> <be...@googlemail.com> wrote:
>>
>> Hi,
>>
>> I am using Apache Synapse 2.0-SNAPSHOT and I have a problem with XPATH
>> expressions.
>>
>> I have defined the following configuration:
>>
>> ..
>> <configuration:switch
>>
>> source="{http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination">
>> ..
>>
>> which should be a a valid XPATH expression.
>>
>> Synapse throws the following exception:
>>
>> ERROR SynapseServer - Error starting Apache Synapse, trying a clean
>> shutdown...
>> org.apache.synapse.SynapseException: Invalid XPath for attribute
>> 'source' :
>> {http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination
>>        at
>> org.apache.synapse.config.xml.SwitchMediatorFactory.createSpecificMediator(SwitchMediatorFactory.java:71)
>>        at
>> org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:88)
>>        ......
>>
>> I've also looked at the code and saw that the SwitchMediatorFactory
>> directly calls new SynapseXPath(xpathAttrib.getAttributeValue()),
>> whereas in your test cases you are rather using the
>> SynapseXPath.parseXPathString(XPATHString) method which does some
>> preprocessing especially with namespaces. Wouldn't it be better to use
>> that method in the Switch MediatorFactory instead ?
>>
>> Thanks,
>>
>> Benjamin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> For additional commands, e-mail: dev-help@synapse.apache.org
>>
>
>
>
> --
> Ruwan Linton
> Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
>
> Lean . Enterprise . Middleware
>
> phone: +1 408 754 7388 ext 51789
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://blog.ruwan.org
> linkedin: http://www.linkedin.com/in/ruwanlinton
> google: http://www.google.com/profiles/ruwan.linton
> tweet: http://twitter.com/ruwanlinton
>

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


Re: Synapse2: Question about XPath Expressions in SwitchMediator

Posted by Ruwan Linton <ru...@gmail.com>.
I think you are correct, let me have a look at using the parseXPathString
instead of the current one.

Thanks,
Ruwan

On Wed, Dec 15, 2010 at 5:21 PM, Benjamin Schmeling <
benjamin.schmeling@googlemail.com> wrote:

> Hi,
>
> I am using Apache Synapse 2.0-SNAPSHOT and I have a problem with XPATH
> expressions.
>
> I have defined the following configuration:
>
> ..
> <configuration:switch
> source="{http://mytravelagency.com}searchFlights/{
> http://mytravelagency.com}destination">
> ..
>
> which should be a a valid XPATH expression.
>
> Synapse throws the following exception:
>
> ERROR SynapseServer - Error starting Apache Synapse, trying a clean
> shutdown...
> org.apache.synapse.SynapseException: Invalid XPath for attribute
> 'source' : {http://mytravelagency.com}searchFlights/{
> http://mytravelagency.com}destination
>        at
> org.apache.synapse.config.xml.SwitchMediatorFactory.createSpecificMediator(SwitchMediatorFactory.java:71)
>        at
> org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:88)
>        ......
>
> I've also looked at the code and saw that the SwitchMediatorFactory
> directly calls new SynapseXPath(xpathAttrib.getAttributeValue()),
> whereas in your test cases you are rather using the
> SynapseXPath.parseXPathString(XPATHString) method which does some
> preprocessing especially with namespaces. Wouldn't it be better to use
> that method in the Switch MediatorFactory instead ?
>
> Thanks,
>
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>


-- 
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org

Lean . Enterprise . Middleware

phone: +1 408 754 7388 ext 51789
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton

Synapse2: Question about XPath Expressions in SwitchMediator

Posted by Benjamin Schmeling <be...@googlemail.com>.
Hi,

I am using Apache Synapse 2.0-SNAPSHOT and I have a problem with XPATH
expressions.

I have defined the following configuration:

..
<configuration:switch
source="{http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination">
..

which should be a a valid XPATH expression.

Synapse throws the following exception:

ERROR SynapseServer - Error starting Apache Synapse, trying a clean shutdown...
org.apache.synapse.SynapseException: Invalid XPath for attribute
'source' : {http://mytravelagency.com}searchFlights/{http://mytravelagency.com}destination
       at org.apache.synapse.config.xml.SwitchMediatorFactory.createSpecificMediator(SwitchMediatorFactory.java:71)
       at org.apache.synapse.config.xml.AbstractMediatorFactory.createMediator(AbstractMediatorFactory.java:88)
       ......

I've also looked at the code and saw that the SwitchMediatorFactory
directly calls new SynapseXPath(xpathAttrib.getAttributeValue()),
whereas in your test cases you are rather using the
SynapseXPath.parseXPathString(XPATHString) method which does some
preprocessing especially with namespaces. Wouldn't it be better to use
that method in the Switch MediatorFactory instead ?

Thanks,

Benjamin

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