When attaching SOAP Message Validation in API proxy, am getting error while adding .xsd file to soap message validation policy
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.”
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”
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.
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.
Within the Apigee Edge UI, create a new SOAP Message Validation policy and uncheck the Include Schema box when you add the policy.
Delete the SOAP-Message-Validation-1.wsdl that gets created.
Add your XSD file as a new resource to the proxy.
Update the ResourceURL element within the policy you created in step 1, to reference the XSD you just created in step 3. For example: xsd://note-schema.xsd
See below for an example proxy I have working using this workaround for reference. The proxy follows this example.
<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