Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Webservice Data Source
Dev_007
<p>Hi All,</p>
<p>Need help for one of the use case. I am using WebService Data Source and have multiple table to map with webservice response. </p>
<p><strong>Problem Statement:</strong></p>
<p>I am using multiple data set to map for diff tables. The issue is each data set uses same data source (webservice datasource) and fires multiple webservice request to fetch the same data.</p>
<p>Sample resposne:</p>
<div> <test></div>
<div><Miti></div>
<div><Factors></div>
<div><Factor>testFactor1</Factor></div>
<div><Remarks>Factor Remarks</Remarks></div>
<div></Factors></div>
<div><Factors></div>
<div><Factor>testFactor2</Factor></div>
<div><Remarks>Factor Remarks</Remarks></div>
<div></Factors></div>
<div></Miti></div>
<div><Aggr></div>
<div><Factors></div>
<div><Factor>testFactor3</Factor></div>
<div><Remarks>Factor Remarks</Remarks></div>
<div></Factors></div>
<div><Factors></div>
<div><Factor>testFactor4</Factor></div>
<div><Remarks>Factor Remarks</Remarks></div>
<div></Factors></div>
<div><Factors></div>
<div><Factor>testFactor3</Factor></div>
<div><Remarks>Factor Remarks</Remarks></div>
<div></Factors></div>
<div><Factors></div>
<div><Factor>testFactor4</Factor></div>
<div><Remarks>Factor Remarks</Remarks></div>
<div></Factors></div>
<div></Aggr></div>
<div></test></div>
<div>From above response the nested xml is mapped to table . How i can achieve this using only one SOAP Request. Also i would like to understand how i can store the nested XML part in variable. i tried lot of options but didn't find much on this.</div>
<div>Request help with any sample code or link .</div>
<div> </div>
<div>I am using BIRT with eclipse plugin</div>
<div> </div>
<div>-Thanks</div>
Find more posts tagged with
Comments
Clement Wong
<p>You can easily read in your XML into an XML primitive data type once, and reuse it in scripted data sources / data sets.</p>
<p> </p>
<p>Here is a <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1122-parsing-xml-in-birt-with-e4x/'>DevShare
example using E4X</a> for one scripted data set, but could be repeated for additional ones.</p>
Dev_007
<p>Thanks. I will go through the link and give a try in my code.</p>
Dev_007
<blockquote class="ipsBlockquote" data-author="Clement Wong" data-cid="142448" data-time="1456214003">
<div>
<p>You can easily read in your XML into an XML primitive data type once, and reuse it in scripted data sources / data sets.</p>
<p> </p>
<p>Here is a <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1122-parsing-xml-in-birt-with-e4x/'>DevShare
example using E4X</a> for one scripted data set, but could be repeated for additional ones.</p>
</div>
</blockquote>
<p>Hi Wong,</p>
<p>Is it possible to get the SOAP Response in XML object?.</p>
<p>I have gone trough the link provided and got some idea but i am still not able to store the soap response in XML object.</p>
<p>I am having one dataset (from webservice data source). I am trying to find a way where the actual soap response is captured on some event of this webservice dataset so that can be reused later with scripted data set. </p>
<p> </p>
<p>-Thanks</p>
Clement Wong
<p>The Web Services ODA doesn't return you the raw XML. Thus, you will need a scripted data source / data set if you want entire *raw* XML.</p>
<p> </p>
<p>If you really had to, you can rebuild the XML in the Web Service's Data Set onFetch event, by storing each fetched row into a variable for later use.</p>
<p> </p>
<p>Ideally, your best bet is to use a scripted data source / data set. It is very flexible.</p>
Dev_007
<p>Thanks Wong for guidance on this topic.</p>
<p> </p>
<p><em>"<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">by storing each fetched row into a variable for later use.</span>"</em></p>
<p>I was trying to do the same but somehow couldn't succeed</p>
<p>by using below syntax</p>
<p><strong>stringNode=row["<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Factors</span>"] </strong></p>
<p>where "Factors" is a repeating element in WebService Response (sample response is present in earlier post)</p>
<p> </p>
<p>row["Factor"] works fine which is a child node of "Factors". It is able to assign the textNode but not able to assign the ElementNode as string.</p>
<p> </p>
<p>I was able to do something with Scripted Dataset with help of earlier links shared by you.</p>
<p>Open issue here is to give dynamic data (webservice response elements) to ScriptedData Set.</p>
<p> </p>
<p>Any tips to achieve this.</p>
<p> </p>
<p>Thanks.</p>
Clement Wong
<p>It's Clement, btw.</p>
<p> </p>
<p>Again, it is <span style="color:#008000;"><strong>highly recommended</strong></span> to read in your raw XML as a scripted data source / data set as shown in the <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1122-parsing-xml-in-birt-with-e4x/'>DevShare</a>.</p>
;
<p> </p>
<p>As a<strong> <span style="color:#800000;">last resort</span></strong>, if you really need to do it with a Web Services ODA, recreate the XML and feed it into additional scripted data sets, I have attached an example.</p>
<p> </p>
<p>The beforeOpen of the Web Services ODA initializes the recreated XML variable. onFetch builds each row. afterClose adds the closing tag, converts the string into a native XML data type, and sets the total number of items in a variable for later use.</p>
<p> </p>
<p>Since this is not the recommended approach, no further assistance will be provided.</p>
<p> </p>
<p> </p>
Dev_007
<p>Thanks Clement.</p>
<p>I will follow the recommended approach.</p>
Dev_007
<p>Hi experts,</p>
<p>Need assistance in accessing https connection through webservice data source in Report design.</p>
<p> </p>
<p>Scenario:</p>
<p>Accessing webservice data source with WSDL and SOAP EndPoint having https connection.</p>
<p> </p>
<p>Problem Statement:</p>
<p>While accessing the webservice i get the error as ODA exception that connection could not be open.</p>
<p> </p>
<p><span style="font-size:12px;"><em>" org.eclipse.birt.data.engine.odaconsumer.ConnectionManager openConnection</em></span></p>
<div><span style="font-size:12px;"><em>SEVERE: Unable to open connection.</em></span></div>
<div><span style="font-size:12px;"><em>org.eclipse.datatools.connectivity.oda.OdaException</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.datatools.enablement.oda.ws.impl.Connection.open(Connection.java:81)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaConnection.open(OdaConnection.java:250)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.odaconsumer.ConnectionManager.openConnection(ConnectionManager.java:165)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.executor.DataSource.newConnection(DataSource.java:224)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.executor.DataSource.open(DataSource.java:212)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.impl.DataSourceRuntime.openOdiDataSource(DataSourceRuntime.java:217)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.impl.QueryExecutor.openDataSource(QueryExecutor.java:437)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:325)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:463)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:179)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:651)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:152)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:285)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1947)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)</em></span></div>
<div><span style="font-size:12px;"><em>at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:75)"</em></span></div>
<div> </div>
<div><span style="font-size:14px;">Same report works perfectly works on http connection.</span></div>
<div><span style="font-size:14px;">I am creating report design file via eclipse </span></div>
<div> </div>
<div>Additional Info: Same endpoint is accessible through SOAP UI.</div>
<p> </p>
<p>Version Used: Eclipse BIRT Designer Version 4.4.0</p>
<p> </p>
<p>Request help for the resolution of the issue.</p>
Clement Wong
<p>I'm available to access a HTTPS web service such as <a data-ipb='nomediaparse' href='
https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl'>https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl</a></p>
;
<p> </p>
<p>You'll need to provide additional informaiton. </p>
<p> </p>
<p>Where does this error occur? That is, what operation in the Designer did you do before the error occurred?</p>
<p> </p>
<p>Are you saying that it fails the "Test Connection" in the Data Source?</p>
<p> </p>
<p>Are you able to Preview Data in the web service Data Set?</p>
<p> </p>
<p>Are you able to access any other HTTPS web service?</p>
<p> </p>
<p>Is this a sharable public endpoint that we can test? If not, you can PM me so that I can try it out on my end. If you have the report design, that would be great too.</p>
BIRT User
<p>Hi Clement,<br>
The web service in the sample report you shared is not accessible from my network. I am facing a similar issue where i am unable to convert the SOAP response into XML. I have attached the sample response where the nested level will go up to 10. I cannot really frame the XML from 'onFecth' method because i would be having 100 fields to look for. <br>
<br><strong>Sample Response:</strong><br>
<?xml version="1.0" encoding="UTF-8"?><br>
<Market><br><span style="color:#0000ff;"><Fruits></span><br><span style="color:#0000ff;"><Fruit></span><br><span style="color:#0000ff;"><Fruit_01>Apple</Fruit_01></span><br><span style="color:#0000ff;"><Fruit_02>Orange</Fruit_02></span><br><span style="color:#0000ff;"><Fruit_04>Grapes</Fruit_04></span><br><span style="color:#0000ff;"><Fruit_04>Mango</Fruit_04></span><br><span style="color:#0000ff;"></Fruit></span><br><span style="color:#0000ff;"><Fruit></span><br><span style="color:#0000ff;"><Fruit_01>2</Fruit_01></span><br><span style="color:#0000ff;"><Fruit_02>4</Fruit_02></span><br><span style="color:#0000ff;"><Fruit_04>6</Fruit_04></span><br><span style="color:#0000ff;"><Fruit_04>3</Fruit_04></span><br><span style="color:#0000ff;"></Fruit></span><br><span style="color:#0000ff;"></Fruits></span><br><span style="color:#ff0000;"><Books>12</Books></span><br>
</Market><br>
<br>
Is there a way to get the top node alone as output column and select all the child nodes as XML. Like getting all the nodes under '<Fruits>' as separate XML(highlighted in Blue). <br>
<br>
I have attached the sample XML and the report which i tried.
Clement Wong
<p>
@Ragu
Shree, it's a public webservice located at:</p>
<pre class="_prettyXprint">
http://www.predic8.com:8080/crm/CustomerService?wsdl</pre>
<p>It is possible that your network setup might be blocking it.</p>
<p> </p>
<p>As for your specific data set, it's best to use a scripted data source / data set since the XPath for your elements are not unique and require some manipulating.</p>
<p> </p>
<p>Attached is an example using your sample data that will read in the XML, and parse the Fruits as raw text. But you can also use E4X to walk through and get the elements you need.</p>
BIRT User
<p>Hi Clement,</p>
<p>The challenge i am facing here is that I would be getting that input XML as my response. So i have to create a Web service datasource and dataset to retrieve the SOAP response. After that i have to parse that XML using scripted dataset. </p>
<p> </p>
<p>Any idea how to get that XML from SOAP response?. It will be a huge XML response with 10 level of nesting and 100 fields. </p>
Clement Wong
<p>As for an update to the original thread, it appears that Dev_007 may need to add the SSL certificate manually to the Java keystore.</p>
<p> </p>
<p>We are waiting for the results of this step.</p>
Clement Wong
<p>
@Ragu
Shree</p>
<p> </p>
<p>You can get the SOAP response in the scripted data source / data set and process it via E4X which allows you to get through nesting and fields quite quickly.</p>
BIRT User
<p>Hi Clement,</p>
<p>I am clear with parsing the XML using E4X. It would be great If you could share some sample report for writing SOAP response into XML. </p>
Clement Wong
<p>Since you let me know that you "requirement where i have to build the report by sourcing data from web service. We have to condition that we should call web service only once for optimal performance."</p>
<p> </p>
<p>The solution is to have a single scripted data source, with multiple scripted data sets.</p>
<p> </p>
<p>The first scripted data set would be similar to my DevShare example or the design that I attached in the thread in post #12. </p>
<p> </p>
<p>Call your web service here in the <em>beforeOpen</em> event. You see that the"market" variable is declared. It is a global variable, and it is a native XML data type (via E4X).</p>
<p> </p>
<p>You will be able to use "market" in a subsequent script data set.</p>
<p> </p>
<p>For example, take the example report in the thread.</p>
<p>1. Right click on "Data Sets" and "Add New Data Set"</p>
<p>2. Select the "Scripted Data Source"</p>
<p>3. Add a Output Column named "Books" (type: String)</p>
<p>4. Go to the open event of this new scripted data set. Add the line:</p>
<p><span style="font-family:'courier new', courier, monospace;">currentrow = 0;</span></p>
<p> </p>
<p>5. Go to the fetch event of this new scripted data set. Add the line:</p>
<p><span style="font-family:'courier new', courier, monospace;">if( currentrow >= totalItems ){<br>
return false;<br>
}<br><br>
row["Books"] = market.Books.toString();<br><br>
currentrow += 1;<br>
return true;</span></p>
<p> </p>
<p>6. Drag the new scripted data set to your layout.</p>
<p>7. Select 'Select All'. Then, OK</p>
<p>8. Run report.</p>
<p> </p>
<p>This illustrates that you'll be able to reuse the XML multiple times with a single call to your web service.</p>
<p> </p>
<p> </p>
<p>The attached example also removes the underscores ("_") in the tags -- for example, <Fruit_01> to <Fruit01> so you can use E4X to get to the elements correctly. There's a RegEx line in the first scripted data set's <em>beforeOpen</em>:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">result = result.replace(/<(.*?)_(.*?)>/g,"<$1$2>");</span></p>
<p> </p>
<p>The second data set is reuses the original XML, and shows the output of the original Fruit_01 lines.</p>
<p> </p>
<p> </p>
<p> </p>