Hi,
We are trying to build a page and call a RightNow (Oracle Service Cloud) web service to show Incident Data on this page.
Creation of the proxy for the RightNow webservice in JDeveloper failed. The error was due to duplicate declarations and there was not much that could be done to fix that as the RightNow WSDL as it is very generic in nature.
Hence we achieved retrieving data from RightNow service by making a HTTP POST request. To achieve this, we used Libraries like httpclient-4.5
Code snippet from the java class.
/************************* Code snippet starts **************************************/
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.GzipCompressingEntity;
import org.apache.http.client.entity.GzipDecompressingEntity;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
public class TestHTTPPost {
/** main method to call sendPost2 omitted. **/
// HTTP POST request method
private String sendPost2() throws Exception, Throwable {
String url = "https://opn-deloitte-us.rightnowdemo.com/cgi-bin/opn-deloitte-us.cfg/services/soap";
String urlParameters = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
" <soapenv:Header>\n" +
" <ns7:ClientInfoHeader xmlns:ns7=\"urn:messages.ws.rightnow.com/v1_2\" soapenv:mustUnderstand=\"0\">\n" +
" <ns7:AppID>Basic Get</ns7:AppID>\n" +
" </ns7:ClientInfoHeader>\n" +
" <wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" mustUnderstand=\"1\">\n" +
" <wsse:UsernameToken>\n" +
" <wsse:Username>ssalian</wsse:Username>\n" +
" <wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">ssalian</wsse:Password>\n" +
" </wsse:UsernameToken>\n" +
" </wsse:Security>\n" +
" </soapenv:Header>\n" +
" <soapenv:Body>\n" +
" <ns7:QueryCSV xmlns:ns7=\"urn:messages.ws.rightnow.com/v1_2\">\n" +
" <ns7:Query>SELECT I.*,I.CustomFields.c.osc_customer_id FROM Incident I WHERE I.CustomFields.c.osc_customer_id='3030303030'</ns7:Query>\n" +
" <ns7:PageSize>10000</ns7:PageSize>\n" +
" </ns7:QueryCSV>\n" +
" \n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("Accept-Language", "en-US,en;q=0.5");
httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
httpPost.setHeader("SOAPAction", "Get");
StringEntity stringentity=new StringEntity(urlParameters,"UTF-8");
GzipCompressingEntity gzipEntity = new GzipCompressingEntity(stringentity);
httpPost.setEntity(gzipEntity);
CloseableHttpResponse response2 = httpclient.execute(httpPost);
try {
System.out.println("Response Code : "
+ response2.getStatusLine().getStatusCode());
BufferedReader rd = new BufferedReader(
new InputStreamReader(response2.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println("Result - " + result.toString());
HttpEntity entity2 = response2.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
EntityUtils.consume(entity2);
return result.toString();
} finally {
response2.close();
}
} catch (Throwable t) {
System.err.println(t);
throw (t);
} finally {
httpclient.close();
}
}
/************************* Code snippet ends**************************************/
this code works perfectly while the app is deployed in the local/integrated weblogic server. But when we try to deploy the application the the JCS, we are seeing some compilation failure errors as below.
/************************* Deployment Log section starts**************************************/
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: jsf, Specification-Version: 1.2, Implementation-Version: 1.2.9.0 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: jsf, Specification-Version: 2, Implementation-Version: 1.0.0.0_2-0-2 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: jstl, Specification-Version: 1.2, Implementation-Version: 1.2.0.1 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: UIX, Specification-Version: 11, Implementation-Version: 11.1.1.1.0 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: ohw-rcf, Specification-Version: 5, Implementation-Version: 5.0 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: ohw-uix, Specification-Version: 5, Implementation-Version: 5.0 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: oracle.adf.desktopintegration.model, Specification-Version: 1, Implementation-Version: 11.1.1.2.0 (EAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: oracle.adf.desktopintegration, Specification-Version: 1, Implementation-Version: 11.1.1.2.0 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: jax-rs, Specification-Version: 1.1, Implementation-Version: 1.9 (WAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: fluent-hc, Specification-Version: 4.5, Implementation-Version: 4.5 (JAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: httpclient, Specification-Version: 4.5, Implementation-Version: 4.5 (JAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: httpclient-cache, Specification-Version: 4.5, Implementation-Version: 4.5 (JAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: httpclient-win, Specification-Version: 4.5, Implementation-Version: 4.5 (JAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: httpcore, Specification-Version: 4.4.1, Implementation-Version: 4.4.1 (JAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: httpmime, Specification-Version: 4.5, Implementation-Version: 4.5 (JAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: commons-codec-1.9, Specification-Version: 1.9, Implementation-Version: 1.9 (JAR).>
<Jul 22, 2015 6:51:35 PM GMT> <Info> <J2EE> <BEA-160151> <Registered library Extension-Name: commons-logging-1.2, Specification-Version: 1.2, Implementation-Version: 1.2 (JAR).>
<Jul 22, 2015 6:51:39 PM GMT> <Info> <J2EE> <BEA-160186> <Compiling EAR module 'RightNowHttpCall01_ViewController_webapp.war'>
Unresolved WebApp library references defined in weblogic.xml, of module 'RightNowHttpCall01_ViewController_webapp.war' [Extension-Name: commons-codec-1.9, Specification-Version: 1.9, Implementation-Version: 1.9, exact-match: false], [Extension-Name: commons-logging-1.2, Specification-Version: 1.2, Implementation-Version: 1.2, exact-match: false], [Extension-Name: fluent-hc, Specification-Version: 4.5, Implementation-Version: 4.5, exact-match: false], [Extension-Name: httpclient, Specification-Version: 4.5, Implementation-Version: 4.5, exact-match: false], [Extension-Name: httpclient-cache, Specification-Version: 4.5, Implementation-Version: 4.5, exact-match: false], [Extension-Name: httpclient-win, Specification-Version: 4.5, Implementation-Version: 4.5, exact-match: false], [Extension-Name: httpcore, Specification-Version: 4.4.1, Implementation-Version: 4.4.1, exact-match: false], [Extension-Name: httpmime, Specification-Version: 4.5, Implementation-Version: 4.5, exact-match: false]
/************************* Deployement Log section Ends**************************************/
/************************* Library references in weblogic.xml starts**************************************/
<library-ref>
<library-name>jstl</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2.0.1</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>jsf</library-name>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>commons-codec-1.9</library-name>
<specification-version>1.9</specification-version>
<implementation-version>1.9</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>commons-logging-1.2</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>fluent-hc</library-name>
<specification-version>4.5</specification-version>
<implementation-version>4.5</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>httpclient</library-name>
<specification-version>4.5</specification-version>
<implementation-version>4.5</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>httpclient-cache</library-name>
<specification-version>4.5</specification-version>
<implementation-version>4.5</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>httpclient-win</library-name>
<specification-version>4.5</specification-version>
<implementation-version>4.5</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>httpcore</library-name>
<specification-version>4.4.1</specification-version>
<implementation-version>4.4.1</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<library-ref>
<library-name>httpmime</library-name>
<specification-version>4.5</specification-version>
<implementation-version>4.5</implementation-version>
<exact-match>false</exact-match>
</library-ref>
/************************* Library references in weblogic.xml Ends**************************************/
As can be seeing in the log, at the end of the log section we can see the error "Unresolved WebApp library references defined in weblogic.xml" inspite of the libraries being deployed on the cloud JCS.
from the below link, we see that the apache httpcomponents do not fall into the supported list of frameworks for JCS. Could this be the reason for the deployment failure?
http://docs.oracle.com/cloud/latest/javacs_gs/CSJSU/GUID-5C35C6E5-2DC4-4674-83E3-1B1B90B950D7.htm#CSJSU7120
Any help/inputs would be deeply appreciated. Many Thanks!
Nimanshu Parekh