Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error adding XSD script to SOAP Message Validation policy

When attaching SOAP Message Validation in API proxy, am getting error while adding .xsd file to soap message validation policy

1. When creating policy, if I select file type as "XSD" and Script file as "Create new script", am getting error message "Script has no source, it should be a new one, an imported one or an existing one."

 
2. When I pre-populate xsd script in resources and add my .xsd file to the resources, then when i come to add policy->select Soap message validation policy -> select existing .xsd script, the error says
"File extension does not match selected file type. Found: .xsd; Expected: .wsdl
2 5 603
5 REPLIES 5

Hi, thanks for reporting this. Can you attach a screenshot for each of  these two errors?

Hi , This is the screenshot of the following error

ark123_0-1742367982362.png

 

Hi,

Can you confirm which version of Apigee you are on? I gave this a try on Apigee X using the GCP Console based UI and the behavior works as expected. However, the screen shot looks like one of the older user experiences.

Hi @ark123 , @malashree ,

I was able to recreated the issue in an Apigee Edge SaaS organization. Is that the version of Apigee you are using? I will log this as a bug internally for our team to address. I'd also suggest log a support ticket so you can be kept up to date on this. 

On a positive note I did find a workaround (detailed below) so you don't have to wait on a fix to be deployed.

  1. Within the Apigee Edge UI, create a new SOAP Message Validation policy and uncheck the Include Schema box when you add the policy.
  2. Delete the SOAP-Message-Validation-1.wsdl that gets created.
  3. Add your XSD file as a new resource to the proxy.
  4. Update the ResourceURL element within the policy you created in step 1, to reference the XSD you just created in step 3. For example:  <ResourceURL>xsd://note-schema.xsd</ResourceURL>

See below for an example proxy I have working using this workaround for reference. The proxy follows this example.

MessageValidation policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation continueOnError="false" enabled="true" name="MV-Message-Validator">
    <DisplayName>MV-Message-Validator</DisplayName>
    <Properties/>
    <Source>request</Source>
    <ResourceURL>xsd://note-schema.xsd</ResourceURL>
</MessageValidation>

 

 

Schema (note-schema.xsd):

 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="note">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="to" type="xs:string"/>
        <xs:element name="from" type="xs:string"/>
        <xs:element name="heading" type="xs:string"/>
        <xs:element name="body" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

 

Default.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
    <PreFlow name="PreFlow">
        <Request>
            <Step>
                <Name>MV-Message-Validator</Name>
            </Step>
        </Request>
        <Response/>
    </PreFlow>
    <Flows/>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <HTTPProxyConnection>
        <BasePath>/message-validation-test</BasePath>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>
    <RouteRule name="noroute"/>
</ProxyEndpoint>

 

 

Conforming Request:

 

<note>
  <to>Fred Rogers</to>
  <from>Nick Danger</from>
  <heading>Greetings from my neighborhood</heading>
  <body>Just writing to say hello.</body>
</note>

 

Non-Conforming Request:

 

<note>
  <to>Fred Rogers</to>
  <from>Nick Danger</from>
  <heading>Greetings from my neighborhood</heading>
  <body>Just writing to say hello.</body>
  <new>element</new>
</note>

 

Positive Test:

curl -X POST --header "Content-Type:text/xml;charset=UTF-8" --data @request.xml https://my-test.apigee.net/message-validation-test

 

 

Negative Test:

curl -X POST --header "Content-Type:text/xml;charset=UTF-8" --data @bad-request.xml https://my-test.apigee.net/message-validation-test

 

 

Alright Thanks !