CICS web services - XML parse error - mainframe

I am currently working in CICS web services and new to XML/WSDL concepts. I got a WSDL file from middleware team and tried to execute the DFHWS2LS utility to create a COBOL language structure from that WSDL. I am getting the following error and was not able to fix this. And suggestions?
DFHPI9027E The XML parser has found an error: "XSD: The attribute
'minOccurs' is not permitted" at line "1" and column"19,015" in
document "file:/AIGNDVR/DEVL1/ELC/WSDL/MakeOkToSellServiceSOAP.wsdl".
DFHPI9558E ERRORS have been generated processing file
"/AIGNDVR/DEVL1/ELC/WSDL/ MakeOkToSellServiceSOAP.wsdl".
XML:
<?xml version="1.0" encoding="EBCDIC-CP-US"?>
<wsdl:definitions name="MakeOkToSell" targetNamespace="http://MakeOkToSell/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://MakeOkToSell/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl/" >
<wsdl:types>
<xs:schema targetNamespace="http://MakeOkToSell/">
<xs:element name="MakeOkToSellRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="RequestSystemName" type="xs:string"/>
<xs:element name="RequestSystemGearID" type="xs:int"/>
<xs:element name="transactionIdentifier" type="xs:string" minOccurs="0"/>
<xs:element name="OkToSellDetails">
<xs:complexType>
<xs:sequence>
<xs:element name="CompanyCode" type="xs:string" minOccurs="0"/>
<xs:element name="PolicyNumber" type="xs:string" minOccurs="0"/>
<xs:element name="UplineID" type="xs:string" minOccurs="0"/>
<xs:element name="SSN" type="xs:int" minOccurs="0"/>
<xs:element name="NPN" type="xs:string" minOccurs="0"/>
<xs:element name="AgencyCode" type="xs:string" minOccurs="0"/>
<xs:element name="First5digitSSNandLastName" type="xs:string" minOccurs="0"/>
<xs:element name="RequestType" type="xs:string" minOccurs="0"/>
<xs:element name="AgentPositionID" type="xs:string" minOccurs="0"/>
<xs:element name="PrimaryAgentID" type="xs:string" minOccurs="0"/>
<xs:element name="AgentFirstName" type="xs:string" minOccurs="0"/>
<xs:element name="AgentLastName" type="xs:string" minOccurs="0"/>
<xs:element name="ApplicationState" type="xs:string"/>
<xs:element name="ProductID" type="xs:string"/>
<xs:element name="ProductType" type="xs:string" minOccurs="0"/>
<xs:element name="ApplicationReceivedDate" type="xs:date"/>
<xs:element name="ApplicationSignedDate" type="xs:date"/>
<xs:element name="GrossPremium" type="xs:decimal" minOccurs="0"/>
<xs:element name="NetPremium" type="xs:decimal" minOccurs="0"/>
<xs:element name="AdditionalData" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Property" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string" minOccurs="1">
<xs:attribute type="xs:string" name="name"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MakeOkToSellResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="UID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="EvaluationStatus">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TaskID" type="xs:string" minOccurs="0"/>
<xs:element name="ErrorDetails" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ErrorCode" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="ErrorType" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="ErrorMessage" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="ObjectType" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="ObjectID" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Warnings" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="WarningCode" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="WarningType" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="WarningMessage" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="ObjectType" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="ObjectID" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MakeOkToSellFault">
<xs:complexType>
<xs:all>
<xs:element name="errorMessage" type="xs:string" minOccurs="0"/>
<xs:element name="errorCode" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="MakeOkToSellRequest">
<wsdl:part element="impl:MakeOkToSellRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="MakeOkToSellResponse">
<wsdl:part element="impl:MakeOkToSellResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="MakeOkToSellFault">
<wsdl:part element="impl:MakeOkToSellFault" name="parameters"/>
</wsdl:message>
<wsdl:portType name="MakeOkToSellService">
<wsdl:operation name="MakeOkToSell">
<wsdl:input message="impl:MakeOkToSellRequest" name="MakeOkToSellRequest"/>
<wsdl:output message="impl:MakeOkToSellResponse" name="MakeOkToSellResponse"/>
<wsdl:fault message="impl:MakeOkToSellFault" name="MakeOkToSellFault"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MakeOkToSellServiceBinding" type="impl:MakeOkToSellService">
<wsaw:UsingAddressing wsdl:required="false"/>
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="MakeOkToSell">
<wsdlsoap:operation soapAction="urn:MakeOkToSell"/>
<wsdl:input name="MakeOkToSellRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="MakeOkToSellResponse">
<wsdlsoap:body use="literal"/>enter code here
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MakeOkToSellService">
<wsdl:documentation>WSDL File for MakeOkToSell</wsdl:documentation>
<wsdl:port binding="impl:MakeOkToSellServiceBinding" name="MakeOkToSellServiceSOAP">
<wsdlsoap:address location="http://localhost:9080/MakeOkToSellService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

