Loop in an XML schema over elements with different names - c++

I have a xml-File that contains up to 19 Elements named DEPP1, DEPP2, ..., up to DEPP19. ( There may be less than 19 elements though ) My XML-File would look like that:
<TD>
<DEPP1>1</DEPP1>
<DEPP2>2</DEPP2>
...
<DEPP19>3</DEPP19>
</TD>
I also have a xml-schema that I use to read data from that XML-File. In this xsd-File I list all the possible elements that may occur. The schema looks like this:
<xs:element name="TD">
<xs:complexType>
<xs:all>
<xs:element name="DEPP1" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP2" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP3" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP4" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP5" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP6" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP7" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP8" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP9" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP10" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP11" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP12" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP13" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP14" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP15" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP16" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP17" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP18" type="doubleField" minOccurs="0" maxOccurs="1"/>
<xs:element name="DEPP19" type="doubleField" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:complexType>
</xs:element>
Is there a nicer way to create the schema instead of repeating the same code for all Elements ( which all have a different Name ) using a loop ?
Thank you
itelly

Related

Describing an unsorted group of elements with varying occurance bounds via XSD 1.0

I'm attempting to describe the following kind of structure using XSD 1.0:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:all>
<xs:element name="A" minOccurs="1" maxOccurs="1">
<xs:element name="B" minOccurs="1" maxOccurs="1">
<xs:element name="C" minOccurs="1" maxOccurs="1">
<xs:element name="D" minOccurs="0" maxOccurs="unbounded">
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
for the following minimal example document:
<?xml version="1.0" encoding="utf-8"?>
<root><D/><D/><D/><C/><D/><D/><A/><B/><D/></root>
This does not work, since XSD 1.0 does not allow unbounded occurances of an element inside <xs:all>. Since this corresponds to a regex such as (D*AD*BD*CD*|D*AD*CD*BD*|D*BD*AD*CD*|D*CD*AD*BD*|D*BD*CD*AD*|D*CD*BD*AD*), I tried replacing the inner <xs:all> … </xs:all> with the following:
<xs:choice>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A" minOccurs="1" maxOccurs="1"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:choice>
but when checked using xmllint, the tool (quite rightly) complains that the content model is not determinist. Is there a way?
Here we have some solutions:
Option 1: Make you regex solution determinist
The following is your regex transforme to a deterministic regex (please allow me this regex abuse of notation):
d*
(
ad*(bd*c|cd*b)
|
bd*(ad*c|cd*a)
|
cd*(ad*b|bd*a)
)
d*
Transformed to XSD:
<xs:sequence>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="A"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="B"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C"/>
</xs:sequence>
<xs:sequence>
<xs:element name="C"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A"/>
</xs:sequence>
</xs:choice>
</xs:sequence>
<xs:sequence>
<xs:element name="B"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="A"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="C"/>
</xs:sequence>
<xs:sequence>
<xs:element name="C"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A"/>
</xs:sequence>
</xs:choice>
</xs:sequence>
<xs:sequence>
<xs:element name="C"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:sequence>
<xs:element name="A"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="B"/>
</xs:sequence>
<xs:sequence>
<xs:element name="B"/>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="A"/>
</xs:sequence>
</xs:choice>
</xs:sequence>
</xs:choice>
<xs:element name="D" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
Option 2: Use xs:key (only valid for simple content or simple types)
Keys should be unique, always present (and non-nullable). If a xs:key field selects more than one value the document is invalid, so you can use:
<xs:element name="root">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="A" type="xs:string"/>
<xs:element name="B" type="xs:string"/>
<xs:element name="C" type="xs:string"/>
<xs:element name="D" type="xs:string"/>
</xs:choice>
</xs:complexType>
<xs:key name="oneABC">
<xs:selector xpath="."/>
<xs:field xpath="A"/>
<xs:field xpath="B"/>
<xs:field xpath="C"/>
</xs:key>
</xs:element>
Option 3: Change XML model to enforce order
Not exactly a solution as this won't validate the same documents. This would be a lot easier if you only accept a given order. This is only possible if you are the one defining XML document instances structure. Example: ABCD*
<xs:sequence>
<xs:element name="A">
<xs:element name="B">
<xs:element name="C">
<xs:element name="D" minOccurs="0" maxOccurs="unbounded">
</xs:sequence>
Option 4: best solution, use XSD 1.1 and xs:assert
Not a real option as you say you need XSD 1.0, but just in case someone can use XSD 1.1. This is super-easy using XSD 1.1 and xs:assert:
<xs:element name="root">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="A"/>
<xs:element name="B"/>
<xs:element name="C"/>
<xs:element name="D"/>
</xs:choice>
<xs:assert test="count(A)=1 and count(B)=1 and count(C)=1"/>
</xs:complexType>
</xs:element>

