How do we call one element into other in XSLT? - xslt

I am new to stackverflow and hoping I will get right direction for my current issue. I have XSD input and i am writing xslt for this input and was trying to call one element into other one's and for some reason it is not working.
following is my XSD input,
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:ts="http://schemas.capeclear.com/2003/02/TextSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" ts:eofStrip="&#10;"
targetNamespace="http://textschema/ABC_Indirect_Deductions_WIP/MediaOut.xsd"
xmlns:tns="http://textschema/ABC_Indirect_Deductions_WIP/MediaOut.xsd"
ts:numberFormat="#,###.#" ts:rootElement="tns:File">
<xsd:element name="File">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Vendor_Data" ts:align="left" minOccurs="0"
maxOccurs="1" ts:endTag="\n" ts:startTag="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Vendor_ID" type="xsd:string"
ts:fixedLength="5" />
<xsd:element name="Assignment_ID" type="xsd:string"
ts:fixedLength="6" />
<xsd:element name="Begin_Date" type="xsd:string"
ts:fixedLength="8" />
<xsd:element name="Assigned_Date_Time"type="xsd:string"
ts:fixedLength="20" />
<xsd:element name="Sender_Code" type="xsd:string"
ts:fixedLength="2" />
<xsd:element name="Level_Flag"
type="xsd:string" ts:fixedLength="1" />
<xsd:element name="Filler1" type="xsd:string" ts:fixedLength="76"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Applicant_Data" ts:align="left" minOccurs="0" maxOccurs="unbounded"
ts:endTag="\n" ts:startTag="2">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Class_ID" type="xsd:string"
ts:fixedLength="6" minOccurs="0" />
<xsd:element name="Applicant_ID" type="xsd:string"
ts:fixedLength="9" minOccurs="0" />
<xsd:element name="Personal_Number" type="xsd:string"
ts:fixedLength="15" minOccurs="0" />
<xsd:element name="Effective_Date" type="xsd:string"
ts:fixedLength="8" minOccurs="0" ts:align="left" />
<xsd:element name="Transfer_Type" type="xsd:string"
ts:fixedLength="3" minOccurs="0" />
<xsd:element name="Deduction_Percent" type="xsd:integer"
ts:fixedLength="5" minOccurs="0" />
<xsd:element name="End_Date" type="xsd:string"
ts:fixedLength="8" minOccurs="0" />
<xsd:element name="Availability_Date" type="xsd:string"
ts:fixedLength="8" minOccurs="0" />
<xsd:element name="Participant_Name" type="xsd:string"
ts:fixedLength="30" minOccurs="0" />
<xsd:element name="Allocation10" type="xsd:string"
ts:fixedLength="2" minOccurs="0" ts:align="left"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Pay_Data" ts:align="left" minOccurs="0"
maxOccurs="unbounded" ts:endTag="\n" ts:startTag="091341">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Payrate_Rate" type="xsd:string" ts:fixedLength="7" minOccurs="0" />
<xsd:element name="Pay_Date" type="xsd:string" ts:fixedLength="6" minOccurs="0" />
<xsd:element name="Payments" type="xsd:string" ts:fixedLength="5" minOccurs="0" />
<xsd:element name="Payment_Amount" type="xsd:string" ts:fixedLength="11" minOccurs="0" />
<xsd:element name="Member_ID" type="xsd:string" ts:fixedLength="13" minOccurs="0" />
<xsd:element name="Frequency" type="xsd:string" ts:fixedLength="1" minOccurs="0" />
<xsd:element name="Veteran_Name" type="xsd:string" ts:fixedLength="30" minOccurs="0" />
<xsd:element name="Country" type="xsd:string" ts:fixedLength="10" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
And following is my xslt, i am trying to call element begin date from vendor data element into other two element called Applicant_Data and Pay_data but seems it is not working as needed and hence reaching out for any help or assistance on this.
Following is the XSLT I have written for this and let me know for any changes if needed on this to have begin date called into other element named Applicant_Data and Pay_data.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:template match="Vendor_Data">
<xsl:call-template name="vendor_tokenize" />
</xsl:template>
<xsl:template match="Applicant_Data">
<xsl:call-template name="applicant_tokenize" />
</xsl:template>
<xsl:template match="Pay_Data">
<xsl:call-template name="pay_tokenize" />
</xsl:template>
<xsl:template name="vendor_tokenize">
<xsl:element name="Start_Date">
<xsl:variable name="MM"
select="substring(Begin_Date,5,2)" />
<xsl:variable name="DD"
select="substring(Begin_Date,7,2)" />
<xsl:variable name="YYYY"
select="substring(Begin_Date,1,4)" />
<xsl:value-of select="normalize-space(concat($YYYY,'-',$MM,'-',$DD))" />
</xsl:element>
</xsl:template>
<xsl:template name="applicant_tokenize">
<xsl:element name="Applicant">
<xsl:element name="Applicant_ID">
<xsl:value-of select="normalize-space(Applicant_ID)" />
</xsl:element>
<xsl:element name="Personal_Number">
<xsl:value-of select="normalize-space(Personal_Number)" />
</xsl:element>
<xsl:element name="Event_Date">
<xsl:variable name="MM"
select="substring(Effective_Date,5,2)" />
<xsl:variable name="DD"
select="substring(Effective_Date,7,2)" />
<xsl:variable name="YYYY"
select="substring(Effective_Date,1,4)" />
<xsl:value-of select="normalize-space(concat($YYYY,'-',$MM,'-',$DD))" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="pay_tokenize">
<xsl:element name="Pay_Date">
<xsl:element name="Pay_Date">
<xsl:variable name="MM" select="substring(Pay_Date,3,2)" />
<xsl:variable name="DD" select="substring(Pay_Date,5,2)" />
<xsl:variable name="YY" select="substring(Pay_Date,1,2)" />
<xsl:value-of select="normalize-space(concat('20',$YY,'-',$MM,'-',$DD))" />
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
INPUT DATA FILE
0135091341202104032021-04-02.00.04.31 02TGT
3012 3245678 802275 20210414EEE0162021021520210215ALEX, RONALD FG
091341 20210414 277 16677 802275 2 ALEX, RONALD USA
Let me know for any additional information if needed on this.

