Post Request via PX trigger

Hello,
We have a requirement to transfer chunks of data to a web service client when a PX is triggered. We have decided to convert the data to XML format and transfer it via HTTP Post request.  We’re using Apache HTTPCore API for the post request and below is the code. But on triggering the PX we’re receiving error message – org/apache/http/HttpEntity. I have added the screenshot below the code. Can you kindly advise.

HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(“http://xyz”);
StringEntity e = new StringEntity(writer.toString());
request.addHeader(“content-type”, “application/xml”);
request.setEntity(e);
HttpResponse response = httpClient.execute(request);

Post Request via PX trigger

Add Comment
1 Answer(s)

Hi
The error message is typical of a Class Not Found Exception.
This happens when the jar used as third party dependency is not in your classpath or lib folder (to don’t confuse with Process Extensions folder).

From https://blogs.oracle.com/jiechen/entry/into_agile_sdk_class_loader
<<The class is the type of dynamic class loading during JVM runtime, not at JVM initialization with specified classpath, so it will not be referenced by px.ClassManager automatically because px.ClassManager uses a customized URLClassLoader to load specified class ( just META-INF/ICustomAction or IEventAction files) and references.
That is to say, the newly loaded class1.class only be referenced during runtime on demand, not by URLClassLoader. In this case, there is no such class1.class mapping in jvm class stack. So you will see ClassNotFoundException.>>

To overcome this, the to be loaded class “HTTPEntity” should be added to App Server’s shared library.

Please refer to that guide to deploy a third party library section 3.9 to deploy a class using Weblogic (or OAS if it is an old version)
http://docs.oracle.com/cd/E50306_27/otn/pdf/integration/html_agaaq/output/chapter_3.htm

 

Agile Angel Answered on March 7, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.