Is it possible to send and receive XML to WSDL function using Delphi..?

We have used Web Services with Delphi in the past and those are simple with few parameters and returned a single value to the client. A new service we working should able to XML input and receive XML output.
Is there any componenet which can be used for this purpose?
When i tried using like below am getting an error "Exception in SearchAgreements input parameter XmlElement - System.NullReferenceException: Object reference not set to an instance of an object."
LDocument := NewXMLDocument;
<<framed an XML input>>
DocSearchOut := SearchArgsResponse.Create();
DoxSerchIn := SearchArgs.Create();
DoxSerchIn.SOAPTOObject(LDocument.DocumentElement,LDocument.DocumentElement,HTTPRIO1.Converter);
DoxService := GetIDoxService(True,'',HTTPRIO1);
DocSearchOut :=DoxService.SearchAgreements(DoxSerchIn)
I even tried converting SearchArgs as widestring and tried to pass as a string.This is working with minor changes on HTTPRIO execute. Final Edit
LDocument := NewXMLDocument;
<<framed an XML input>>
DocSearchOut := SearchArgsResponse.Create();
DoxSerchIn := SearchArgs.Create();
DoxSerchIn.SearchArgs := LDocument.DocumentElement.XML;
DoxService := GetIDoxService(True,'',HTTPRIO1);
DocSearchOut :=DoxService.SearchAgreements(DoxSerchIn)
its wsdl
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://www.bank.com/dox/service/v1.0.0" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="DoxService" targetNamespace="http://tempuri.org/">
<wsdl:import namespace="http://www.bank.com/dox/service/v1.0.0" location="http://devldn.ldn.bank.com:8258/doxManual/DoxService.svc?wsdl=wsdl0"/>
<wsdl:types/>
<wsdl:binding name="BasicHttpBinding_IDoxService" type="i0:IDoxService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SearchAgreements">
<soap:operation soapAction="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreements" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DoxService">
<wsdl:port name="BasicHttpBinding_IDoxService" binding="tns:BasicHttpBinding_IDoxService">
<soap:address location="http://devldn.ldn.bank.com:8258/doxManual/DoxService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
wsdl0
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www.bank.com/dox/service/v1.0.0" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" targetNamespace="http://www.bank.com/dox/service/v1.0.0">
<wsdl:types>
<xsd:schema targetNamespace="http://www.bank.com/dox/service/v1.0.0/Imports">
<xsd:import schemaLocation="http://ldndev.ldn.bank.com:8258/doxManual/DoxService.svc?xsd=xsd0" namespace="http://www.bank.com/dox/service/v1.0.0"/>
<xsd:import schemaLocation="http://ldndev.ldn.bank.com:8258/doxManual/DoxService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IDoxService_SearchAgreements_InputMessage">
<wsdl:part name="parameters" element="tns:SearchAgreements"/>
</wsdl:message>
<wsdl:message name="IDoxService_SearchAgreements_OutputMessage">
<wsdl:part name="parameters" element="tns:SearchAgreementsResponse"/>
</wsdl:message>
<wsdl:portType name="IDoxService">
<wsdl:operation name="SearchAgreements">
<wsdl:input wsaw:Action="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreements" message="tns:IDoxService_SearchAgreements_InputMessage"/>
<wsdl:output wsaw:Action="http://www.bank.com/dox/service/v1.0.0/IDoxService/SearchAgreementsResponse" message="tns:IDoxService_SearchAgreements_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
xsd0
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.bank.com/dox/service/v1.0.0" elementFormDefault="qualified" targetNamespace="http://www.bank.com/dox/service/v1.0.0">
<xs:element name="SearchAgreements">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="searchRequest" nillable="true">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" processContents="lax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SearchAgreementsResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="SearchAgreementsResult" nillable="true">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" processContents="lax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
xsd1
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
<xs:element name="byte" nillable="true" type="xs:byte"/>
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
<xs:element name="double" nillable="true" type="xs:double"/>
<xs:element name="float" nillable="true" type="xs:float"/>
<xs:element name="int" nillable="true" type="xs:int"/>
<xs:element name="long" nillable="true" type="xs:long"/>
<xs:element name="QName" nillable="true" type="xs:QName"/>
<xs:element name="short" nillable="true" type="xs:short"/>
<xs:element name="string" nillable="true" type="xs:string"/>
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
<xs:element name="char" nillable="true" type="tns:char"/>
<xs:simpleType name="char">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration"/>
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid"/>
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>
</xs:schema>
Input to Service..unfortunetely,team has added few things so unable to retrieve output on SOAP UI.
<AgreementSearchRequest xmlns="http://www.bank.com/dox/service/v1.0.0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<PageNo>1</PageNo>
<PageSize>10</PageSize>
<Source>IBFD</Source>
</Header>
<SearchCriteria>
<AgreementId>10</AgreementId>
<AgreementStatus>Search Status</AgreementStatus>
<AgreementType>Search Type</AgreementType>
<AgreementVersion>Search Version</AgreementVersion>
<CompletedDate>2014-05-30T15:56:45.7533005+05:30</CompletedDate>
<ContractingEntity>Search GCRS Code</ContractingEntity>
<CounterpartyBranch>Search CP Branch</CounterpartyBranch>
<CounterpartyEMID>Search CP EMID</CounterpartyEMID>
<CounterpartyId>Search CP ID</CounterpartyId>
<CounterpartyName>Search CP Name</CounterpartyName>
<CounterpartyType>Search CP Type</CounterpartyType>
<CreditContact>Search Contact</CreditContact>
<IsOffshoreUser>true</IsOffshoreUser>
<Products>
<Product>
<ProductCode>Search Code</ProductCode>:=
<ProductName i:nil="true"/>
</Product>
</Products>
<RXM>Search RXM</RXM>
<RequestedDate>2014-05-30T15:56:45.758183+05:30</RequestedDate>
<bankLegalEntity>Search LEgal Entity</bankLegalEntity>
<bankLegalEntityCategory>Search Legal Entity Category</bankLegalEntityCategory>
<UmbrellaCounterpartyEMID>Search Agent EMID</UmbrellaCounterpartyEMID>
<UmbrellaCounterpartyName>Search Agent Name</UmbrellaCounterpartyName>
</SearchCriteria>
I tried importing xsd and replacing xml file HTTPRIO Before execute as mentioned here..
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://www.bank.com/dox/service/v1.0.0" elementFormDefault="qualified" targetNamespace="http://www.bank.com/dox/service/v1.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ArrayOfProduct">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Product" nillable="true" type="tns:Product" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfProduct" nillable="true" type="tns:ArrayOfProduct" />
<xs:complexType name="Product">
<xs:sequence>
<xs:element minOccurs="0" name="ProductCode" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="ProductName" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="Product" nillable="true" type="tns:Product" />
<xs:complexType name="AgreementSearchRequest">
<xs:sequence>
<xs:element name="Header" nillable="true" type="tns:AgreementSearchRequestHeader" />
<xs:element name="SearchCriteria" nillable="true" type="tns:AgreementSearchCriteria" />
</xs:sequence>
</xs:complexType>
<xs:element name="AgreementSearchRequest" nillable="true" type="tns:AgreementSearchRequest" />
<xs:complexType name="AgreementSearchRequestHeader">
<xs:sequence>
<xs:element name="PageNo" type="xs:int" />
<xs:element name="PageSize" type="xs:int" />
<xs:element name="Source" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="AgreementSearchRequestHeader" nillable="true" type="tns:AgreementSearchRequestHeader" />
<xs:complexType name="AgreementSearchCriteria">
<xs:sequence>
<xs:element minOccurs="0" name="AgreementId" type="xs:int" />
<xs:element minOccurs="0" name="AgreementStatus" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="AgreementType" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="AgreementVersion" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CompletedDate" type="xs:dateTime" />
<xs:element minOccurs="0" name="ContractingEntity" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyBranch" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyEMID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyId" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyName" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CounterpartyType" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="CreditContact" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="Products" nillable="true" type="tns:ArrayOfProduct" />
<xs:element minOccurs="0" name="RXM" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="RequestedDate" type="xs:dateTime" />
<xs:element minOccurs="0" name="egalEntity" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="LegalEntityCategory" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="UmbrellaCounterpartyEMID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="UmbrellaCounterpartyName" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="AgreementSearchCriteria" nillable="true" type="tns:AgreementSearchCriteria" />
</xs:schema>
There is the Web Service Toolkit.
It has a code generator that takes a wsdl and generate Pascal classes from it that interact with the web service.
Seems to be exactly what you need, but I do not know the specifics.
Then there are also my Internet Tools for FreePascal (not Delphi).
They contain interpreter for XQuery which is a general purpose XML processing language, so you can use it with every possible XML/HTML based API with far less code than using DOM methods. But it won't help you with anything WSDL specific, you need to write the XML for every request yourself.
Based on other views on vaiours forums(inc stack overflow) we have fixed the issue by fixing in 2 places.
Changed the remotable procedure generated by Delphi.Earlier it was a class of input parameter itself so we have changed to WideString
SearchAgreements = class(TRemotable)
private
FsearchRequest: WideString ;
FsearchRequest_Specified: boolean;
procedure SetsearchRequest(Index: Integer; const AsearchRequest: WideString );
function searchRequest_Specified(Index: Integer): boolean;
public
destructor Destroy; override;
published
property searchRequest: WideString Index (IS_OPTN) read FsearchRequest write SetsearchRequest stored searchRequest_Specified;
end;
And also we have modified HTTPRIO Before execute with minor modifications and we are able to send XML sucessfully to Service.
procedure HTTPRIO1SoapBeforeExecute(const MethodName: string;
SOAPRequest: TStream);
var
StrTemp,Fheader : TStringList;
StrBeg,StrEnd,StrParam,StrParam1 : TStringList;
StreamTemp : TStream;
StrLst : TStringList;
StrLstTmp: TStringList;
begin
StrBeg:=TStringList.Create();
StrEnd:=TStringList.Create();
SOAPRequest.Position := 0;
StrTemp.LoadFromStream(SOAPRequest);
StrBeg.Text := StringReplace(StrTemp.Text,'<','<',[RfReplaceAll]);
StrEnd.Text := StringReplace(StrBeg.Text,'>','>',[RfReplaceAll]);
SOAPRequest.Position:=0;
SOAPRequest.Size := 0; //Clear the Stream
StrEnd.SaveToStream(SOAPRequest); //Reinitialise the stream with right string.
SOAPRequest.Position :=0;
end;
We have done PHd on Webservices call with,so anyone facing similar issue can contact me.Thanks:)

