Topic
1 reply Latest Post - ‏2013-11-03T20:50:19Z by HermannSW
Ben_se
Ben_se
1 Post
ACCEPTED ANSWER

Pinned topic Validating Datasets

‏2013-11-03T10:35:18Z |

Hi,

I am using WCF technology to consume web services from my server. I want the datapower to validate clients requests, some of the requests contain datasets which i cant validate.

This is the error showed in the probe:

http://155.5.9.21:1002/InpassServer.WCF/ManagePCService.svc: cvc-particle 3.1: in element {http://tempuri.org/}ChangedDataset with anonymous type, found <xs:schema> (in namespace http://www.w3.org/2001/XMLSchema), but next item should be any defined element in namespace http://tempuri.org/ManagePcDS.xsd

This is the actual request:

<s:Envelope

xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
>
<s:Header>
<a:Action s:mustUnderstand="1" u:Id="_3">http://tempuri.org/IManagePCService/SaveChanges</a:Action>
<a:MessageID u:Id="_4">urn:uuid:97196e53-551a-472e-b787-fcf0390d5265</a:MessageID>
<a:ReplyTo u:Id="_5">
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1" u:Id="_6">http://datapower:1002/InpassServer.WCF/ManagePCService.svc</a:To>
<o:Security s:mustUnderstand="1"
...
</o:Security>
</s:Header>
<s:Body u:Id="_2">
<SaveChanges
xmlns="http://tempuri.org/"
>
<ChangedDataset>
<xs:schema id="ManagePcDS" targetNamespace="http://tempuri.org/ManagePcDS.xsd" attributeFormDefault="qualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mstns="http://tempuri.org/ManagePcDS.xsd"
xmlns="http://tempuri.org/ManagePcDS.xsd"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
>
<xs:element name="ManagePcDS" msdata:IsDataSet="true" msdata:Locale="he-IL">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="AU_MANAGE_PC_TB">
<xs:complexType>
<xs:sequence>
<xs:element name="MP_PC_NAME" msprop:OraDbType="126">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_PC_DESCRIPTION" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="15" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_SUPERIOR_1_NAME" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_LAST_PC_UPDATE" msprop:OraDbType="106" type="xs:dateTime" minOccurs="0" />
<xs:element name="MP_LAST_PC_PASSAGE_COPY" msprop:OraDbType="106" type="xs:dateTime" minOccurs="0" />
<xs:element name="MP_LAST_PREVENT_FOR_PC" msprop:OraDbType="106" type="xs:dateTime" minOccurs="0" />
<xs:element name="MP_LAST_CODES_FOR_PC" msprop:OraDbType="106" type="xs:dateTime" minOccurs="0" />
<xs:element name="MP_DO_PREVENT_INIT" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_DO_CODES_INIT" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_DIRECTION" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_PASS_GATE_NO" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_PASS_TYPE" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_CAR_PASS" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_DEF_ID_TYPE" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_CAN_CHANGE_GATE_NO" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_CAN_CHANGE_DIRECTION" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_CAN_CHANGE_PASS_TYPE" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_CAN_CHANGE_LEG_CAR" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_CAN_CHANGE_ID_TYPE" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_PRINT_ARABIC" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_BIO_TYPE" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_CARD_READER_TYPE" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_DEFAULT_FINGER" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_BKR_PREVENT_CD" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_MSLT_PREVENT_CD" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_AUTOPASS_MANAGER" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_READER_STYLE" msprop:OraDbType="111" type="xs:decimal" />
<xs:element name="MP_AUTOPASS_STYLE" msprop:OraDbType="111" type="xs:decimal" />
<xs:element name="MP_SUPERIOR_2_NAME" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
 
 
</xs:simpleType>
</xs:element>
<xs:element name="MP_AUTOPASS_MANAGER_2" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_CAROUSEL_NAME" msprop:OraDbType="126" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MP_CAROUSEL_STYLE" msprop:OraDbType="107" type="xs:decimal" />
<xs:element name="MP_CAN_CHANGE_CAROUSEL_STYLE" msprop:OraDbType="107" type="xs:decimal" />
<xs:element name="MP_UPDATE_FP_LOG" msprop:OraDbType="111" type="xs:decimal" />
<xs:element name="MP_BAKAR_BIDUK_STYLE" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
<xs:element name="MP_EXTRA_SCREEN" msprop:OraDbType="111" type="xs:decimal" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:AU_MANAGE_PC_TB" />
<xs:field xpath="mstns:MP_PC_NAME" />
</xs:unique>
</xs:element>
</xs:schema>
<diffgr:diffgram
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
>
<ManagePcDS
xmlns="http://tempuri.org/ManagePcDS.xsd"
>
<AU_MANAGE_PC_TB diffgr:id="AU_MANAGE_PC_TB1" msdata:rowOrder="0">
<MP_PC_NAME>AYARIEBKR01</MP_PC_NAME>
<MP_PC_DESCRIPTION>abc</MP_PC_DESCRIPTION>
<MP_DIRECTION>1</MP_DIRECTION>
...

/>

 

The way I see it, the problem is that .net attaches the <xs:schema> element to the ChangedDataSet element. 

I have tried configuring the client to exclude the schema from the request, but then I get another error:

http://155.5.9.21:1002/InpassServer.WCF/ManagePCService.svc: cvc-complex-type 3: element {http://tempuri.org/}ChangedDataset with anonymous type had undefined attribute {urn:schemas-microsoft-com:xml-msdata}SchemaSerializationMode

 

This was the request:

<ChangedDataset msdata:SchemaSerializationMode="ExcludeSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
>
<xs:schema id="ManagePcDS" targetNamespace="http://tempuri.org/ManagePcDS.xsd" attributeFormDefault="qualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mstns="http://tempuri.org/ManagePcDS.xsd"
xmlns="http://tempuri.org/ManagePcDS.xsd"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
>
<xs:element name="ManagePcDS" msdata:IsDataSet="true" msdata:Locale="he-IL">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded" />
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"
>
<ManagePcDS
xmlns="http://tempuri.org/ManagePcDS.xsd"
>
<AU_MANAGE_PC_TB diffgr:id="AU_MANAGE_PC_TB1" msdata:rowOrder="0">
<MP_PC_NAME>AYARIEBKR01</MP_PC_NAME>

...

/>

 

Any way to make the datapower to ignore the schema element or the msdata:SchemaSerializationMode attribute?

  • HermannSW
    HermannSW
    4119 Posts
    ACCEPTED ANSWER

    Re: Validating Datasets

    ‏2013-11-03T20:50:19Z  in response to Ben_se

    Hi,

    in both cases the DataPower error message indicates that the client does send invalid input according the Schema.

    Why do you want to change the DataPower side then?

    You should make the client send data valid for the Schema.

    Doing anything on DataPower to accept data it should not accept sounds wrong to me ...


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>