Related

How to remove unused namespaces from xsd using xslt. Keeping schema reference namespaces entact

I have an xsd file such as :-
<?xml version="1.0" encoding="UTF-8"?>
<xsd:element xmlns:ns2="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-End.xsd"
xmlns:ns="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-Map Data.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:pd="http://xmlns.tibco.com/bw/process/2003"
xmlns:ns="http://www.tibco.com/namespaces/tnt/plugins/jms"
name="group">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="a" type="xsd:string" minOccurs="0"/>
<xsd:element name="b" type="xsd:string" minOccurs="0"/>
<xsd:element name="c" type="xsd:string" minOccurs="0"/>
<xsd:element name="d" type="xsd:string" minOccurs="0"/>
<xsd:element name="e" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element ref="ns:root"/>
<xsd:element ref="ns2:root"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
This contains some un used namespaces, can any one explain how to achieve it with xslt:-
the output desired is :- Please note the namespaces which are used for schema references should be entact.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:element xmlns:ns2="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-End.xsd"
xmlns:ns="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-Map Data.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="group">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="a" type="xsd:string" minOccurs="0"/>
<xsd:element name="b" type="xsd:string" minOccurs="0"/>
<xsd:element name="c" type="xsd:string" minOccurs="0"/>
<xsd:element name="d" type="xsd:string" minOccurs="0"/>
<xsd:element name="e" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element ref="ns:root"/>
<xsd:element ref="ns2:root"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Use exclude-result-prefixes in xslt declaration
In XSLT 2.0, you can do <xsl:copy-of select="/" copy-namespaces="no"/> which will copy the entire document, excluding any namespaces that aren't used in element or attribute names. However, it might remove namespaces that are used only in attribute content, for example ref="ns2:root". Detecting those cases reliably is quite tricky, especially if they are used inside XPath expressions (e.g. in xs:key and xs:keyref constraints).
If you want to remove all "unused" namespaces except those in a $retain list, you could do something like (again XSLT 2.0):
<xsl:template match="*">
<xsl:copy copy-namespaces="no">
<xsl:copy-of select="#*"/>
<xsl:copy-of select="namespace::*[not(name()=$retain)]"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
and you could perhaps initialize $retain to contain all strings in the stylesheet that match [A-Za-z0-9]:, minus the colon.

