xml - XSD for soap result not working -


i want check soap response against xsd. here xml soap response:

<?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema">     <soap:body>         <gethtmlresponse xmlns="http://www.webservicex.net">             <gethtmlresult>                 test             </gethtmlresult>         </gethtmlresponse>     </soap:body> </soap:envelope> 

here xsd:

<xs:schema attributeformdefault="unqualified" elementformdefault="qualified" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemalocation="http://schemas.xmlsoap.org/soap/envelope/"/> <xs:element name="gethtmlresponse">   <xs:complextype>     <xs:sequence>         <xs:element  name="gethtmlresult" minoccurs="0" maxoccurs="1">             <xs:simpletype>                 <xs:restriction base="xs:string">                 </xs:restriction>             </xs:simpletype>          </xs:element>     </xs:sequence> </xs:complextype> 

i error: cvc-elt.1: cannot find declaration of element 'soap:envelope'.

why happening?

try checking soap response against following xsd file. added elements outer <soap:envelope> , <soap:body> tags present in soap response.

<?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.example.org" xmlns:tns="http://www.w3.org/2003/05/soap-envelope">  <xs:element name="envelope" type="tns:envtype">   <xs:complextype name="envtype">     <xs:sequence>       <xs:element name="body" type="tns:bodytype">         <xs:complextype name="bodytype">           <xs:sequence>             <xs:element name="gethtmlresponse">               <xs:complextype>                 <xs:sequence>                   <xs:element name="gethtmlresult" minoccurs="0"                               maxoccurs="1" type="xs:string">                     <xs:simpletype>                       <xs:restriction base="xs:string">                       </xs:restriction>                     </xs:simpletype>                   </xs:element>                 </xs:sequence>               </xs:complextype>             </xs:element>           </xs:sequence>         </xs:complextype>       </xs:element>     </xs:sequence>   </xs:complextype> </xs:element>  </xs:schema> 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -