soapUI does not catch validation error

546 views Asked by At

I have a restricted type with base string:

 <simpleType name="stringto1">
    <restriction base="string">
       <pattern value="[АБВГ2134-]"/>
    </restriction>
 </simpleType>

And a field with this type:

<element maxOccurs="4" minOccurs="1" name="P5" type="tns:stringto1"/>

But i can write EVERYTHING what i want in this field and the validation is OK! And there IS validation error on the server. Any ideas?

1

There are 1 answers

2
albciff On BEST ANSWER

The special character - in regex is for specify a range like [a-z]. If you want to use - as a simple character you must escape it with \ as \-, so try with the follow regex as pattern:

 <simpleType name="stringto1">
    <restriction base="string">
       <pattern value="[АБВГ2134\-]"/>
    </restriction>
 </simpleType>

Additionally SOAPUI isn't validating your xml because doesn't compile your pattern, you can see this in the SOAPUI log, where the follow error message is displayed:

15:57:51,883 WARN [SchemaUtils] Error: ...\wsdl.wsdl: 0: warning: pattern-regex: The regular expression '[????2134-]' is malformed: '-' is an invalid character range. Write '\-'.

Note that ???? it's because my charset encoding doesn't recognize АБВГ characters, I supouse that in your case escaping - as \-will be enough.

Hope this helps,