Skip to main content

This is a follow-up of Using XML to ingest data, that i have managed to solve.

I need some help with creating a nested statement. 

The first rsd which lists out all the IDs is this:

<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from XML. -->
<api:info title="contract" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<attr name="contractid" xs:type="string" readonly="false" other:xPath="/Envelope/Body/contracts/contract@contractid" />


<attr name="description" xs:type="string" readonly="false" other:xPath="/Envelope/Body/contracts/contract@description" />

</api:info>

<api:set attr="DataModel" value="RELATIONAL" />
<api:set attr="URI" value="https://my.soap.endpoint/service.asmx?WSDL" />
<api:set attr="PushAttributes" value="true" />
<api:set attr="EnablePaging" value="true" />
<api:set attr="Header:Name#" value="SOAPAction"/>
<api:set attr="Header:Value#" value="http://publicprocurement.com/XMLBusinessIntelligence"/>
<api:set attr="XPath" value="/Envelope/Body/contracts/contract" />

<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. -->
<api:script method="GET">
<api:set attr="method" value="POST"/>
<api:set attr="ContentType" value="text/xml"/>
<api:set attr="AcceptCharset" value="utf-8" />
<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header/>
<soap:Body>
<pub:XMLBusinessIntelligence>
<pub:SystemUserID>123456</pub:SystemUserID>
</pub:XMLBusinessIntelligence>
</soap:Body>
</soap:Envelope>
</api:set>
<api:call op="xmlproviderGet">
<api:push/>
</api:call>
</api:script>
</api:script>

Then there is this rsd file that uses ID (in ProjectID) from above to list up futher info.

 

<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from XML. -->
<api:info title="contract" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<attr name="ExternalId" xs:type="string" readonly="false" other:xPath="/Envelope/Body/Result"/>
</api:info>

<api:set attr="DataModel" value="RELATIONAL" />
<api:set attr="URI" value="https://my.soap.com/services.asmx?WSDL" />
<api:set attr="PushAttributes" value="true" />
<api:set attr="EnablePaging" value="true" />
<api:set attr="Header:Name#" value="SOAPAction"/>
<api:set attr="Header:Value#" value="http://publicprocurement.com/Export"/>
<api:set attr="XPath" value="/Envelope/Body" />

<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. -->
<api:script method="GET">
<api:set attr="method" value="POST"/>
<api:set attr="ContentType" value="text/xml"/>
<api:set attr="AcceptCharset" value="utf-8" />
<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header/>
<soap:Body>
<pub:Export>
<pub:SystemUserID>123456</pub:SystemUserID>
<pub:ProjectID>666666</pub:ProjectID>
</pub:Export>
</soap:Body>
</soap:Envelope>
</api:set>
<api:call op="xmlproviderGet">
<api:push/>
</api:call>
</api:script>
</api:script>

I am stuck here i dont know how to create a nested RSD for XML

 

<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from XML. -->
<api:info title="contract" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<attr name="contractid" xs:type="string" readonly="false" other:xPath="/Envelope/Body/contracts/contract@contractid" />
<attr name="ExternalId" xs:type="string" readonly="false" other:xPath="/Envelope/Body/Result"/>


</api:info>

<api:set attr="DataModel" value="RELATIONAL" />
<api:set attr="URI" value="https://services.tendsign.com/customerservices.asmx?WSDL" />
<api:set attr="PushAttributes" value="true" />
<api:set attr="EnablePaging" value="true" />
<api:set attr="Header:Name#" value="SOAPAction"/>


<api:set attr="filein.Header:Value#" value="http://publicprocurement.com/XMLBusinessIntelligence"/>
<api:set attr="filein.xPath#" value="/Envelope/Body/contracts/contract@contractid" />
<api:set attr="filein.ElementMapName#" value="file_id" />


<api:set attr="fileout.Header:Value#" value="http://publicprocurement.com/Export"/>
<api:set attr="fileout.xPath#" value="/Envelope/Body" />




<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. -->
<api:script method="GET">
<api:set attr="method" value="POST"/>
<api:set attr="ContentType" value="text/xml"/>
<api:set attr="AcceptCharset" value="utf-8" />
<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header/>
<soap:Body>
<pub:ExportDocsProjectWithTenders>
<pub:SystemUserID>123456</pub:SystemUserID>
<pub:ProjectID>??????</pub:ProjectID>
</pub:ExportDocsProjectWithTenders>
</soap:Body>
</soap:Envelope>
</api:set>
<api:call op="xmlproviderGet">
<api:push/>
</api:call>
</api:script>
</api:script>

i dont know how to use <api:call op="xmlproviderGet">

@Thomas Lind, can you point me in the right direction? 
I have looked at this post but this but it didn’t help: RSD file referencing field from ParentTablePath

<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from XML. -->
<api:info title="contract" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<attr name="contractid" xs:type="string" readonly="false" other:xPath="/Envelope/Body/contracts/contract@contractid" />
<attr name="ExternalId" xs:type="string" readonly="false" other:xPath="/Envelope/Body/Result"/>


</api:info>

<api:set attr="DataModel" value="RELATIONAL" />
<api:set attr="URI" value="https://services.tendsign.com/customerservices.asmx?WSDL" />
<api:set attr="PushAttributes" value="true" />
<api:set attr="EnablePaging" value="true" />
<api:set attr="Header:Name#" value="SOAPAction"/>


<api:set attr="filein.Header:Value#" value="http://publicprocurement.com/XMLBusinessIntelligence"/>
<api:set attr="filein.xPath#" value="/Envelope/Body/contracts/contract@contractid" />
<api:set attr="filein.ElementMapName#" value="file_id" />


<api:set attr="fileout.Header:Value#" value="http://publicprocurement.com/Export"/>
<api:set attr="fileout.xPath#" value="/Envelope/Body" />




<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. -->
<api:script method="GET">
<api:set attr="filein.method" value="POST"/>
<api:call op="xmlproviderGet" in="filein" out="fileout">
<api:set attr="fileout.URI" value="vreplace('{ProjectID}', tfilein.contract@contractid])]"/>
<api:set attr="fileout.method" value="POST" />
<api:set attr="ContentType" value="text/xml"/>
<api:set attr="AcceptCharset" value="utf-8" />
<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header/>
<soap:Body>
<pub:ExportDocsProjectWithTenders>
<pub:SystemUserID>123456</pub:SystemUserID>
<pub:ProjectID>value</pub:ProjectID>
</pub:ExportDocsProjectWithTenders>
</soap:Body>
</soap:Envelope>
</api:set>
<api:call op="xmlproviderGet" in="filein" out="fileout">
<api:set attr="outresult.contract" value="vfilein.contract@contractid | allownull()]" />
<api:set attr="outresult.ExternalId" value="vfileout.ExternalId | allownull()]" />

<api:push/>
</api:call>
</api:script>
</api:script>

I am unsure about this bit.
How to i replace value with contractID

 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header/>
<soap:Body>
<pub:ExportDocsProjectWithTenders>
<pub:SystemUserID>123456</pub:SystemUserID>
<pub:ProjectID>value</pub:ProjectID>
</pub:ExportDocsProjectWithTenders>
</soap:Body>
</soap:Envelope>

 


Here is an update
I have managed to write a nested code but now i am getting an error that says

Anyone knows what i am doing wrong?

the uri or text attribute must be specified 

 

Here is the code

<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- Column Definitions to specify column behavior and use XPaths to extract column values from XML. -->
<api:info title="contract" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<attr name="contractid" xs:type="string" readonly="false" other:xPath="/Envelope/Body/contract@contractid" />
<attr name="ExternalId" xs:type="string" readonly="false" other:xPath="/Envelope/Body/Result"/>
</api:info>

<api:set attr="DataModel" value="RELATIONAL" />
<api:set attr="URI" value="https://my.soap.endpoint/services.asmx?WSDL" />
<api:set attr="PushAttributes" value="true" />
<api:set attr="EnablePaging" value="true" />
<api:set attr="Header:Name#" value="SOAPAction" />

<!-- Set FileIn for Input -->
<api:set attr="filein.Header:Value#" value="http://publicprocurement.com/XMLBusinessIntelligence" />
<api:set attr="filein.ElementMapPath#" value= "/Envelope/Body/contracts/contract@contractid" />
<api:set attr="filein.ElementMapName#" value="file_id" />


<!-- Set FileOut for Output -->
<api:set attr="fileout.Header:Value#" value="http://publicprocurement.com/Export" />
<api:set attr="fileout.ElementMapName#" value="contract_export" />
<api:set attr="fileout.ElementMapPath#" value="/Envelope/Body" />

<!-- The GET method corresponds to SELECT. Override the default processing of the SELECT statement and push to output -->
<api:script method="GET">
<api:set attr="filein.method" value="POST"/>

<api:call op="xmlproviderGet" in="filein" out="fileout">
<!-- Replace {ProjectID} dynamically using the contractid from filein -->
<api:set attr="fileout.URI" value="=replace('{ProjectID}', ,filein.contract@contractid])]" />
<api:set attr="fileout.method" value="POST" />
<api:set attr="ContentType" value="text/xml"/>
<api:set attr="AcceptCharset" value="utf-8" />
<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header/>
<soap:Body>
<pub:ExportDocsProjectWithTenders>
<pub:SystemUserID>123456</pub:SystemUserID>
<pub:ProjectID>tfilein.contract@contractid]</pub:ProjectID> <!-- Dynamically inserted ProjectID -->
</pub:ExportDocsProjectWithTenders>
</soap:Body>
</soap:Envelope>
</api:set>

<api:call op="xmlproviderGet" in="filein" out="fileout">
<!-- Map the contractid and ExternalId to the results -->
<api:set attr="outresult.contract" value="=filein.contract@contractid | allownull()]" />
<api:set attr="outresult.ExternalId" value="=fileout.ExternalId | allownull()]" />

<!-- Push the processed result to output -->
<api:push/>
</api:call>
</api:call>
</api:script>

</api:script>

 


