How can use an ORACLS EBS xmlreport parameters from a package-body? - bi-publisher

I have recently created a report using Oracle E-business suite, a XML publisher report. In that report I have added 4 parameters and I need to use those parameters from a package body which is a custom request
these are the parameters in my xml report data definition.
<parameters>
<parameter name="P_org_id" datatype="number"/>
<parameter name="P_Account_Number" dataType="number"/>
<parameter name="P_Start_week" dataType="date"/>
<parameter name="P_End_week" dataType="date"/>
</parameters>
Is it possible to access the org_id and p_start_week parameter from the xml report and use it in a package body? I am not sure if I have put the question properly, because I have very limited idea about this. If you need more information to answer this question, please let me know.
this is how the code my package looks like:
Select so_header_id from XXONT_M545_CUST_COVG_DATA
where revision_week = &p_current_week – to_char(nvl(<Date_provided_as_parameter>,sysdate),’YYYYMM’)
and cust_org = &p_org_id
and hold_yn = ‘Y’;

In my opinion, you should create PL/SQL concurrent program
http://www.askhareesh.com/2015/08/plsql-stored-procedure-registration-with-parameters.html
And return data in XML.

Related

Turning on Saxon performance analysis in eXist-db

I've used the performance analysis tool in Saxon (https://www.saxonica.com/documentation11/index.html#!using-xsl/performanceanalysis) to analyze stylesheets, and it's quite useful. I'd like to do the analysis from within eXist-db rather than the command line. For one, the performance could be different. But mainly because some stylesheets open documents in exist-db, and I can't run these from the command line. Is there a way to configure Saxon to output the profile.html document when it's run via eXist-db?
I was hoping there would be an attribute in conf.xml , or attributes that could be sent via transform:transform(), but I don't see any options related to the performance analysis tool.
I can't be certain this will work, but it's worth a try.
The $attributes parameter of Exist-db's transform() method allows you to set Saxon configuration properties. The available properties are listed at https://www.saxonica.com/documentation11/index.html#!configuration/config-features . You could try setting the properties TRACE_LISTENER_CLASS (to "net.sf.saxon.trace.TimingTraceListener") and TRACE_LISTENER_OUTPUT_FILE (to the required "profile.html" output file).
Incidentally, note that the performance is going to be different when you run with a trace listener. The profile generated using -TP is useful because it tells you which templates and functions are accounting for the most time and therefore need attention; the absolute numbers are not important or accurate. The hot spots will almost certainly be the same whether you are running within eXist or from the command line.
I can confirm this did work. Here's the XQL I used:
let $params :=
<parameters>
</parameters>
let $attributes :=
<attributes>
<attr name="http://saxon.sf.net/feature/traceListenerClass" value="net.sf.saxon.trace.TimingTraceListener"/>
<attr name="http://saxon.sf.net/feature/traceListenerOutputFile" value="/tmp/profile.html"/>
</attributes>
let $serialization := 'method=html5 media-type=text/html indent=no'
return transform:transform($xml, $xsl, $params, $attributes, $serialization)

How to override 'org.apache.cxf.stax.maxChildElements' property value inside a TomEE container?

