Validating incoming request against an XSD using tXSDValidator

I have assigned a job to a service and now i want to validate the incoming request to the job against a XSD file using tXSDValidator.
Here's my XSD, the request XML should adhere :
<xsd:schema targetNamespace="http://www.example.com/customerregistrationdata/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:cus="http://www.example.com/customerregistrationdata/"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xsd:element name="CustomerRegistrationRequest" type="cus:CustomerRegistrationRequest">
<xsd:annotation>
<xsd:documentation>Customer Registration Request</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="CustomerRegistrationResponse" type="cus:CustomerRegistrationResponse">
<xsd:annotation>
<xsd:documentation>Customer Registration Response</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:complexType name="CustomerRegistrationRequest">

<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="FirstName" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="LastName" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="Age" type="xsd:integer"/>
<xsd:element maxOccurs="1" minOccurs="0" name="DateOfBirth" type="xsd:date"/>
<xsd:element maxOccurs="1" minOccurs="0" name="Gender" type="cus:genderType"/>
<xsd:element maxOccurs="1" minOccurs="1" name="MobileNumber" type="cus:mobileNumberType"/>

</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CustomerRegistrationResponse">

<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="Status" type="cus:statusType"/>
</xsd:sequence>
</xsd:complexType>

<xsd:element name="CustomerRegistrationFault" type="cus:FaultType">

</xsd:element>
<xsd:simpleType name="mobileNumberType">
<xsd:annotation>
<xsd:documentation>
Mobile Phone numbers.
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:length value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="statusType">

<xsd:sequence>
<xsd:element name="StatusCode" type="xsd:string"
minOccurs="1"/>
<xsd:element name="StatusMessage" type="xsd:string"
minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="genderType">

<xsd:restriction base="xsd:string">
<xsd:enumeration value="M"/>
<xsd:enumeration value="F"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="FaultType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="FaultCode" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="FaultMessage" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="FaultActor" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="FaultDetail" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="FaultOriginator" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>

My Job flow goes like this :
tESBProviderRequest -> tXSDValidator(flow mode) -> tESBProviderResponse
Can you please help. If any more information required then you can ask me.
1 REPLY
Moderator

Re: Validating incoming request against an XSD using tXSDValidator

Hi,
Is there any error in your job execution?
So far, we have supported xsd:include + xsd:import and external schema location during WSDL import, please see jira issue https://jira.talendforge.org/browse/TESB-8070
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.