When validating SOAP message with Message Validation Policy I encounter the problems with message validation when they contain multiple namespaces.
My configuration:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MessageValidation name="validate-soap-message"> <DisplayName>Validate SOAP Message</DisplayName> <SOAPMessage version="1.1"/> <Source>message</Source> <ResourceURL>wsdl://example.wsdl</ResourceURL> </MessageValidation>
Example payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://URL/tns"> <soapenv:Header/> <soapenv:Body> <tns:getIncidentRequest> <tns:IncidentID>IM01941995</tns:IncidentID> </tns:getIncidentRequest> </soapenv:Body> </soapenv:Envelope>
And received error:
{"Envelope":{"encodingStyle":"http:\/\/schemas.xmlsoap.org\/soap\/encoding\/","Body":{ "Fault":{ "faultactor":{}, "faultcode":"soap:Server", "faultstring":"validate-soap-message failed with reason: \"Unexpected Root Element tns:getIncidentRequest [Line 4]\"", "detail":{"source":{"errorcode":"steps.messagevalidation.Failed"}} } }}}
Any idea what is the source of the problem?
Solved! Go to Solution.
Upgrade to version 4.18.x solved the the problem.
Specifying element does not solve the problem:
<Element namespace="http://schemas.xmlsoap.org/soap/envelope/">Envelope</Element>
@Błażej Krysiak , Is there any sample proxy using which we can reproduce above error ?
If you can provide below that will be easy to troubleshoot,
Example request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="https://example.com/proxy" xmlns:typ="https://example.com/proxy/types"> <soapenv:Header/> <soapenv:Body> <prox:exampleGetMessage> <typ:ExampleType> <typ:exampleID>ExampleID</typ:exampleID> </typ:ExampleType> </prox:exampleGetMessage> </soapenv:Body> </soapenv:Envelope>And proxy that reproduces the case (the validation should pass, but it doesn't):
Any update here @Anil Sagar?
Any progress with this issue? @Anil Sagar
Hi @Błażej Krysiak,
I took a quick look, haven't played with XML in a while, and I got your example to validate by correcting the values of the namespaces for prox and typ xml-validate-rev1-2017-05-19.zipin your message to match what is in your WSDL.
The corrected request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="https://example.com/gateway" xmlns:typ="https://example.com/gateway/types"> <soapenv:Header/> <soapenv:Body> <prox:exampleGetMessage> <typ:ExampleType> <typ:exampleID>ExampleID</typ:exampleID> </typ:ExampleType> </prox:exampleGetMessage> </soapenv:Body> </soapenv:Envelope>
And the proxy to verify it works, not sure if I tweaked anything in the WSDL.
Thanks for using the community and don't forget to Accept if this solves your problem.
You correctly spotted the typo in namespaces in provided example! However the issue was fixed after upgrade to 4.18... Still don't know the cause of the problem, but at least it works a expected now.
Upgrade to version 4.18.x solved the the problem.