Hi,
there seems to be a problem with the validate mediator. Seems to me like
a caching issue.
I changed the schema used in sample 7 so that synapse accepts messages
with symbol values that match the following restriction:
<xs:simpleType name="CharsOnly">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]{3}"/>
</xs:restriction>
</xs:simpleType>
(see attached file for the modified sample 7)
After starting synapse the following test sequence fails at test #3:
-----Test #1-----
ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dtrpurl=http://localhost:8080 -Dsymbol=IBM
stockquote:
[java] Standard :: Stock price = $184.12973898992993
... worked. The schema seems to be valid. "IBM" is a valid symbol. :)
-----Test #2-----
Then I tried this:
ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dtrpurl=http://localhost:8080 -Dsymbol=IBM2
stockquote:
[java] org.apache.axis2.AxisFault: Invalid custom quote request
... correct. The symbol "IBM2" doesn´t match the given restriction pattern.
-----Test #3-----
ant stockquote
-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
-Dtrpurl=http://localhost:8080 -Dsymbol=IBM
stockquote:
[java] org.apache.axis2.AxisFault: Invalid custom quote request
... this is the same as test #1 but it fails now. I think that the
validate mediator somehow caches the error of test #2.
Can you confirm this or am I doing something wrong?
Michael
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<!-- introduction of static inline XML properties and the validation mediator -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
<localEntry key="validate_schema">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.apache-synapse.org/test" elementFormDefault="qualified"
attributeFormDefault="unqualified"
targetNamespace="http://services.samples/xsd" xmlns:xsd="http://services.samples/xsd">
<xs:element name="getQuote">
<xs:complexType>
<xs:sequence>
<xs:element name="request">
<xs:complexType>
<xs:sequence>
<xs:element name="symbol" type="xsd:CharsOnly"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="CharsOnly">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]{3}"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
</localEntry>
<in>
<validate>
<schema key="validate_schema"/>
<on-fail>
<!-- if the request does not validate againt schema throw a fault -->
<makefault>
<code value="tns:Receiver"
xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>
<reason value="Invalid custom quote request"/>
</makefault>
<property name="RESPONSE" value="true"/>
<header name="To" expression="get-property('ReplyTo')"/>
</on-fail>
</validate>
</in>
<send/>
</definitions>---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]