Skip to main content

WSDL Schema Validation Policy

From Talend ESB, you can use policies in the Service Registry to validate WSDL schemas. This validation will be performed using the service schema defined in the WSDL.

Talend ESB provides a template policy called wspolicy_schema_validation.policy and available in the /add-ons/registry/policies folder of the Talend ESB product. This default policy for schema validation is as follows:

<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy" Name="wspolicy_schema_validation">
    <wsp:ExactlyOne>
        <wsp:All>
            <tpa:SchemaValidation xmlns:tpa="http://types.talend.com/policy/assertion/1.0" type="WSDLSchema" appliesTo="provider" message="request"/>
        </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>

Where:

  • type - WSDLSchema (if not specified, assumed as WSDLSchema),

  • appliesTo - consumer/provider/always/none,

  • message - request/response/all/none.

To enable WSDL Schema Validation via policy:

  1. Make sure the Talend Runtime is running, and the Service Registry service has been started. For more information, see Service Ristry.

  2. Import the WDSL schema validation policy to use, either directly from the Talend Runtime. For more information, see Using the Service Registry with Talend ESB or via the Talend Administration Center, for more information, see Managing policies.

    This wspolicy_schema_validation.policy policy is by default applicable for provider's request, but you can modify it according to your need. For more information about the customization or creation of your own validation policy, refer to the Custom Schema Validation Policy.

  3. Assign the policy to the service you want to validate the schema of.

This way, if the WSDL of the service is using a specific restriction in its xsd:schema, for example:
<xsd:restriction base="xsd:string">
  <xsd:minLength value="20"></xsd:minLength>
  <xsd:maxLength value="30"></xsd:maxLength>
</xsd:restriction>

If this restriction is defined in the <xsd:element> of the request, then it will be used to validate the request message on the consumer, provider (or both) side. If this restriction is defined in the <xsd:element> of the response, then it will be used to validate the response message on the consumer, provider, or always.

In case the restriction is defined in the <xsd:element> of the request but you set your schema validation on the response element (the message="response" parameter in the schema validation policy), then the validation will not be taken into account.

In case the restriction is taken into account, the validity of the consumer, provider or both, request or response messages sent to the service will be checked at runtime when they will be deployed into the Talend Runtime Container. For example, if you send an invalid request to the service, for example a message of less than 20 characters, you will get a Fault response with validation failed information.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!