Create a SOAP web service with jax-ws using a xml schema

I am trying to create a soap web service for a server using jax-ws following this xml schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="OfeliaDataEx">
<xs:complexType>
<xs:sequence>
<xs:element ref="Header"/>
<xs:element ref="User"/>
<xs:element ref="Data"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element ref="State"/>
<xs:element ref="TypeReq"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="State" type="xs:string"/>
<xs:element name="TypeReq" type="xs:string"/>
<xs:element name="User">
<xs:complexType>
<xs:sequence>
<xs:element ref="JabberID"/>
<xs:element ref="OpenID"/>
<xs:element ref="OauthToken"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="JabberID" type="xs:string"/>
<xs:element name="OpenID" type="xs:anyURI"/>
<xs:element name="OauthToken">
<xs:complexType>
<xs:sequence>
<xs:element ref="AuthToken"/>
<xs:element ref="TokenSecret"/>
<xs:element ref="ExpireDate"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AuthToken" type="xs:string"/>
<xs:element name="TokenSecret" type="xs:string"/>
<xs:element name="ExpireDate" type="xs:string"/>
<xs:element name="Data">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="POSI"/>
<xs:element ref="TESTE"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="POSI">
<xs:complexType>
<xs:all>
<xs:element ref="TimeStamp"/>
<xs:element ref="RefreshInterval"/>
<xs:element ref="Lon"/>
<xs:element ref="Lat"/>
<xs:element ref="Data"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="RefreshInterval" nillable="true" type="xs:integer"/>
<xs:element name="Lon" nillable="true" type="xs:float"/>
<xs:element name="Lat" nillable="true" type="xs:float"/>
<xs:element name="TESTE">
<xs:complexType>
<xs:all>
<xs:element ref="TimeStamp"/>
<xs:element ref="cenas"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="cenas" nillable="true" type="xs:float"/>
<xs:element name="TimeStamp" type="xs:string"/>
</xs:schema>
My first try was follow a POJO model how ever i did not have any success. I couldnt reproduce the <xs:choice minOccurs="0" maxOccurs="unbounded">. So i am here to ask for an idea to create a soap web service that follows this schema.
best regards,
Why don't you use the xjc tool which comes with your JDK and creates the required jax-b artifacts from a xsd...
something like this will create the classes in the 'generated' subfolder of the current directory:
xjc /the/path/to/my/xsdfile.xsd
Also look here: http://docs.oracle.com/javase/6/docs/technotes/tools/share/xjc.html

