0

I have a soap envelope

<?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:noNamespaceSchemaLocation="file:///Users/michael/Downloads/soap.xsd">
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>

soap.xsd is just a local version of http://schemas.xmlsoap.org/soap/envelope/ saved to soap.xsd

when i try to validate this, it says the schema target is incorrect per the targetAction

All trial and error point to the xmlns:xsi tag as giving the error

I wonder if it has to do with SOAP 1.0 vs 1.1

(i have been able to validate the xml inside the soap with the exact same method) im pretty sure this can be done in one element, but for the sake of sanity, im trying to get this to work

MichaelEvanchik
  • 1,748
  • 1
  • 13
  • 23
  • How do you validate your XML file? Is it maybe just a warning and parsing the actual file works anyway? – wp78de Jul 09 '18 at 23:53
  • i validate by putting the same tags xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///Users/michael/Downloads/soap.xsd"> but pointing to the given xsd file for the endpoint. I just use NSXLMDocument and just call validateAndReturn which is a boolean – MichaelEvanchik Jul 09 '18 at 23:55
  • i know it works because if i go out of bounds on the string in the paramater to 51 instead of 50 it will let me know. – MichaelEvanchik Jul 09 '18 at 23:56
  • i just cant include the soap envelope or body tags or it will fail. I can import into the schema file the soap endpoints. but it will not do both at the same time – MichaelEvanchik Jul 09 '18 at 23:57
  • here is the big write up on the problem https://stackoverflow.com/questions/51216683/soap-xml-response-validate-with-xsd-file – MichaelEvanchik Jul 09 '18 at 23:58
  • but keeping it simple can i just validate that above soap xml, without using a utility ? i can take a xml string load it , inject those headers and it will validate. but i cant do both – MichaelEvanchik Jul 10 '18 at 00:00

1 Answers1

1

ok the answer to validating a soap is the following format, using trial and error

<?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>
</soapenv:Body>
</soapenv:Envelope>

You can then validate that this is a valid SOAP, but sadly, if there is xml inside the body, and you also properly point to the xsd file, they both cannot be validated.

When I say validated, I mean not using lib2xml or any other external tool. Only using the xml file itself to validate