Using “SOAP Message Validation” with no Target Proxy for mocking a request. Using Apigee Cloud
My requirement is
1. POST method should validate the input message with respect to WSDL.
2. Once validation done based on SOAP message if SOAP method is “getDetails” returns response XML1
3. If SOAP Method is anotherDetails return response XML 2
My SOAP Message Validation policy looks like below.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageValidation async="false" continueOnError="false" enabled="true" name="SOAP-Message-Validation-1">
<DisplayName>SOAP Message Validation-1</DisplayName>
<Properties/>
<Element namespace="https://my.mynamespace.com/">getDetails</Element>
<SOAPMessage/>
<Source>request</Source>
<ResourceURL>wsdl://ReferMyLocal-1.wsdl</ResourceURL>
</MessageValidation>
Note:
I have added SOAP Message validation with following steps for policy
Selected followed steps for creating SOAP Message Validation Policy with indicated steps
Filteype : WSDL
Script File : Import new Script
File: Browsed the WSDL file (named ReferMyLocal-1.wsdl)
This automatically created “ReferMyLocal-1.wsdl” under wsdl folder of edge
I saved my proxy goes without error and deployed to test environment
I am Sending the following request (POST request to SOAP using API Console
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header>
<AuthSOAPHeader xmlns="https://my.mynamespace.com/">
</AuthSOAPHeader>
</soapenv:Header>
<soapenv:Body>
< getDetails xmlns="https://my.mynamespace.com/">
<gref>string</gref>
</getDetails>
</soapenv:Body>
</soapenv:Envelope>
Would like to know how this SOAP validation really works.
Even If I change getDetails to getDe then also get 200 response
Even if I change the name space truncate the https://my.mynamespace.com/">
Still it gives me 200 response.Let me know if I am missing anything where really SOAP validation will fail indicateing expected error???
Solved! Go to Solution.
@Abiram, While sending a post request via API console, can you check what the Content-type header value?
It should be application/xml, for soap message validation policy to work.
Also Can you send us the soap request and the policy configuration in a proper formatted way? The above one are not properly formatted (for example : Envelope element is not closed properly in the request which you sent above).