Russian doll to Venetian blind xsl transformation

I have been trying to write an xslt transformation to convert 'Russian doll' style xsd into 'Venetian blind' one.
I have written something but that does not work exactly as I intended.
so I have the following xsd document:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="GX" targetNamespace="GX" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="topType">
<xs:sequence>
<xs:element name="REQUESTOR" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="RETURN_CANCELLED_CUSTOMERS" nillable="false" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="EXTERNAL_CUSTOMER_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="ON_BEHALF_OF" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="MSISDN_aaa" nillable="false" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="GSP_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN_bbb" nillable="false" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="SSPP_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN_ccc" nillable="false" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="SSPC_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN_ddd" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="IMSI" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
which I try to transform in to:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="GX" targetNamespace="GX" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="topType">
<xs:sequence>
<xs:element name="REQUESTOR" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="RETURN_CANCELLED_CUSTOMERS" type="tns:RETURN_CANCELLED_CUSTOMERSType" nillable="false" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RETURN_CANCELLED_CUSTOMERSType">
<xs:sequence>
<xs:element name="EXTERNAL_CUSTOMER_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="ON_BEHALF_OF" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="MSISDN_aaa" type="tns:MSISDN_aaaType" nillable="false" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MSISDN_aaaType">
<xs:sequence>
<xs:element name="GSP_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN_bbb" type="tns:MSISDN_bbbType" nillable="false" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MSISDN_bbbType">
<xs:sequence>
<xs:element name="SSPP_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN_ccc" type="tns:MSISDN_cccType" nillable="false" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MSISDN_cccType">
<xs:sequence>
<xs:element name="SSPC_ID" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN_ddd" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="IMSI" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
<xs:element name="MSISDN" type="xs:string" nillable="false" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
the XSLT I am writing is very much work in progress and I am struggling ... did anyone did a similar thing and could offer a piece of advice? basically I am stuck.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes='exsl'>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="GX" targetNamespace="GX" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- processing starts here from the root element -->
<xsl:apply-templates/>
</xs:schema>
</xsl:template>
<xsl:template match="xs:complexType[not(#name)]">
<xs:complexType name="{../#name}Type">
<xs:sequence>
<xsl:apply-templates/>
<xs:element>current:<xsl:value-of select="./#name"/> parent: <xsl:value-of select="../#name"/>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element>no name = parent: <xsl:value-of select="../#name"/>
</xs:element>
</xsl:template>
<!--find the most nested complex type i.e. there are no more child complext types-->
<xsl:template match="xs:complexType[not(xs:sequence/xs:element/xs:complexType)]">
<xs:complexType name="{../#name}Type">
<xsl:copy-of select="child::node()"/>
<xs:element>current:<xsl:value-of select="./#name"/> parent: <xsl:value-of select="../#name"/>NO MORE NESTING!!!!!!!!!!!!!</xs:element>
</xs:complexType>
</xsl:template>
<xsl:template match="xs:element">
<xsl:copy>
<xsl:apply-templates select="attribute()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="attribute()">
<xsl:copy/>
</xsl:template>
<xsl:template match="xs:element[xs:complexType]">
<xs:element name="{#name}" type="{#name}Type" nillable="{#nillable}" minOccurs="{#minOccurs}" maxOccurs="{#maxOccurs}"/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
You could start off, in your root template, by simply selecting all of you complex types in the xsd
<xsl:apply-templates select="//xs:complexType" />
You would then have a template to match complex types, which don't have a name, so you can simply output them with a name based on their parent element.
<xsl:template match="xs:complexType[not(#name)]">
<xs:complexType name="{../#name}Type">
<xsl:apply-templates/>
</xs:complexType>
</xsl:template>
Finally, you would have a template to match the elements with a complex type, and add a type attribute
<xsl:template match="xs:element[xs:complexType]">
<xs:element type="{#name}Type">
<xsl:apply-templates select="#*" />
</xs:element>
</xsl:template>
Here is the full XSLT
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes='exsl'>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="GX" targetNamespace="GX" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- processing starts here from the root element -->
<xsl:apply-templates select="//xs:complexType" />
</xs:schema>
</xsl:template>
<xsl:template match="xs:complexType[not(#name)]">
<xs:complexType name="{../#name}Type">
<xsl:apply-templates/>
</xs:complexType>
</xsl:template>
<xsl:template match="xs:element[xs:complexType]">
<xs:element type="{#name}Type">
<xsl:apply-templates select="#*" />
</xs:element>
</xsl:template>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
When applied to you XSD XML the following is output
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="GX"
targetNamespace="GX"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:complexType name="topType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="REQUESTOR" nillable="false" type="xs:string"/>
<xs:element type="RETURN_CANCELLED_CUSTOMERSType" maxOccurs="1" minOccurs="0" name="RETURN_CANCELLED_CUSTOMERS" nillable="false"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RETURN_CANCELLED_CUSTOMERSType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="EXTERNAL_CUSTOMER_ID" nillable="false" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="1" name="ON_BEHALF_OF" nillable="false" type="xs:string"/>
<xs:element type="MSISDN_aaaType" maxOccurs="1" minOccurs="0" name="MSISDN_aaa" nillable="false"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MSISDN_aaaType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="GSP_ID" nillable="false" type="xs:string"/>
<xs:element type="MSISDN_bbbType" maxOccurs="1" minOccurs="0" name="MSISDN_bbb" nillable="false"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MSISDN_bbbType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="SSPP_ID" nillable="false" type="xs:string"/>
<xs:element type="MSISDN_cccType" maxOccurs="1" minOccurs="0" name="MSISDN_ccc" nillable="false"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MSISDN_cccType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" name="SSPC_ID" nillable="false" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="MSISDN_ddd" nillable="false" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="IMSI" nillable="false" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="0" name="MSISDN" nillable="false" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