I've got a JAX-WS web service endpoint configured purely via annotations running in TomEE 7 environment. Basically, the method being called has to return a List<String> of all node names contained in a graph data structure. The response of such a request can contain more thank 50k elements.
With CXF 2.6.x this worked fine. However, when I call the WS-method under CXF 3.x (bundled in TomEE 7.x), the following exception is thrown on the server side:
org.apache.cxf.interceptor.Fault: Unmarshalling Error: Maximum Number of Child Elements limit (50000) Exceeded
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:906)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:712)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:179)
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1680)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1559)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:653)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
at com.sun.proxy.$Proxy51.getAllNodeNames(Unknown Source)
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.stream.XMLStreamException: Maximum Number of Child Elements limit (50000) Exceeded]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:485)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:417)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:394)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:855)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:102)
at org.apache.cxf.jaxb.JAXBEncoderDecoder$2.run(JAXBEncoderDecoder.java:894)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:892)
... 21 more
Caused by: javax.xml.stream.XMLStreamException: Maximum Number of Child Elements limit (50000) Exceeded
at com.ctc.wstx.sr.InputElementStack.push(InputElementStack.java:340)
at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2951)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2839)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1073)
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:196)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:415)
... 27 more
Error: Maximum Number of Child Elements limit (50000) Exceeded
So far, I've read the official CXF documentation on this issue, checked a HowTo at the TomEE website and read many related, yet older posts in forums.
I tried to set the properties - as advised by the TomEE documentation - via openejb-jar.xml in the webservice's WEB-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar>
<ejb-deployment ejb-name="MyWebService">
<properties>
org.apache.cxf.stax.maxChildElements = 100000
</properties>
</ejb-deployment>
</openejb-jar>
I also tried with the shorter property cxf.stax.maxChildElements to check whether this would be accepted, yet without success.
For testing/debugging, I start the TomEE instance via the tomee-maven-plugin, Therefore, I tried the set the maxChildElement property as an environment property like so:
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>${tomee.plugin.version}</version>
<configuration>
<tomeeVersion>${tomee.version}</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
<debug>false</debug>
<tomeeHttpPort>8181</tomeeHttpPort>
<debugPort>5005</debugPort>
<args>-Dfoo=bar</args>
<skipCurrentProject>true</skipCurrentProject>
<webapps>
<webapp>my.ws:${webservice.artifact.name}:${webservice.artifact.version}?name=ws-endpoint</webapp>
</webapps>
<libs>
<!-- Third party libraries needed in the global lib folder of TomEE -->
<lib>log4j:log4j:${log4j.version}</lib>
</libs>
<systemVariables>
<!--
special property needed to allow for more childElements in StAX Parser
-->
<org.apache.cxf.stax.maxChildElement>100000</org.apache.cxf.stax.maxChildElement>
</systemVariables>
</configuration>
</plugin>
Sadly, it has no effect on the runtime configuration of CXF/StAX (Woodstox).
Question
How can we override the maxChildElements property via a configuration in openejb-jar.xml or as an external property at TomEE startup.
Finally, I got it working with the help of Romain Manni-Bucau (credits to him for pointing me into the right direction). Yet, his original answer is not the final solution. Therefore, I give the working configuration here.
1.) Put the following openejb-jar.xml to the WEB-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<openejb-jar>
<ejb-deployment ejb-name="MyWebService">
<properties>
cxf.jaxws.properties = cxfConfig
</properties>
</ejb-deployment>
</openejb-jar>
2.) Provide a new (or add to an existing) resources.xml file, again via WEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<Service id="cxfConfig" class-name="org.apache.openejb.config.sys.MapFactory" factory-name="create">
org.apache.cxf.stax.maxChildElements = 100000
</Service>
</resources>
Note well the configuration link via the MapFactory object with the id cxfConfig.
3.) Configure JAX-WS clients to set corresponding property as well. For instance, given a Spring client, this can be configured like so:
<bean id="wsClientProxy" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="com.acme.ws.jaxb.MyWebservice"/>
<property name="address" value="${ws.endpoint.url}"/>
<property name="properties">
<map>
<entry key="org.apache.cxf.stax.maxChildElements" value="100000" />
</map>
</property>
</bean>
In general, this might also be useful for people trying to set other CXF-related properties as listed in the XML section of the CXF security guideline, in particular to increase or decrease conservative default values.
I tested the above configuration steps successfully under a TomEE 7.0.3 and 8.0.9 environment, yet this should also reliably work with all 7.0.x and 8.0.x releases.
For other use cases, this blog post by Romain might also be worth reading, as it covers basic configuration concepts quite well.
Hope this helps others.
You can try
-Dorg.apache.cxf.stax.maxChildElements=100000
It should also work
I think you need to define a resources.xml with a Service of type (class-name) java.util.Properties and the properties inside:
openejb-jar.xml would get this property:
cxf.jaxws.properties = cxfConfig
resources.xml would get
org.apache.cxf.stax.maxChildElements = 1
This test does it programmatically: https://github.com/apache/tomee/blob/master/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/MaxChildTest.java

GATE java.lang.NullPointerException?

I am new in GATE and I am using it to conduct the machine learning. The configure file for Batching Learning PR is the following:
<?xml version="1.0"?>
-<ML-CONFIG>
<VERBOSITY level="1"/>
<SURROUND value="false"/>
<PARAMETER value="0.5" name="thresholdProbabilityClassification"/>
<multiClassification2Binary method="one-vs-others"/>
<EVALUATION method="kfold" ratio="0.66" runs="5"/>
<ENGINE options=" -p 50 -n 5 -optB 0.0 " implementationName="PAUM" nickname="PAUM"/>
-<DATASET>
<INSTANCE-TYPE>attitude</INSTANCE-TYPE>
-<NGRAM>
<NAME>ngram</NAME>
<NUMBER>1</NUMBER>
<CONSNUM>1</CONSNUM>
-<CONS-1>
<TYPE>Token</TYPE>
<FEATURE>root</FEATURE>
</CONS-1>
<!-- <CONS-2> <TYPE>Token</TYPE> <FEATURE>orth</FEATURE> </CONS-2> -->
</NGRAM>
-<ATTRIBUTE>
<NAME>Class</NAME>
<SEMTYPE>NOMINAL</SEMTYPE>
<TYPE>attitude</TYPE>
<FEATURE>feature</FEATURE>
<POSITION>0</POSITION>
<CLASS/>
</ATTRIBUTE>
</DATASET>
</ML-CONFIG>
The annotation I want the program to learn is called 'attitude', with feature called 'feature'. The value of the feature is just positive and negative.
However, every time I run the Batch Learning PR(Trainning mode), there will be an error like this:
java.lang.NullPointerException
at gate.learning.NLPFeaturesOfDoc.writeNLPFeaturesToFile(NLPFeaturesOfDoc.java:818)
at gate.learning.LightWeightLearningApi.annotations2NLPFeatures(LightWeightLearningApi.java:198)
at gate.learning.LearningAPIMain.execute(LearningAPIMain.java:594)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.creole.SerialController.runComponent(SerialController.java:225)
at gate.creole.SerialController.executeImpl(SerialController.java:157)
at gate.creole.SerialAnalyserController.executeImpl(SerialAnalyserController.java:223)
at gate.creole.SerialAnalyserController.execute(SerialAnalyserController.java:126)
at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
at gate.gui.SerialControllerEditor$RunAction$1.run(SerialControllerEditor.java:1728)
at java.lang.Thread.run(Unknown Source)
Since I can't debug during the midway within GATE, I don't understand what's wrong with the code.
Could anyone help?
Thanks!
I would suggest you to check file on which training process failed. It may happen that no features were produced by GATE (for example document content is empty and etc).

