I can't validate XML over schema provided by external WSDL service. Validate throws this error:
With validator online #1:
The element 'SolicitudEncuesta' in namespace 'htps://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd' has invalid child element 'CabeceraSolicitud' in namespace 'htps://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd'. List of possible elements expected: 'CabeceraSolicitud'. Line: 1 Column:204
With validator online #2
Errors in the XML document: 1: 203 cvc-elt.1: Cannot find the declaration of element 'SolicitudEncuesta'.
Errors in file xml-schema: 2: 196 TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of 'https://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd'.
If i add elementFormDefault="qualified" to schema, the XML validation it's OK. But the schema can't be edited because it's provided for an external service.
Schema:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="ht*p://www.w3.org/2001/XMLSchema"
xmlns="ht*ps://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd"
targetNamespace="ht*ps://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd">
<xsd:element name="SolicitudEncuesta" type="SolicitudEncuesta"/>
<xsd:complexType name="SolicitudEncuesta">
<xsd:sequence>
<xsd:element name="CabeceraSolicitud" type="CabeceraSolicitud" nillable="true"/>
<xsd:element name="Encuesta" type="xsd:base64Binary" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CabeceraSolicitud">
<xsd:sequence>
<xsd:element name="NumeroOrden" nillable="true">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="11"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="CodigoControl" nillable="true">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="CorreoElectronico" nillable="true">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
And my XML:
<SolicitudEncuesta xmlns:xsd="ht*p://www.w3.org/2001/XMLSchema"
xmlns="ht*ps://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd"
targetNamespace="https://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd">
<CabeceraSolicitud>
<NumeroOrden>str12340000</NumeroOrden>
<CodigoControl>str12</CodigoControl>
<CorreoElectronico>str1234</CorreoElectronico>
</CabeceraSolicitud>
<Encuesta>1234</Encuesta>
</SolicitudEncuesta>
I think it's a Namespace problem. I was reading similar problems in other posts, but I can't find a solution.
UPDATE:
Finally, using @kjhughes's knowledge i could validate over Schema correctly. And adding SOAP Envelope i was able to consume the webservice correctly.
Final XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sol="https://arce.ine.es/ARCE/ficheros/SolicitudEncuesta.xsd">
<soapenv:Header/>
<soapenv:Body>
<sol:SolicitudEncuesta>
<CabeceraSolicitud>
<NumeroOrden>XXXX</NumeroOrden>
<CodigoControl>XXXXX</CodigoControl>
<CorreoElectronico>[email protected]</CorreoElectronico>
</CabeceraSolicitud>
<Encuesta>XXXXX</Encuesta>
</sol:SolicitudEncuesta>
</soapenv:Body>
</soapenv:Envelope>
THANKS!!
xmlns:xsd
or set@targetNamespace
in your XML document; you're not using thexsd
namespace prefix, and `@targetNamespace is an XSD construct that serves no purpose in an XML document. - kjhughesxmlns:xsd
or set@targetNamespace
in xml, i received the Validator Online nÂș1 error. - Arey Siurana Coll