0

I have a SOAP xml response.

I have a xsd file.

But is there a way in the header of the SOAP xml response to inject the location of the xsd schema file, and just validate the XMLDocument

Here is what i have come up with, but just does not work

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getCCMVersionResponse xmlns:ns="http://www.cisco.com/AXL/API/10.5"> 
<return><componentVersion>     
<version>10.5.2.11900(3)</version>
</componentVersion>
</return>
</ns:getCCMVersionResponse>
</soapenv:Body>
</soapenv:Envelope>

im trying to change the header

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

to

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://test123a.epizy.com/getCCMVersion.xsd">

i have tried schemaLocation, and i have also tried file:///Users/me/Documents/getCCMVersion.xsd

can anyone help?

this guy never got an aswer

SOAP Response Schema Validation

MichaelEvanchik
  • 1,748
  • 1
  • 13
  • 23
  • Which tool do you use or do you expect to "just validate the XML" by injecting a schema location? Does that tool validate the XML if it already has a schema location? What exactly fails if it "just does not work"? It is not clear what you are doing and which results you expect. – Martin Honnen Jul 08 '18 at 20:10
  • This tools says it can be done without putting in the xsd at the broom and just use it in the header of the response. Also I have old code base that shows it worrisome this way https://www.freeformatter.com/xml-validator-xsd.html – MichaelEvanchik Jul 09 '18 at 01:58
  • Here is the more detailed question https://stackoverflow.com/questions/51216683/soap-xml-response-validate-with-xsd-file – MichaelEvanchik Jul 09 '18 at 01:58
  • It does fail just gives me false positives( entering a sting longer then 50 ) – MichaelEvanchik Jul 09 '18 at 02:00

1 Answers1

1
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/   
http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getCCMVersionResponse xmlns:ns="http://www.cisco.com/AXL/API/10.5"                                                       
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                                              
xsi:schemaLocation="http://www.cisco.com/AXL/API/10.5  
/Users/michael/Downloads/axlsqltoolkit/schema/current/getCCMVersion.xsd">
<return>
<componentVersion>
<version>10.5.2.11900(3)</version>
</componentVersion>
</return>
</ns:getCCMVersionResponse>
</soapenv:Body>
</soapenv:Envelope>

Turns out this is the correct format

But you cannot self validate the SOAP document and the XML inside the soap at the same time.

You will need to path to the

Also noNamespaceSchemaLocation cannot be used if a xml response or a soap even lope has a namespace already declared. For example the xml response already has

xmlns:ns="http://www.cisco.com/AXL/API/10.5"

and there for all attempts with where nothing but frustration

<version>10.5.2.11900(3)</version>
</componentVersion>
</return>
</ns:getCCMVersionResponse>
</soapenv:Body>