Where can I get adwords report response xml fixture/mock

Hi fellow stackoverflowers! :)
I am wiring my application with adwords API, and want it to display reports based on the retrieved data. My problem is that I am using test account that have no data that could be used for reporting, and so far us I understand testing account don`t provide any. According to the https://developers.google.com/adwords/api/docs/test-accounts#developing_with_test_accounts I should fake data. I am totally fine writing tests and feed then with fixtures, expect I can't find any relevant example of how the response XML will look like so I can create my own fixtures.
For example:
I want to pull campaign performance report, and segment it by Week
<reportDefinition>
<selector>
<fields>CampaignId</fields>
<fields>Clicks</fields>
<fields>Impressions</fields>
<fields>Week</fields>
<predicates>
<field>CampaignId</field>
<operator>EQUALS</operator>
<values>111111</values>
</predicates>
<dateRange>
<min>20150201</min>
<max>20150601</max>
</dateRange>
</selector>
<reportName>Campaign Performance Report NAme</reportName>
<reportType>CAMPAIGN_PERFORMANCE_REPORT</reportType>
<dateRangeType>CUSTOM_DATE</dateRangeType>
<downloadFormat>XML</downloadFormat>
<includeZeroImpressions>true</includeZeroImpressions>
</reportDefinition>
Which gives me response:
<report>
<report-name name="Campaign Performance Report NAme" />
<date-range date="Feb 1, 2015-Jun 1, 2015" />
<table>
<columns>
<column name="campaignID" display="Campaign ID" />
<column name="clicks" display="Clicks" />
<column name="impressions" display="Impressions" />
<column name="week" display="Week" />
</columns>
</table>
What will be the response with actual data? How it is going to look like in case segmentation will be set to: Date, Month, Quarter, Year?
I have tried to find any xml example on the web and github without luck. Can you please share response examples or point me to the doc, where it says how can I "generate" data for my test acount?
Thank you!
eolexe, I am assuming you did not receive an error for the Campaign Performance Report you tried to fetch. If that is the case then that means there was no match for the predicates and date range you had entered. This why you do not have the rows element within the XML. Also some attributes are are not filterable. But I am pretty sure the CampaignID is. Take a close look at the API just to be sure. You need to migrate to version 201502 because 201402 is deprecated and 201409's sunset day is in July.
I have been working on AdWords API for reporting purpose for years, and I can tell you up till now there is still no official sample XML or CSV given. So I simply test the program using real account data...
I don't pick XML as the response type so I cannot really address your question, but you may wish to know that the XML response does not return a total row. That's why I always pick CSV/TSV format.

JobDataMap for trigger in Quatz jobs xml

I am running into an issue setting the job data map for the trigger in Quartz. I know it's possible pro grammatically, but I need to do it in the xml jobs file. However, every time I try to add it to the trigger, it says that job-data-map is invalid. Looking at the XSD (http://www.quartz-scheduler.org/xml/job_scheduling_data_2_0.xsd) for the jobs file, it looks like it should be a valid child of the cron tag because it inherits abstractTriggerType, but my app won't accept it.
Here is my code. I am using Quartz.Net 2.0
<job>
<name>StagingJob</name>
<job-type>MyAssembly.StagingJob, MyAssembly</job-type>
<durable>true</durable>
<recover>false</recover>
</job>
<trigger>
<cron>
<name>StagingTrigger</name>
<job-name>StagingJob</job-name>
<misfire-instruction>SmartPolicy</misfire-instruction>
<job-data-map>
<entry>
<key>end-time-cron</key>
<value>0 59 * * * ?</value>
</entry>
<entry>
<key>thread-count</key>
<value>3</value>
</entry>
</job-data-map>
<cron-expression>0 1 * * * ?</cron-expression>
</cron>
</trigger>
What is the correct way to add job data to the trigger via xml?
Try removing the element misfire-instruction, smart policy is the default anyway. If you'd like to keep the element, it should come after the job-data-map element. Quartz is quite strict about ordering of XML elements.
Visual Studio should also give you intellisense with this document if you set Schemas in VS property window point to XSD file included in the distribution.

Resources