locked
XPath filter WCF Routing RRS feed

  • Question

  • User2127084241 posted

    Hi, 

    i have some problems using the Xpath Filter. 

    The Message from the Client locks like : 

    {<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 
    	<s:Header>  
    		<a:Action s:mustUnderstand="1">http://tempuri.org/IFormularService/GetData</a:Action>  
    		<a:MessageID>urn:uuid:82356057-cc06-46e9-ba49-795c7e2f0faf</a:MessageID> 
    		<a:ReplyTo>     
    			<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>  
    		</a:ReplyTo>   
    		<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo26NFlvGLY9IkCvYUKTGdSwAAAAAcQNGbfwrjka+YDRBUx7kkzBu5NRuxpFJko4mTzDKkwYACQAA</VsDebuggerCausalityData>  
    		<a:To s:mustUnderstand="1">net.tcp://localhost:8733/Design_Time_Addresses/Routing/</a:To>  
    	</s:Header> 
    	<s:Body>   
    		<GetData xmlns="http://tempuri.org/">     
    			<sc>f50ee423-b95b-4bbc-8af6-558ba7a58b94</sc>   
    			<Tenant>awd</Tenant>  
    		</GetData>  
    	</s:Body>
     </s:Envelope>}

    I want to look for 

    http://tempuri.org/IFormularService/GetData

    to make the Xpath Filter match, in a second step i want to look also for 

    <sc>f50ee423-b95b-4bbc-8af6-558ba7a58b94</sc>   

    my filter in the config looks this way:

    <filter name="xPath1"  filterType="XPath"  filterData="/s12:Envelope/wsa10:Header/wsa10:Action ='http://tempuri.org/IFormularService/GetData'" />

    Can somebody help me please :)

    Friday, November 11, 2016 10:29 AM

Answers

  • User-2057865890 posted

    Hi Aurillion,

    There are some default namespaces and namespace prefixes that are contained in the namespace table.

    Prefix           Namespace
    s12              http://www.w3.org/2003/05/soap-envelope
    wsa10            http://www.w3.org/2005/08/addressing

    Use default namespace

    <filter name="xPath1"  filterType="XPath"  filterData="/s12:Envelope/s12:Header/wsa10:Action ='http://tempuri.org/IFormularService/GetData'" />

    If you have defined a prefix of "custom" for the namespace,use that in the XPath query contained in filterData.

    Use defined prefix

    <namespaceTable>
         <add prefix="s" namespace="http://www.w3.org/2003/05/soap-envelope"/>
         <add prefix="a" namespace="http://www.w3.org/2005/08/addressing"/>
    </namespaceTable>
    <filters>
         <filter name="xPath1"  filterType="XPath"  filterData="/s:Envelope/s:Header/a:Action='http://tempuri.org/IFormularService/GetData'" />
    </filters>

    reference:

    https://msdn.microsoft.com/en-us/library/ee517424(v=vs.110).aspx

    http://www.codeproject.com/Articles/772854/WCF-Routing-Service-Part-I-Basic-Concept-Simple-Ro 

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 14, 2016 6:11 AM