XSLT script to match pattern a particular element instance within a specific parent Complextype

I have a schema which is something like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="1.28.0">
<xsd:complexType name="AccountsReceivableInfo_Type">
<xsd:sequence>
<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
<xsd:complexType name="AccountsDeleteInfo_Type">
<xsd:sequence>
<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
and I am trying to modify it and write an XSLT script to:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="1.28.0">
<xsd:complexType name="AccountsReceivableInfo_Type">
<xsd:sequence>
<!--<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>-->
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
<xsd:complexType name="AccountsDeleteInfo_Type">
<xsd:sequence>
<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
XSLT script which i wrote so far is
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="xsd:complexType[#name='AccountsReceivableInfo_Type']
/xsd:element[#ref ='SourceIncomePct']">
<xsl:text disable-output-escaping="yes"><!--</xsl:text>
<xsl:sequence select="."/>
<xsl:text disable-output-escaping="yes">--></xsl:text>
</xsl:template>
<xsl:template match="#*|node()">
<xsl:copy><xsl:apply-templates select="#*|node()"/></xsl:copy>
</xsl:template>
</xsl:transform>
What I am trying to do is to modify a big schema like above and automate it and need to read a particular element within a particular complextype parent and modify only that instance like commenting it out.
If you want to put the element into a comment consider to move to XSLT 3.0 and use
<xsl:template match="xsd:complexType[#name='AccountsReceivableInfo_Type']/xsd:sequence/xsd:element[#ref ='SourceIncomePct']">
<xsl:comment select="serialize(.)"/>
</xsl:template>

Delphi Soap Web Services with xsd shema

First Of All sorry about my bad English :D and Thanks for your help...
I have to write a Delphi web service with xsd schema and the wsdl similar to wsdl at the bottom. Is it possible with Delphi. I have to write a service according to the existing web service client, the wsdl at the bottom belongs to an php web service with nusoap library.
I seem to hear you write this web service with php nusoap, but as you know that Delphi web service can be standalone exe and I need it's ability for our product.
I can write this web service with php no problem, but if it is possible, I want to write this web service with Delphi as a standalone.
I could write this web service with Delphi as standalone.The problem is that WSDL. My service's WSDL have to similar with the WSDL at the bottom. Can I do my service's wsdl similar to wsdl at the bottom? If it is possible,how can I do?
I'm using Delphi XE4.
Thanks again.
<?xml version="1.0" encoding="windows-1252"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:wnposwsdl2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wnposwsdl2">
<types>
<xsd:schema targetNamespace="urn:wnposwsdl2">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
<xsd:complexType name="wnposreply">
<xsd:all>
<xsd:element name="rtype" type="xsd:string"/>
<xsd:element name="rid" type="xsd:string"/>
<xsd:element name="rval1" type="xsd:string"/>
<xsd:element name="rval2" type="xsd:string"/>
<xsd:element name="rmessage1" type="xsd:string"/>
<xsd:element name="rmessage2" type="xsd:string"/>
<xsd:element name="rmessage3" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="posregister">
<xsd:all>
<xsd:element name="serialno" type="xsd:string"/>
<xsd:element name="posid" type="xsd:string"/>
<xsd:element name="siteid" type="xsd:string"/>
<xsd:element name="sitename" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="customercard">
<xsd:all>
<xsd:element name="cctype" type="xsd:string"/>
<xsd:element name="customercode" type="xsd:string"/>
<xsd:element name="ccnumber" type="xsd:string"/>
<xsd:element name="validfrom" type="xsd:string"/>
<xsd:element name="validto" type="xsd:string"/>
<xsd:element name="pin" type="xsd:string"/>
<xsd:element name="ccstatus" type="xsd:string"/>
<xsd:element name="total_d" type="xsd:float"/>
<xsd:element name="total_c" type="xsd:float"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="customer">
<xsd:all>
<xsd:element name="code" type="xsd:string"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="address1" type="xsd:string"/>
<xsd:element name="address2" type="xsd:string"/>
<xsd:element name="county" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="zip" type="xsd:string"/>
<xsd:element name="tel" type="xsd:string"/>
<xsd:element name="gsm" type="xsd:string"/>
<xsd:element name="email" type="xsd:string"/>
<xsd:element name="web" type="xsd:string"/>
<xsd:element name="listprice" type="xsd:string"/>
<xsd:element name="defdiscount" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="payment">
<xsd:all>
<xsd:element name="id" type="xsd:int"/>
<xsd:element name="val" type="xsd:float"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ccard">
<xsd:all>
<xsd:element name="customercard" type="tns:customercard"/>
<xsd:element name="customer" type="tns:customer"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ccardarray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:ccard[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="customertrans">
<xsd:all>
<xsd:element name="ccnumber" type="xsd:string"/>
<xsd:element name="posserialno" type="xsd:string"/>
<xsd:element name="ftransid" type="xsd:string"/>
<xsd:element name="ftype" type="xsd:string"/>
<xsd:element name="ftm" type="xsd:string"/>
<xsd:element name="fno" type="xsd:string"/>
<xsd:element name="excode" type="xsd:string"/>
<xsd:element name="genexp" type="xsd:string"/>
<xsd:element name="sign" type="xsd:string"/>
<xsd:element name="amount" type="xsd:float"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="customertransarray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:customertrans[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="payments">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:payment[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="itemtrans">
<xsd:all>
<xsd:element name="ttype" type="xsd:string"/>
<xsd:element name="subtype" type="xsd:string"/>
<xsd:element name="code" type="xsd:string"/>
<xsd:element name="quantity" type="xsd:float"/>
<xsd:element name="bprice" type="xsd:float"/>
<xsd:element name="itemgroupcode" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="itemtransarray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:itemtrans[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="receiptheader">
<xsd:all>
<xsd:element name="fno" type="xsd:string"/>
<xsd:element name="ftm" type="xsd:string"/>
<xsd:element name="siteid" type="xsd:string"/>
<xsd:element name="customercard" type="tns:customercard"/>
<xsd:element name="payments" type="tns:payments"/>
<xsd:element name="nettotal" type="xsd:float"/>
<xsd:element name="calculatedtotalpoint" type="xsd:float"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="receipt">
<xsd:all>
<xsd:element name="ftransid" type="xsd:int"/>
<xsd:element name="serialno" type="xsd:string"/>
<xsd:element name="ctranstype" type="xsd:string"/>
<xsd:element name="header" type="tns:receiptheader"/>
<xsd:element name="items" type="tns:itemtransarray"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="receiptarray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:receipt[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="spendingcheck">
<xsd:all>
<xsd:element name="ctrans" type="tns:customertrans"/>
<xsd:element name="basket" type="tns:receipt"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<message name="register_posRequest">
<part name="posrecord" type="tns:posregister"/></message>
<message name="register_posResponse">
<part name="return" type="tns:wnposreply"/></message>
<message name="query_cardRequest">
<part name="customercard" type="tns:customercard"/></message>
<message name="query_cardResponse">
<part name="return" type="tns:wnposreply"/></message>
<message name="register_customerRequest">
<part name="ccardarray" type="tns:ccardarray"/></message>
<message name="register_customerResponse">
<part name="return" type="tns:wnposreply"/></message>
<message name="check_receiptRequest">
<part name="receipt" type="tns:receiptarray"/></message>
<message name="check_receiptResponse">
<part name="return" type="tns:wnposreply"/></message>
<message name="add_ctransRequest">
<part name="customertrans" type="tns:customertrans"/></message>
<message name="add_ctransResponse">
<part name="return" type="tns:wnposreply"/></message>
<message name="update_ctransRequest">
<part name="customertrans" type="tns:customertrans"/></message>
<message name="update_ctransResponse">
<part name="return" type="tns:wnposreply"/></message>
<message name="add_spendingRequest">
<part name="spendingcheck" type="tns:spendingcheck"/></message>
<message name="add_spendingResponse">
<part name="return" type="tns:wnposreply"/></message>
<portType name="wnposwsdl2PortType">
<operation name="register_pos">
<documentation>Register pos...</documentation>
<input message="tns:register_posRequest"/>
<output message="tns:register_posResponse"/>
</operation>
<operation name="query_card">
<documentation>Query customer card...</documentation>
<input message="tns:query_cardRequest"/>
<output message="tns:query_cardResponse"/>
</operation>
<operation name="register_customer">
<documentation>Registers customer(s)/card(s)/giftcard(s) to be used by the server, approval required by the db manager....</documentation>
<input message="tns:register_customerRequest"/>
<output message="tns:register_customerResponse"/>
</operation>
<operation name="check_receipt">
<documentation>Check receipt for gift or point collection..</documentation>
<input message="tns:check_receiptRequest"/>
<output message="tns:check_receiptResponse"/>
</operation>
<operation name="add_ctrans">
<documentation>Add trans..</documentation>
<input message="tns:add_ctransRequest"/>
<output message="tns:add_ctransResponse"/>
</operation>
<operation name="update_ctrans">
<documentation>Update added trans change stage...</documentation>
<input message="tns:update_ctransRequest"/>
<output message="tns:update_ctransResponse"/>
</operation>
<operation name="add_spending">
<documentation>Add spending ..</documentation>
<input message="tns:add_spendingRequest"/>
<output message="tns:add_spendingResponse"/>
</operation>
</portType>
<binding name="wnposwsdl2Binding" type="tns:wnposwsdl2PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="register_pos">
<soap:operation soapAction="urn:wnposwsdl2#register_pos" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="query_card">
<soap:operation soapAction="urn:wnposwsdl2#query_card" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="register_customer">
<soap:operation soapAction="urn:wnposwsdl2#register_customer" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="check_receipt">
<soap:operation soapAction="urn:wnposwsdl2#check_receipt" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="add_ctrans">
<soap:operation soapAction="urn:wnposwsdl2#customertrans" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="update_ctrans">
<soap:operation soapAction="urn:wnposwsdl2#customertrans" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="add_spending">
<soap:operation soapAction="urn:wnposwsdl2#spendingcheck" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:wnposwsdl2" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
<service name="wnposwsdl2">
<port name="wnposwsdl2Port" binding="tns:wnposwsdl2Binding">
<soap:address location="http://ksistemdomain.com:88/web.biz/server/wnposserver.php"/>
</port>
</service>
</definitions>
Sure, you can use Delphi to write a SOAP Service out of your wsdl file.
then you can use the result dll to call your service.
you can check out this link for more info.

How can I debug QXmlSchema's load method?

I'm trying to load the following XML Schema with QXmlSchema, however QXmlSchema::load(const QUrl & source) always returns false. Is there any way to have Qt provide some about what actually went wrong? The schema checks out fine in several validators as far as I can tell (the w3c one provided mysterious output that looked like it passed).
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="message">
<xsd:complexType>
<xsd:choice>
<xsd:element name="login-reply">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Accepted" />
<xsd:enumeration value="Rejected" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="login-request" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="username" type="xsd:string" nillable="false"/>
<xsd:element name="password" type="xsd:string" nillable="false"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="logout-request">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="username" type="xsd:string" nillable="false"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="logout-reply">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Accepted" />
<xsd:enumeration value="Rejected" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="tasklist-request" />
<xsd:element name="tasklist-reply">
<xsd:complexType>
<xsd:sequence minOccurs="1">
<xsd:element name="package" minOccurs="1" nillable="false">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="taskgroup" minOccurs="1" nillable="false">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="id" type="xsd:integer" minOccurs="1" />
<xsd:element name="task" type="xsd:string" minOccurs="1" />
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="starttask-request">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="task-id" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="starttask-reply">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Accepted" />
<xsd:enumeration value="Rejected" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
bool QXmlSchema::load() itself returns only boolean result that is not really useful for debugging. But there this is more better way to get more appropriate error message.
You could use method void QXmlSchema::setMessageHandler(QAbstractMessageHandler *handler).
Here is example from my project.
First subclassing QAbstractMessageHandler
class MessageHandler : public QAbstractMessageHandler
{
public:
MessageHandler()
: QAbstractMessageHandler(),
m_messageType(QtMsgType()),
m_description(),
m_sourceLocation(QSourceLocation())
{}
QString statusMessage() const
{
return m_description;
}
qint64 line() const
{
return m_sourceLocation.line();
}
qint64 column() const
{
return m_sourceLocation.column();
}
protected:
virtual void handleMessage(QtMsgType type,
const QString &description,
const QUrl &identifier,
const QSourceLocation &sourceLocation) Q_DECL_OVERRIDE
{
Q_UNUSED(type);
Q_UNUSED(identifier);
m_messageType = type;
m_description = description;
m_sourceLocation = sourceLocation;
}
private:
QtMsgType m_messageType;
QString m_description;
QSourceLocation m_sourceLocation;
};
Then before loading set message handler.
QFile file("myschema.xsd");
file.open(QIODevice::ReadOnly);
MessageHandler messageHandler;
QXmlSchema sch;
sch.setMessageHandler(&messageHandler);
if (sch.load(&file, QUrl::fromLocalFile(file.fileName()))==false)
{
QString error = messageHandler.statusMessage();
qint64 line = messageHandler.line();
qint64 column = messageHandler.column();
/*Do what need if error*/
}
bool QXmlSchema::load() returns false on multiple conditions according to this source documentation
So the answer to my question: No, there is no way to get an error message from Qts parser per Qt 4.7.3 and there is no way via Qts APIs to differentiate between an I/O error and a schema error, since load returns false on both.

xs:choice embedded in xs:sequence prevents the use of a union

I have the following xsd
<xsd:complexType name="myID">
<xsd:choice>
<xsd:element name="testID" type="priv:testID"/>
<xsd:sequence>
<xsd:element name="newID" type="priv:newID"/>
<xsd:element name="testID" type="priv:testID" minOccurs="0"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
Everything is under priv namespace. The problem is that it looks like that myID is a union. It might be a testID or a sequence with newID and testID. When I compile it with wsdl2h from gsoap I am taking the message:
Note: <xs:choice> with embedded
<xs:sequence> or <xs:group>
prevents the use of a union
Is the above XSD correct?
In general the XML type myID can be declared as you described. The conflict exist probably in connection with your definition of the types priv:testID and priv:testID which definition you not included. For example the schema
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema targetNamespace="http://www.ok-soft-gmbh.com/xml/xsd/1.0/XMLSchema.xsd"
elementFormDefault="qualified"
xmlns:priv="http://www.ok-soft-gmbh.com/xml/xsd/1.0/XMLSchema.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<xsd:simpleType name="testID">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="newID">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:complexType name="myID">
<xsd:choice>
<xsd:element name="testID" type="priv:testID"/>
<xsd:sequence>
<xsd:element name="newID" type="priv:newID"/>
<xsd:element name="testID" type="priv:testID" minOccurs="0"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
<xsd:element name="root" type="priv:myID"/>
</xsd:schema>
will be correct. So if an error exist, it is not in the part which you posted.