Consume multivalue Web Service, vb.net

I'm a newby using asp and webservice technologies. I'm trying to read a Web Service and work with data returned.
My Web Service returns many fields, so I'm looking for the best way to use this returned data.
The XML returned by my Web Service looks like this:
<DataSet xmlns="http://tempuri.org/wsexportaproducto/Productos">
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="NewDataSet">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Exportacion">
<xs:complexType>
<xs:sequence>
<xs:element name="gtin" type="xs:string" minOccurs="0"/>
<xs:element name="gtinreemplazado" type="xs:string" minOccurs="0"/>
<xs:element name="refidcateglobal" type="xs:string" minOccurs="0"/>
<xs:element name="refidcatelocal" type="xs:decimal" minOccurs="0"/>
<xs:element name="gln" type="xs:string" minOccurs="0"/>
<xs:element name="glnfabricante" type="xs:string" minOccurs="0"/>
<xs:element name="nombrefabricante" type="xs:string" minOccurs="0"/>
<xs:element name="refpaismercado" type="xs:string" minOccurs="0"/>
<xs:element name="iniciovigenciadn" type="xs:dateTime" minOccurs="0"/>
<xs:element name="finvigenciadn" type="xs:dateTime" minOccurs="0"/>
<xs:element name="vida" type="xs:decimal" minOccurs="0"/>
<xs:element name="nomproducto" type="xs:string" minOccurs="0"/>
<xs:element name="marca" type="xs:string" minOccurs="0"/>
<xs:element name="descproducto" type="xs:string" minOccurs="0"/>
<xs:element name="descripcioncorta" type="xs:string" minOccurs="0"/>
<xs:element name="profundo" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidprofundo" type="xs:string" minOccurs="0"/>
<xs:element name="alto" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidalto" type="xs:string" minOccurs="0"/>
<xs:element name="ancho" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidancho" type="xs:string" minOccurs="0"/>
<xs:element name="pesobruto" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidpesobruto" type="xs:string" minOccurs="0"/>
<xs:element name="pesoempaque" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidpesoempaque" type="xs:string" minOccurs="0"/>
<xs:element name="contenidoneto" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidcontenidoneto" type="xs:string" minOccurs="0"/>
<xs:element name="escontenidovariable" type="xs:boolean" minOccurs="0"/>
<xs:element name="refembalaje" type="xs:string" minOccurs="0"/>
<xs:element name="esretornable" type="xs:boolean" minOccurs="0"/>
<xs:element name="factorestiba" type="xs:decimal" minOccurs="0"/>
<xs:element name="esunidadminima" type="xs:boolean" minOccurs="0"/>
<xs:element name="contenidos" type="xs:string" minOccurs="0"/>
<xs:element name="refpaisorigen" type="xs:string" minOccurs="0"/>
<xs:element name="variedadcolorcodigo" type="xs:string" minOccurs="0"/>
<xs:element name="variedadcoloragencia" type="xs:string" minOccurs="0"/>
<xs:element name="variedadcolor" type="xs:string" minOccurs="0"/>
<xs:element name="variedadtalleagencia" type="xs:string" minOccurs="0"/>
<xs:element name="variedadtallecodigo" type="xs:string" minOccurs="0"/>
<xs:element name="variedadtalle" type="xs:string" minOccurs="0"/>
<xs:element name="esunidadordenable" type="xs:boolean" minOccurs="0"/>
<xs:element name="cantminimapedir" type="xs:decimal" minOccurs="0"/>
<xs:element name="multiplopedir" type="xs:decimal" minOccurs="0"/>
<xs:element name="esfacturable" type="xs:boolean" minOccurs="0"/>
<xs:element name="esunidadembarque" type="xs:boolean" minOccurs="0"/>
<xs:element name="nrocapasartcomercial" type="xs:decimal" minOccurs="0"/>
<xs:element name="nroartcomercialesporcapa" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidadesporpallet" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidporcapa" type="xs:decimal" minOccurs="0"/>
<xs:element name="nrodecapas" type="xs:decimal" minOccurs="0"/>
<xs:element name="submarca" type="xs:string" minOccurs="0"/>
<xs:element name="variedadtipo" type="xs:string" minOccurs="0"/>
<xs:element name="oferta" type="xs:boolean" minOccurs="0"/>
<xs:element name="dscompania" type="xs:string" minOccurs="0"/>
<xs:element name="nombregen" type="xs:string" minOccurs="0"/>
<xs:element name="variedadsabor" type="xs:string" minOccurs="0"/>
<xs:element name="continentes" type="xs:string" minOccurs="0"/>
<xs:element name="reftiponivel" type="xs:string" minOccurs="0"/>
<xs:element name="esunidadconsumo" type="xs:boolean" minOccurs="0"/>
<xs:element name="pesoneto" type="xs:decimal" minOccurs="0"/>
<xs:element name="unidpesoneto" type="xs:string" minOccurs="0"/>
<xs:element name="cantidadtotalcontenida" type="xs:decimal" minOccurs="0"/>
<xs:element name="reftipogtin" type="xs:string" minOccurs="0"/>
<xs:element name="esprivado" type="xs:boolean" minOccurs="0"/>
<xs:element name="statussecodat" type="xs:string" minOccurs="0"/>
<xs:element name="accion" type="xs:int" minOccurs="0"/>
<xs:element name="fechaaccion" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Exportacion diffgr:id="Exportacion1" msdata:rowOrder="0">
<gtin>07500112045058</gtin>
<refidcateglobal>10005730</refidcateglobal>
<gln>7505000010064</gln>
<refpaismercado>484</refpaismercado>
<iniciovigenciadn>2012-08-09T00:00:00-05:00</iniciovigenciadn>
<finvigenciadn>4999-12-31T23:59:59-06:00</finvigenciadn>
<marca>PINTACOLOR</marca>
<descproducto>PINTACOLOR BLANCO</descproducto>
<descripcioncorta>PINTURA PINTACOLOR 18 L</descripcioncorta>
<profundo>40.000000000000000</profundo>
<unidprofundo>CM</unidprofundo>
<alto>60.000000000000000</alto>
<unidalto>CM</unidalto>
<ancho>40.000000000000000</ancho>
<unidancho>CM</unidancho>
<pesobruto>26.200000000000000</pesobruto>
<unidpesobruto>KG</unidpesobruto>
<unidpesoempaque>KG</unidpesoempaque>
<escontenidovariable>false</escontenidovariable>
<esretornable>false</esretornable>
<esunidadminima>true</esunidadminima>
<contenidos/>
<esunidadordenable>false</esunidadordenable>
<esfacturable>true</esfacturable>
<esunidadembarque>false</esunidadembarque>
<oferta>false</oferta>
<dscompania>DISTRIBUIDOR</dscompania>
<nombregen>PINTURA</nombregen>
<continentes/>
<reftiponivel>EA</reftiponivel>
<esunidadconsumo>false</esunidadconsumo>
<esprivado>false</esprivado>
<statussecodat>2</statussecodat>
</Exportacion>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
So far I have been able to read the webservice, here is the code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Try
Dim SerSyncfonia As Syncfonia.Productos
SerSyncfonia = New Syncfonia.Productos()
Dim v1 = "7505000010064"
Dim v2 = "DISTRIBU"
Dim v3 = "DISTRIBU"
Dim v4 = ""
Dim v5 = "7500112045058"
Label1.Text = SerSyncfonia.ObtieneProducto(v1, v2, v3, v4, v5).ToString
Catch ex As Exception
Label1.Text = ex.Message.ToString
End Try
End Sub
The result I'm getting for Label1.Text after pressing Button1 is "System.Data.DataSet"
So, after I read the Web Service, how can I store this data somewhere to be able to work with data. For example, get the value of the nombregen element, or gtin element and store them somewhere.
In general, it's a bad idea to pass the DataSet class or any other type specific to .NET when using web services. That makes them only usable by compatible versions of .NET (not Java, for instance).
In your case, though, there's a simpler question: even if a DataSet was successfully passed, what exactly did you expect the ToString method to do? Even without web services, DataSet.ToString() isn't going to produce useful output.