DFHWS2Ls is presumably being run from JCL on the MF. I note that the WSDL document has an encoding of EBCDIC-CP-US, which makes sense, but that's not the encoding we're viewing it in. I presume that the WSDL has either been pretty-printed here for legibility, or a transcoding error caused everything to flow into one long line in the EBCDIC version.
I've loaded the WSDL up in a WSDL validator (I used the validator in the Eclipse Web Tools project). It reported the same problem, only this time at line 39: <xs:extension base="xs:string" minOccurs="1"> . I'm not sure what the WSDL author was trying to achieve, but that minOccurs is invalid in XML, I'd suggest deleting it.
[edited to correct markup on XML tags]

Related

Cannot read property 'myOperation' found in wsdl - issue while using NodeJs and soap client

In few words, there are around 100 soap web services and I need to expose them as rest via NodeJs. I mean, for each soap service there will a single rest service playing the role of a facade.
I install "npm install soap" as explained in https://github.com/vpulim/node-soap and https://github.com/23/node-soap. The example below is working properly so I understand the installation is fine.
So, my strach question is: how can I read the wsdl below? Kindly, see how I am trying by following the success example and I am getting certain error which seems I am missing some extra word in "client.CadastroService.CadastroServiceSoapBinding.consultarDados". Well, the wdls from such example has a small difference from my wsdl. The example relies on "wsdl:input wsaw:Action=..." and mine doesn't use wsaw:Action at all. I guess it doesn't change the way I have to call it. I am calling following this pattern: "wsdl:service name"."wsdl:binding name"."wsdl:message name"
Example working:
var soap = require('soap');
var url = "http://www.restfulwebservices.net/wcf/StockQuoteService.svc?wsdl";
var args = {"tns:request":"GOOG"};
soap.createClient(url, function(err, client){
client.CadastroService.BasicHttpBinding_IStockQuoteService.GetStockQuote(args, function(err, result){
if (err) throw err;
console.log(result);
});
});
My wsdl (obviously edited to make simpler):
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://service.ws.mycompany.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="CadastroService" targetNamespace="http://service.ws.mycompany.com/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://service.ws.mycompany.com/" elementFormDefault="unqualified" targetNamespace="http://service.ws.mycompany.com/" version="1.0">
<xs:element name="consultarDados" type="tns:consultarDados"/>
<xs:element name="root" nillable="true" type="xs:anyType"/>
<xs:complexType name="basicResponse">
<xs:sequence>
<xs:element minOccurs="0" name="codigoRetorno" type="xs:string"/>
<xs:element minOccurs="0" name="mensagemRetorno" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="consultarDados">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="tns:ConsultarInput"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultarInput">
<xs:sequence>
<xs:element minOccurs="0" name="numCartao" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="consultarDadosResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:ConsultarResponse"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultarResponse">
<xs:complexContent>
<xs:extension base="tns:basicResponse">
<xs:sequence>
<xs:element minOccurs="0" name="blockCode" type="xs:string"/>
<xs:element minOccurs="0" name="blockCode2" type="xs:string"/>
<xs:element minOccurs="0" name="codBloqueioBoletimProtecao" type="xs:string"/>
<xs:element minOccurs="0" name="codLogo" type="xs:string"/>
<xs:element minOccurs="0" name="codMotivoEmissao2via" type="xs:string"/>
<xs:element minOccurs="0" name="codProdutoDN" type="xs:string"/>
<xs:element minOccurs="0" name="dataAberturaConta" type="xs:string"/>
<xs:element minOccurs="0" name="dataCancelamento" type="xs:string"/>
<xs:element minOccurs="0" name="dataEmissaoCartao" type="xs:string"/>
<xs:element minOccurs="0" name="dataExclusaoBoletimProtecao" type="xs:string"/>
<xs:element minOccurs="0" name="dataExpiracaoConta" type="xs:string"/>
<xs:element minOccurs="0" name="dataGeracaoPlastico" type="xs:string"/>
<xs:element minOccurs="0" name="dataInclusaoBoletimProtecao" type="xs:string"/>
<xs:element minOccurs="0" name="dataInicioAtraso" type="xs:string"/>
<xs:element minOccurs="0" name="dataNascimento" type="xs:string"/>
<xs:element minOccurs="0" name="dataProximoCorte" type="xs:string"/>
<xs:element minOccurs="0" name="dataProximoVencto" type="xs:string"/>
<xs:element minOccurs="0" name="dataUltimaAlteracaoLimite" type="xs:string"/>
<xs:element minOccurs="0" name="dataUltimaAlteracaoVencto" type="xs:string"/>
<xs:element minOccurs="0" name="dataUltimoPagamento" type="xs:string"/>
<xs:element minOccurs="0" name="dataValidadePlastico" type="xs:string"/>
<xs:element minOccurs="0" name="dataVenctoPenultimaFatura" type="xs:string"/>
<xs:element minOccurs="0" name="dataVenctoUltFatura" type="xs:string"/>
<xs:element minOccurs="0" name="dddCelular1" type="xs:string"/>
<xs:element minOccurs="0" name="dddCelular2" type="xs:string"/>
<xs:element minOccurs="0" name="dddComercial" type="xs:string"/>
<xs:element minOccurs="0" name="dddResidencial" type="xs:string"/>
<xs:element minOccurs="0" name="ddiCelular1" type="xs:string"/>
<xs:element minOccurs="0" name="ddiCelular2" type="xs:string"/>
<xs:element minOccurs="0" name="ddiComercial" type="xs:string"/>
<xs:element minOccurs="0" name="ddiResidencial" type="xs:string"/>
<xs:element minOccurs="0" name="descTipoPessoa" type="xs:string"/>
<xs:element minOccurs="0" name="diaCorteAtual" type="xs:string"/>
<xs:element minOccurs="0" name="diaVencimento" type="xs:string"/>
<xs:element minOccurs="0" name="endereco" type="xs:string"/>
<xs:element minOccurs="0" name="enderecoBairro" type="xs:string"/>
<xs:element minOccurs="0" name="enderecoCEP" type="xs:string"/>
<xs:element minOccurs="0" name="enderecoCidade" type="xs:string"/>
<xs:element minOccurs="0" name="enderecoComplemento" type="xs:string"/>
<xs:element minOccurs="0" name="enderecoNumero" type="xs:string"/>
<xs:element minOccurs="0" name="enderecoUF" type="xs:string"/>
<xs:element minOccurs="0" name="estadoCivilDesc" type="xs:string"/>
<xs:element minOccurs="0" name="flagTipoFaturamento" type="xs:string"/>
<xs:element minOccurs="0" name="indClienteVip" type="xs:string"/>
<xs:element minOccurs="0" name="indClienteVipDesc" type="xs:string"/>
<xs:element minOccurs="0" name="indDebitoAutomatico" type="xs:string"/>
<xs:element minOccurs="0" name="indEstadoCivil" type="xs:string"/>
<xs:element minOccurs="0" name="indLimiteSegregado" type="xs:string"/>
<xs:element minOccurs="0" name="indSexo" type="xs:string"/>
<xs:element minOccurs="0" name="indicadorCartaoBloqueado" type="xs:string"/>
<xs:element minOccurs="0" name="indicadorCartaoOuConta" type="xs:string"/>
<xs:element minOccurs="0" name="indicadorCompraParcelada" type="xs:string"/>
<xs:element minOccurs="0" name="indicadorContato" type="xs:string"/>
<xs:element minOccurs="0" name="indicadorTeleSaque" type="xs:string"/>
<xs:element minOccurs="0" name="nomeMae" type="xs:string"/>
<xs:element minOccurs="0" name="nomeOrg" type="xs:string"/>
<xs:element minOccurs="0" name="nomePai" type="xs:string"/>
<xs:element minOccurs="0" name="nomePortator" type="xs:string"/>
<xs:element minOccurs="0" name="numCartaoAnterior" type="xs:string"/>
<xs:element minOccurs="0" name="numCartaoTitular" type="xs:string"/>
<xs:element minOccurs="0" name="numCelular1" type="xs:string"/>
<xs:element minOccurs="0" name="numCelular2" type="xs:string"/>
<xs:element minOccurs="0" name="numChpras" type="xs:string"/>
<xs:element minOccurs="0" name="numComercial" type="xs:string"/>
<xs:element minOccurs="0" name="numConta" type="xs:string"/>
<xs:element minOccurs="0" name="numCpfCnpj" type="xs:string"/>
<xs:element minOccurs="0" name="numOrg" type="xs:string"/>
<xs:element minOccurs="0" name="numRG" type="xs:string"/>
<xs:element minOccurs="0" name="numResidencial" type="xs:string"/>
<xs:element name="qtdAdicionais" type="xs:int"/>
<xs:element name="qtdCompraParceladaAtual" type="xs:int"/>
<xs:element name="qtdDiasAtrasoUltimaFatura" type="xs:int"/>
<xs:element minOccurs="0" name="qtdVezesFaturamentoConta" type="xs:string"/>
<xs:element name="saldoAFaturar" type="xs:double"/>
<xs:element name="saldoAntepenultimaFatura" type="xs:double"/>
<xs:element name="saldoCompraInter" type="xs:double"/>
<xs:element name="saldoFaturaFechada" type="xs:double"/>
<xs:element name="saldoInterFatura" type="xs:double"/>
<xs:element name="saldoInterUltimaFaturaFechada" type="xs:double"/>
<xs:element minOccurs="0" name="sexoDesc" type="xs:string"/>
<xs:element minOccurs="0" name="situacaoConta" type="xs:string"/>
<xs:element minOccurs="0" name="situacaoContaDesc" type="xs:string"/>
<xs:element name="taxaCashProxPeriodo" type="xs:double"/>
<xs:element name="taxaJurosProxPeriodo" type="xs:double"/>
<xs:element minOccurs="0" name="tipoCartao" type="xs:string"/>
<xs:element minOccurs="0" name="tipoPessoa" type="xs:string"/>
<xs:element minOccurs="0" name="tipoPortador" type="xs:string"/>
<xs:element minOccurs="0" name="tipoPortadorDesc" type="xs:string"/>
<xs:element name="totalCashAFaturar" type="xs:double"/>
<xs:element name="valorAtraso" type="xs:double"/>
<xs:element name="valorLimiteCash" type="xs:double"/>
<xs:element name="valorLimiteCashInter" type="xs:double"/>
<xs:element name="valorLimiteCredito" type="xs:double"/>
<xs:element name="valorLimiteCreditoInter" type="xs:double"/>
<xs:element name="valorLimiteDispCash" type="xs:double"/>
<xs:element name="valorLimiteDispCashInter" type="xs:double"/>
<xs:element name="valorLimiteDispCredito" type="xs:double"/>
<xs:element name="valorLimiteDispCreditoInter" type="xs:double"/>
<xs:element name="valorLimiteParcDisponivelSegregado" type="xs:double"/>
<xs:element name="valorLimiteParcTotalSegregado" type="xs:double"/>
<xs:element name="valorPagtoMinimoUltFatura" type="xs:double"/>
<xs:element name="valorUltimoPagamento" type="xs:double"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="consultarDados">
<wsdl:part element="tns:consultarDados" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Cadastro">
<wsdl:operation name="consultarDados">
<wsdl:input message="tns:consultarDados" name="consultarDados">
</wsdl:input>
<wsdl:output message="tns:consultarDadosResponse" name="consultarDadosResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CadastroServiceSoapBinding" type="tns:Cadastro">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="consultarDados">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="consultarDados">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="consultarDadosResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CadastroService">
<wsdl:port binding="tns:CadastroServiceSoapBinding" name="CadastroPort">
<soap:address location="http://myip...:myport/ws-myapp/cadastro"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Entire error:
demetrio#nodejs ~/dev/NodeJsSrc $ node consultaDados.js
/home/demetrio/dev/NodeJsSrc/consultaDados.js:9
client.CadastroService.CadastroServiceSoapBinding.consultarDados(args, function(err, result){
^
TypeError: Cannot read property 'consultarDados' of undefined
at /home/demetrio/dev/NodeJsSrc/consultaDados.js:9:54
at /home/demetrio/node_modules/soap/lib/soap.js:58:5
at null.callback (/home/demetrio/node_modules/soap/lib/soap.js:25:9)
at /home/demetrio/node_modules/soap/lib/wsdl.js:1073:12
at WSDL._processNextInclude (/home/demetrio/node_modules/soap/lib/wsdl.js:1148:12)
at WSDL.processIncludes (/home/demetrio/node_modules/soap/lib/wsdl.js:1191:8)
at /home/demetrio/node_modules/soap/lib/wsdl.js:1028:10
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
demetrio#nodejs ~/dev/NodeJsSrc $
How I am trying to read the soap web service (I basically followed the above example working)
var soap = require('soap');
var url = "http://myIp...:myPort/ws-myApp/cadastro?wsdl";
var args = {"tns:request":"GOOG"};
soap.createClient(url, function(err, client){
client.CadastroService.CadastroServiceSoapBinding.consultarDados(args, function(err, result){
if (err) throw err;
console.log(result);
});
});

Copying .xsd code into a wsdl

I have a wsdl that includes a couple of import schema statements, as follows:
<types>
**<xsd:schema>
<xsd:import namespace="http://quickfeedback.ws.cdb.skoda.vwg"
schemaLocation="CDBQuickFeedbackService_schema1.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://common.ws.cdb.skoda.vwg"
schemaLocation="CDBQuickFeedbackService_schema2.xsd"/>
</xsd:schema>**
I am using a tool (wsdl2rpg) that will create interfaces into the wsdl, but unfortunately, it does not support/recognise imports. Therefore I need to copy the code from the .xsd into the wsdl.
As a complete newbie to this, I am not sure exactly what code I should copy. Below is schema1, can somebody please advise what I should copy and where to ? I have tried a couple of times, with what I think are logical blocks etc., but they do not seem to work (i.e. the tool still does not pick up the copied code).
<?xml version="1.0" encoding="UTF-8"?><!--Generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build IBM 2.2.3-11/25/2013 12:35 PM(foreman)-)
See http://java.sun.com/xml/jaxb --><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://quickfeedback.ws.cdb.skoda.vwg" xmlns:ns1="http://common.ws.cdb.skoda.vwg" version="1.0" targetNamespace="http://quickfeedback.ws.cdb.skoda.vwg">
<xs:import namespace="http://common.ws.cdb.skoda.vwg" schemaLocation="CDBQuickFeedbackService_schema2.xsd"></xs:import>
<xs:element name="GetQuickFeedbackEventsRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="BID" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Brand" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Type" type="xs:integer" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuickFeedbackEventsResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="ResultSet" type="ns1:ResultSetType" minOccurs="0"></xs:element>
<xs:element name="EventSet" type="tns:QuickFeedbackEventSetType" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuickFeedbackResultsRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Date" type="xs:date" minOccurs="0"></xs:element>
<xs:element name="BID" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuickFeedbackResultsResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="QuickFeedbackResultSet" type="tns:QuickFeedbackResultSetType" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersCountRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="RejectionDate" type="xs:date" minOccurs="0"></xs:element>
<xs:element name="BID" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersCountResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="ResulSet" type="ns1:ResultSetType" minOccurs="0"></xs:element>
<xs:element name="Count" type="xs:int"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="RejectionDate" type="xs:date" minOccurs="0"></xs:element>
<xs:element name="BID" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="ResulSet" type="ns1:ResultSetType" minOccurs="0"></xs:element>
<xs:element name="DataSet" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Customer" type="tns:GetRejectedAgreementCustomerType" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="Count" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackEventsRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="EventSet" type="tns:QuickFeedbackEventSetType"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackEventsResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="ResultSet" type="ns1:ResultSetType" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackResultsRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="QuickFeedbackResultSet" type="tns:QuickFeedbackResultSetType" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackResultsResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="ResultSet" type="ns1:ResultSetType" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="GetRejectedAgreementCustomerType">
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Email" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Phone" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Details" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Detail" maxOccurs="unbounded">
<xs:complexType>
<xs:complexContent>
<xs:extension base="tns:QuickFeedbackCustomerType">
<xs:sequence>
<xs:element name="Date" type="xs:dateTime"></xs:element>
</xs:sequence>
<xs:attribute name="Number" type="xs:int"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Count" type="xs:int"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="Cars" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Car" type="tns:CarType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="Count" type="xs:int"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="StudyId" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="Period" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="SurveyNumber" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="DeliveryDate" type="xs:date" minOccurs="0"></xs:element>
<xs:element name="EventType" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="ReturnReason" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="QuestionnaireDate" type="xs:date" minOccurs="0"></xs:element>
</xs:sequence>
<xs:attribute name="Number" type="xs:int"></xs:attribute>
</xs:complexType>
<xs:complexType name="QuickFeedbackCustomerType">
<xs:sequence>
<xs:element name="Salutation" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Firstname" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Lastname" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Email" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Phone" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Street" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="City" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="PostalCode" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Country" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CarType">
<xs:sequence>
<xs:element name="Brand" type="xs:string"></xs:element>
<xs:element name="VIN" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Model" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="QuickFeedbackEventType">
<xs:sequence>
<xs:element name="StudyId" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="Period" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="SurveyNumber" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="Date" type="xs:dateTime"></xs:element>
<xs:element name="Type" type="xs:integer"></xs:element>
<xs:element name="Customer">
<xs:complexType>
<xs:complexContent>
<xs:extension base="tns:QuickFeedbackCustomerType">
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="Car" type="tns:CarType"></xs:element>
<xs:element name="Organization" type="tns:OrganizationType" minOccurs="0"></xs:element>
<xs:element name="Importer" type="tns:ImporterType"></xs:element>
<xs:element name="ManualImport" type="xs:integer"></xs:element>
</xs:sequence>
<xs:attribute name="Number" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
<xs:complexType name="OrganizationType">
<xs:sequence>
<xs:element name="Country" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Code" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="EngineerCode" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ImporterType">
<xs:sequence>
<xs:element name="BID" type="xs:string"></xs:element>
<xs:element name="Country" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="QuickFeedbackResultSetType">
<xs:sequence>
<xs:element name="QuickFeedbackResult" type="tns:QuickFeedbackResultType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="Count" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
<xs:complexType name="QuickFeedbackResultType">
<xs:sequence>
<xs:element name="StudyId" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="Period" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="SurveyNumber" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="DeliveryDate" type="xs:date" minOccurs="0"></xs:element>
<xs:element name="EventType" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="ReturnReason" type="xs:integer" minOccurs="0"></xs:element>
<xs:element name="QuestionnaireDate" type="xs:date" minOccurs="0"></xs:element>
<xs:element name="Customer" type="tns:CustomerIdType"></xs:element>
<xs:element name="BID" type="xs:string"></xs:element>
</xs:sequence>
<xs:attribute name="Number" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
<xs:complexType name="CustomerIdType">
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Email" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="Phone" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="QuickFeedbackEventSetType">
<xs:sequence>
<xs:element name="Event" type="tns:QuickFeedbackEventType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="Count" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
</xs:schema>
The <types> element may contain zero or various <xsd:schema> elements, and the content of each of those can be either an import of an external xsd file (or more than one) or the schema itself.
Note that in your schema1 you are also importing schema2.xsd
<xs:import namespace="http://common.ws.cdb.skoda.vwg" schemaLocation="CDBQuickFeedbackService_schema2.xsd"></xs:import>
In your case you have two options:
Create two schema elements inside types element
<definitions>
<types>
<xsd:schema>
<!-- content of schema2.xsd -->
</xsd:schema>
<xsd:schema>
<!-- content of schema1.xsd -->
</xsd:schema>
</types>
</definitions>
Create one combined schema element inside types element
This is also a straight-forward solution since you only have to dump the content of both xsd files into an element but you have to pay attention to the namespaces declared.
In schema1 you have these namespaces:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://common.ws.cdb.skoda.vwg"
targetNamespace="http://quickfeedback.ws.cdb.skoda.vwg"
xmlns:tns="http://quickfeedback.ws.cdb.skoda.vwg" >
ns1 was declared so you could use the types from that namespace, which refers to the targetnamespace of schema2.xsd. So if you open schema2.xsd you should see something like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://common.ws.cdb.skoda.vwg"
targetNamespace="http://common.ws.cdb.skoda.vwg"
xmlns:tns="http://common.ws.cdb.skoda.vwg" >
But now, since you are combining both schemas into one, you only need one targetnamespace and you already don't need ns1. So your wsdl should look like this:
<definitions>
<types>
<xs:schema targetNamespace="http://quickfeedback.ws.cdb.skoda.vwg" xmlns:tns="http://quickfeedback.ws.cdb.skoda.vwg" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Here copy the content of schema2.xsd without the <xs:schema>element -->
<xs:element name="GetQuickFeedbackEventsRequest">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="BID" type="xs:string"/>
<xs:element minOccurs="0" name="Brand" type="xs:string"/>
<xs:element minOccurs="0" name="Type" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuickFeedbackEventsResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ResultSet" type="tns:ResultSetType"/>
<xs:element minOccurs="0" name="EventSet" type="tns:QuickFeedbackEventSetType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuickFeedbackResultsRequest">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="Date" type="xs:date"/>
<xs:element minOccurs="0" name="BID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetQuickFeedbackResultsResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="QuickFeedbackResultSet" type="tns:QuickFeedbackResultSetType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersCountRequest">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="RejectionDate" type="xs:date"/>
<xs:element minOccurs="0" name="BID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersCountResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ResulSet" type="tns:ResultSetType"/>
<xs:element name="Count" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersRequest">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="RejectionDate" type="xs:date"/>
<xs:element minOccurs="0" name="BID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetRejectedAgreementCustomersResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ResulSet" type="tns:ResultSetType"/>
<xs:element minOccurs="0" name="DataSet">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="Customer" type="tns:GetRejectedAgreementCustomerType"/>
</xs:sequence>
<xs:attribute name="Count" type="xs:int" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackEventsRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="EventSet" type="tns:QuickFeedbackEventSetType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackEventsResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ResultSet" type="tns:ResultSetType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackResultsRequest">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="QuickFeedbackResultSet" type="tns:QuickFeedbackResultSetType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="InsertQuickFeedbackResultsResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ResultSet" type="tns:ResultSetType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="GetRejectedAgreementCustomerType">
<xs:sequence>
<xs:element minOccurs="0" name="ID" type="xs:string"/>
<xs:element minOccurs="0" name="Email" type="xs:string"/>
<xs:element minOccurs="0" name="Phone" type="xs:string"/>
<xs:element minOccurs="0" name="Details">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Detail">
<xs:complexType>
<xs:complexContent>
<xs:extension base="tns:QuickFeedbackCustomerType">
<xs:sequence>
<xs:element name="Date" type="xs:dateTime"/>
</xs:sequence>
<xs:attribute name="Number" type="xs:int"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Count" type="xs:int"/>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="Cars">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Car" type="tns:CarType"/>
</xs:sequence>
<xs:attribute name="Count" type="xs:int"/>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="StudyId" type="xs:integer"/>
<xs:element minOccurs="0" name="Period" type="xs:integer"/>
<xs:element minOccurs="0" name="SurveyNumber" type="xs:integer"/>
<xs:element minOccurs="0" name="DeliveryDate" type="xs:date"/>
<xs:element minOccurs="0" name="EventType" type="xs:integer"/>
<xs:element minOccurs="0" name="ReturnReason" type="xs:integer"/>
<xs:element minOccurs="0" name="QuestionnaireDate" type="xs:date"/>
</xs:sequence>
<xs:attribute name="Number" type="xs:int"/>
</xs:complexType>
<xs:complexType name="QuickFeedbackCustomerType">
<xs:sequence>
<xs:element minOccurs="0" name="Salutation" type="xs:string"/>
<xs:element minOccurs="0" name="Firstname" type="xs:string"/>
<xs:element minOccurs="0" name="Lastname" type="xs:string"/>
<xs:element minOccurs="0" name="Email" type="xs:string"/>
<xs:element minOccurs="0" name="Phone" type="xs:string"/>
<xs:element minOccurs="0" name="Street" type="xs:string"/>
<xs:element minOccurs="0" name="City" type="xs:string"/>
<xs:element minOccurs="0" name="PostalCode" type="xs:string"/>
<xs:element minOccurs="0" name="Country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CarType">
<xs:sequence>
<xs:element name="Brand" type="xs:string"/>
<xs:element minOccurs="0" name="VIN" type="xs:string"/>
<xs:element minOccurs="0" name="Model" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="QuickFeedbackEventType">
<xs:sequence>
<xs:element minOccurs="0" name="StudyId" type="xs:integer"/>
<xs:element minOccurs="0" name="Period" type="xs:integer"/>
<xs:element minOccurs="0" name="SurveyNumber" type="xs:integer"/>
<xs:element name="Date" type="xs:dateTime"/>
<xs:element name="Type" type="xs:integer"/>
<xs:element name="Customer">
<xs:complexType>
<xs:complexContent>
<xs:extension base="tns:QuickFeedbackCustomerType">
<xs:sequence>
<xs:element minOccurs="0" name="ID" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="Car" type="tns:CarType"/>
<xs:element minOccurs="0" name="Organization" type="tns:OrganizationType"/>
<xs:element name="Importer" type="tns:ImporterType"/>
<xs:element name="ManualImport" type="xs:integer"/>
</xs:sequence>
<xs:attribute name="Number" type="xs:int" use="required"/>
</xs:complexType>
<xs:complexType name="OrganizationType">
<xs:sequence>
<xs:element minOccurs="0" name="Country" type="xs:string"/>
<xs:element minOccurs="0" name="Code" type="xs:string"/>
<xs:element minOccurs="0" name="EngineerCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ImporterType">
<xs:sequence>
<xs:element name="BID" type="xs:string"/>
<xs:element minOccurs="0" name="Country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="QuickFeedbackResultSetType">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="QuickFeedbackResult" type="tns:QuickFeedbackResultType"/>
</xs:sequence>
<xs:attribute name="Count" type="xs:int" use="required"/>
</xs:complexType>
<xs:complexType name="QuickFeedbackResultType">
<xs:sequence>
<xs:element minOccurs="0" name="StudyId" type="xs:integer"/>
<xs:element minOccurs="0" name="Period" type="xs:integer"/>
<xs:element minOccurs="0" name="SurveyNumber" type="xs:integer"/>
<xs:element minOccurs="0" name="DeliveryDate" type="xs:date"/>
<xs:element minOccurs="0" name="EventType" type="xs:integer"/>
<xs:element minOccurs="0" name="ReturnReason" type="xs:integer"/>
<xs:element minOccurs="0" name="QuestionnaireDate" type="xs:date"/>
<xs:element name="Customer" type="tns:CustomerIdType"/>
<xs:element name="BID" type="xs:string"/>
</xs:sequence>
<xs:attribute name="Number" type="xs:int" use="required"/>
</xs:complexType>
<xs:complexType name="CustomerIdType">
<xs:sequence>
<xs:element minOccurs="0" name="ID" type="xs:string"/>
<xs:element minOccurs="0" name="Email" type="xs:string"/>
<xs:element minOccurs="0" name="Phone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="QuickFeedbackEventSetType">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Event" type="tns:QuickFeedbackEventType"/>
</xs:sequence>
<xs:attribute name="Count" type="xs:int" use="required"/>
</xs:complexType>
</xs:schema>
Unless schema2.xsd imports a third schema or it has something special I think this should work.
Just in case you have any issue with the copied content from schema2, note that now in this combined schema you only have one namespace prefix, and that is xs, you already don't have neither xsd nor ns1.
If you get all this headers right, the rest should give you no trouble since it's only a copy-pasted list of <xs:element> and <xs;complexType>.
Hope it helped.
Btw, what are those 2 asterisks in your wsdl before and after <xsd:schema>?

Validate repeating optional elements XML-Schema

I am try to create an xsd schema that validates the following xml:
<results>
<row>
<PersonID key="true">1</PersonID>
<FirstName>John</FirstName>
<Surname>Smith</Surname>
<LogonName>jsmith</LogonName>
</row>
<row>
<PersonID key="true">2</PersonID>
<FirstName>Steve</FirstName>
<Surname>Jones</Surname>
<LogonName>sjones</LogonName>
</row>
The results node and row node are mandatory, but the nodes inside each row are optional and may have other nodes that I have not listed. There could 1 row or many rows.
I have created the below but I am unable to validate correctly:
<xs:element name="results">
<xs:complexType>
<xs:sequence>
<xs:element name="row" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PersonID" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:byte">
<xs:attribute type="xs:string" name="key" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:choice minOccurs="0">
<xs:element type="xs:string" name="FirstName" minOccurs="0"/>
<xs:element type="xs:string" name="Surname" minOccurs="0"/>
<xs:element type="xs:string" name="LogonName" minOccurs="0"/>
<xs:element type="xs:string" name="GroupName" minOccurs="0"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
Thanks.
If PersonID, FirstName etc. can occurr at most once - and in that specific order - try this:
<xs:element name="results">
<xs:complexType>
<xs:sequence>
<xs:element name="row" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="PersonID" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:byte">
<xs:attribute type="xs:string" name="key" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element type="xs:string" name="FirstName" minOccurs="0"/>
<xs:element type="xs:string" name="Surname" minOccurs="0"/>
<xs:element type="xs:string" name="LogonName" minOccurs="0"/>
<xs:element type="xs:string" name="GroupName" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
(basically just drop the choice element). If PersonID, FirstName etc. can occurr at most once but in any order you can use all:
<xs:element name="results">
<xs:complexType>
<xs:sequence>
<xs:element name="row" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:all>
<xs:element name="PersonID" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:byte">
<xs:attribute type="xs:string" name="key" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element type="xs:string" name="FirstName" minOccurs="0"/>
<xs:element type="xs:string" name="Surname" minOccurs="0"/>
<xs:element type="xs:string" name="LogonName" minOccurs="0"/>
<xs:element type="xs:string" name="GroupName" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
If you don't know elements can occur within row you can use:
<xs:element name="results">
<xs:complexType>
<xs:sequence>
<xs:element name="row" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
that accepts any element within row.

Creating multiple element name with sequence.

Below is the sample xml which has multiple <rulex> that starts with sequence 1 and it can end up to many rule like <rule1> , <rule2>, <rule3> etc....
<?xml version="1.0" encoding="UTF-8"?>
<AddressChange_181>
<rules>
<rule1>
<conditions>xya</conditions>
<response_path>abc</response_path>
</rule1>
<rule2>
<conditions>xxxx</conditions>
<response_path>aaaa</response_path>
</rule2>
<rule3>
<conditions>yyyyy</conditions>
<response_path>ffff</response_path>
</rule3>
<rule4>
<conditions>zzzz</conditions>
<response_path>yyyy</response_path>
</rule4>
<default>
<response_path>uuuuu</response_path>
</default>
</rules>
</AddressChange_181>
Below is the schema where i tried creating dynamic <rulex> element name for the above xml.
when i generate xml from this schema i do not get the same xml format as above xml.
can you please let me know how to create schema with multiple element name that starts with a sequence number.
My requirement is to add more than one rule (<rule1>,<rule2>,<rule3> etc...) in xml file and this xml file should be validated against schema.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="mock_rule_list">
<xs:complexType>
<xs:sequence>
<xs:element ref="rules" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="rules">
<xs:complexType>
<xs:sequence>
<xs:element ref="rule" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="default" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="rule">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="xs:anyType">
<xs:pattern value="rule/d{1,3}"></xs:pattern>
</xs:restriction>
</xs:simpleContent>
<xs:sequence>
<xs:element ref="conditions" minOccurs="1" maxOccurs="1"/>
<xs:element ref="response_path" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="default">
<xs:complexType>
<xs:sequence>
<xs:element ref="response_path"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="conditions" type="xs:string">
</xs:element>
<xs:element name="response_path" type="xs:string"/>
</xs:schema>
Thanks,
Madhu
There is no way to define such a structure using XSD if the number of ruleX tags is arbitrarily defined. If you can constrain the upper bound to a maximum, and you really have to stick with ruleX naming convention, than you can define a complex type such as ruleType, then a bunch of rule1, rule2,... , ruleN elements of that type - I would call this messy... I wouldn't recommend this.
XSD (with a maximum of 6):
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="mock_rule_list">
<xs:complexType>
<xs:sequence>
<xs:element ref="rules" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="rules">
<xs:complexType>
<xs:sequence>
<xs:element ref="rule1" minOccurs="0"/>
<xs:element ref="rule2" minOccurs="0"/>
<xs:element ref="rule3" minOccurs="0"/>
<xs:element ref="rule4" minOccurs="0"/>
<xs:element ref="rule5" minOccurs="0"/>
<xs:element ref="rule6" minOccurs="0"/>
<xs:element ref="default"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ruleType">
<xs:sequence>
<xs:element ref="conditions" minOccurs="1" maxOccurs="1"/>
<xs:element ref="response_path" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:element name="default">
<xs:complexType>
<xs:sequence>
<xs:element ref="response_path"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="conditions" type="xs:string">
</xs:element>
<xs:element name="response_path" type="xs:string"/>
<xs:element name="rule1" type="ruleType"/>
<xs:element name="rule2" type="ruleType"/>
<xs:element name="rule3" type="ruleType"/>
<xs:element name="rule4" type="ruleType"/>
<xs:element name="rule5" type="ruleType"/>
<xs:element name="rule6" type="ruleType"/>
</xs:schema>
Alternatively, you could have a tag named "rule" with a #sequence attribute.
XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="mock_rule_list">
<xs:complexType>
<xs:sequence>
<xs:element ref="rules" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="rules">
<xs:complexType>
<xs:sequence>
<xs:element ref="rule" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="default"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="SequenceKey">
<xs:selector xpath="rule"/>
<xs:field xpath="#sequence"/>
</xs:unique>
</xs:element>
<xs:complexType name="ruleType">
<xs:sequence>
<xs:element ref="conditions" minOccurs="1" maxOccurs="1"/>
<xs:element ref="response_path" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="sequence" type="xs:int" use="required"/>
</xs:complexType>
<xs:element name="default">
<xs:complexType>
<xs:sequence>
<xs:element ref="response_path"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="conditions" type="xs:string">
</xs:element>
<xs:element name="response_path" type="xs:string"/>
<xs:element name="rule" type="ruleType"/>
</xs:schema>
Sample XML:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<rules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<rule sequence="1">
<conditions>conditions1</conditions>
<response_path>response_path1</response_path>
</rule>
<rule sequence="2">
<conditions>conditions2</conditions>
<response_path>response_path2</response_path>
</rule>
<default>
<response_path>response_path1</response_path>
</default>
</rules>
Or it could also be that one could simply use the index of the <rule/> within the parent collection .

Nested sequence in XSD

I would like to validate this XML:
<meta>
<house>
<big ... />
<little ... />
<big ... />
</house>
<flat>
<red ... />
<red ... />
<yellow ... />
</flat>
</meta>
I wrote that.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="meta">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="house">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name='big' />
<xs:element name='little' />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="flat">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name='red'/>
<xs:element name='yellow'/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
But that does not validate my example.
Without 'house' or 'flat', and only meta, that worked.
Where could be my problem ?
Found !
The solution: add a "xs:choice" for each "xs:sequence", like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="meta">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name="house">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name='big' />
<xs:element name='little' />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="flat">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:choice>
<xs:element name='red'/>
<xs:element name='yellow'/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

Resources