Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

How to apply restrictions like regular expression to the elements of a type which is sent to a web method as an argument of a web service (.asmx)?

$
0
0

I am creating a web service (.asmx), which accepts an C# type as an argument. I need to apply certain regular expression code inside the elements of this type. How i do this in C# type. I am using classic web services, not WCF Services. Below are restiction / conditions i need to apply to the type, so that the consume can see and send data basing on this restriction. Could somebody tell me how to do this? I appreciate your help. Thank you.

<xsd:element name="MW" type="bk:MWDataType" />
<xsd:simpleType name="MWDataType">
 <xsd:restriction base="xsd:string">
     <xsd:pattern value="[0-9]{0,6}\.?[0-9]?[0-9]?[0-9]?[0-9]?" />
 </xsd:restriction>
</xsd:simpleType>


<xsd:element name="DealterID">
 <xsd:simpleType>
   <xsd:restriction base="xsd:string">
     <xsd:maxLength value="30" />
     <xsd:minLength value="1" />
   </xsd:restriction>
  </xsd:simpleType>
</xsd:element>

 <xsd:element name="StartDate" type="bk:Date" />
<xsd:simpleType name="Date">
 <xsd:restriction base="xsd:date">
  <xsd:minInclusive value="1970-01-01" />
 </xsd:restriction>
</xsd:simpleType>

 <xsd:element name="TimeZone" type="bk:DataTypeTimeZone" />
<xsd:simpleType name="DataTypeTimeZone">
  <xsd:restriction base="xsd:string">
    <xsd:pattern value="[AECMP][SDP]T" />
  </xsd:restriction>
</xsd:simpleType>


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>