So i have worked with the script some more and now i am able to see the table but its empty.
Anyone knows what i am doing worng?

 

<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- Define column attributes -->
<api:info title="contract" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<attr name="contract" xs:type="string" readonly="false" other:xPath="/Envelope/Body/contracts/contract@contractid" />
<attr name="ExternalId" xs:type="string" readonly="false" other:xPath="/Envelope/Body/Result" />
</api:info>

<!-- File Input Settings -->
<api:set attr="filein.DataModel" value="RELATIONAL" />
<api:set attr="filein.URITemplate" value="https://my.soap.endpint/services.asmx?WSDL" />
<api:set attr="filein.PushAttributes" value="true" />
<api:set attr="filein.EnablePaging" value="true" />
<api:set attr="filein.Header:SOAPAction" value="http://publicprocurement.com/XMLBusinessIntelligence" />
<api:set attr="filein.XPath" value="/Envelope/Body/contracts/contract" />
<api:set attr="filein.ElementMapPath" value="/Envelope/Body/contracts/contract@contractid" />
<api:set attr="filein.ElementMapName" value="file_id" />

<!-- Stop Input Settings -->
<api:set attr="stopin.DataModel" value="RELATIONAL" />
<api:set attr="stopin.URITemplate" value="value="https://my.soap.endpint/services.asmx?WSDL" />" />
<api:set attr="stopin.PushAttributes" value="true" />
<api:set attr="stopin.EnablePaging" value="true" />
<api:set attr="stopin.Header:SOAPAction" value="http://publicprocurement.com/ExportDocs" />
<api:set attr="stopin.XPath" value="/Envelope/Body" />
<api:set attr="stopin.ElementMapName" value="file_id" />
<api:set attr="stopin.ElementMapPath" value="/Envelope/Body" />

<!-- Script Logic -->
<api:script method="GET">
<api:set attr="filein.URI" value=""filein.URITemplate]" />
<api:call op="xmlproviderGet" in="filein" out="fileout">
<!-- Update stopin URI with file_id -->
<api:set attr="stopin.URI" value=""stopin.URITemplate | replace('file_id', fileout.file_id])]" />
<api:call op="xmlproviderGet" in="stopin" out="stopout">

<!-- Define SOAP Body and headers -->
<api:set attr="method" value="POST"/>
<!--
<api:set attr="stopout.method" value="POST" />
-->
<api:set attr="ContentType" value="text/xml" />
<api:set attr="AcceptCharset" value="utf-8" />
<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header />
<soap:Body>
<pub:ExportDocsProjectWithTenders>
<pub:SystemUserID>123456</pub:SystemUserID>
<pub:ProjectID>;fileout.file_id | allownull()]</pub:ProjectID>
</pub:ExportDocsProjectWithTenders>
</soap:Body>
</soap:Envelope>
</api:set>

<!-- Map output attributes -->
<api:set attr="outresult.contract" value=""fileout.file_id | allownull()]" />
<api:set attr="outresult.ExternalId" value=""stopout.ExternalId | allownull()]" />
<!-- Push results -->
<api:push item="out"/>
</api:call>
</api:call>
</api:script>

</api:script>

 


Hi ​@aftabp 

I don’t know if nested calls an SOAP is a good mix.

Is it possible to remove the nested parts and use a input field to add the missing parts to the call.

Like explained in the above section about parameters.


@Thomas Lind 
how?
there are 500 contractID in the filst call


Hi ​@aftabp 

OK, are you able to get all these contract ids in one RSD file with a post call?

Then you can maybe use a query slicer to filter the other call.

Alternatively you add both files here. RSD files is not allowed to be attached, but you can save them as XML files. Then I will ask CData if they have any ideas for how this could be made to work.


@Thomas Lind 
All the contract IDs are in this endpoint: ttp://publicprocurement.com/XMLBusinessIntelligence
To get the details, from this endpoint: http://publicprocurement.com/ExportDocs, i can only proviode one contractID at a time. Therefore this statment: 

<api:script method="GET">
<api:set attr="filein.URI" value="afilein.URITemplate]" />
<api:call op="xmlproviderGet" in="filein" out="fileout">
<!-- Update stopin URI with file_id -->
<api:set attr="stopin.URI" value="astopin.URITemplate | replace('file_id', _fileout.file_id])]" />
<api:call op="xmlproviderGet" in="stopin" out="stopout">

<!-- Define SOAP Body and headers -->
<api:set attr="method" value="POST"/>
<!--
<api:set attr="stopout.method" value="POST" />
-->
<api:set attr="ContentType" value="text/xml" />
<api:set attr="AcceptCharset" value="utf-8" />
<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://publicprocurement.com">
<soap:Header />
<soap:Body>
<pub:ExportDocsProjectWithTenders>
<pub:SystemUserID>123456</pub:SystemUserID>
<pub:ProjectID>Ifileout.file_id | allownull()]</pub:ProjectID>

The xPath in the code here has dummy URLs. I am going to send it to you privately so that the full path for xPath is visible.


Hi ​@aftabp 

I will look into this.


Reply