Unable To Invoke ESB Routing Service Externally Using HTTP Post - Faults With Truncated Output (Doc ID 736854.1)

Last updated on NOVEMBER 03, 2016

Applies to:

Oracle ESB - Version: 10.1.3 and later   [Release: AS10gR3 and later ]
Information in this document applies to any platform.
***Checked for relevance on 30-Sep-2010***

Symptoms

When executing a SOAP call using the HTTP POST method to an ESB service the result fails with a SOAP fault.

Note : The call works fine when using the ESB SOAP Endpoint URI from ESB Control.


Using a Java client set the URL to the ESBEndpoint location of the ESB service and set the SOAPActionURI as "CustInfoDemo" in this example.

conn.setRequestProperty("SOAPAction", "CustInfoDemo");

The following error message is returned by the ESB server, Notice CustInfoDemo is truncated below to ustInfoDem:
 

<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><env:Fault
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>env:ESBMessageProcessingFa
iled</faultcode><detail><EventName>DefaultSystem.DemoESBTesting.ustInfoDem</Eve
ntName><Cause/></detail></env:Fault></env:Body></env:Envelope>

Example of invoking the ESB service using the HTTP Post method using a Java client

As an example of invoking the ESB service using the HTTP Post method, start with the following Java client code ESBDemoAppClient.java to trigger the ESB service using the HTTP Post method in this case the key line, as also mentioned above, is:

conn.setRequestProperty("SOAPAction", "CustInfoDemo");

 

public class ESBDemoAppClient{

public static void main(String[] args) throws Exception{
System.out.println("Calling Process");


String soapxml = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body xmlns:ns1=\"http://modresponse/types/CustInfo\"><ns1:CustInfo><ns1:CUST_ID>Oracle</ns1:CUST_ID> <ns1:CUST_NAME>test</ns1:CUST_NAME> </ns1:CustInfo></soap:Body></soap:Envelope>";

System.out.println("XMLString:"+soapxml);

java.net.URL url = new java.net.URL("http://test.server.com:8888/orabpel/default/ESBDemoProcess1/1.0");

java.net.HttpURLConnection conn =(java.net.HttpURLConnection)url.openConnection();
System.out.println("Connection opened::"+conn.toString());
conn.setDoOutput(true);
System.out.println("tp1");
conn.setDoInput(true);
System.out.println("tp2");
conn.setRequestMethod("POST");
System.out.println("tp3");
conn.setRequestProperty("Content-Type", "text/xml;charset=utf-8");
System.out.println("tp4");
conn.setRequestProperty("Content-Length",Integer.toString(soapxml.length()));
System.out.println("tp5");
conn.setRequestProperty("SOAPAction", "CustInfoDemo");
System.out.println("tp6");
java.io.PrintWriter writer = new java.io.PrintWriter(new java.io.BufferedWriter(new java.io.OutputStreamWriter(conn.getOutputStream(),"UTF-8")));
System.out.println("tp7");
writer.print(soapxml.toString());
System.out.println("tp8");
writer.flush() ;
System.out.println("tp9");
writer.close();
System.out.println("tp10");
java.io.InputStream is = conn.getInputStream();
System.out.println("tp11");
System.out.println("Input Stream::"+is.toString());
java.io.InputStreamReader isr = new java.io.InputStreamReader(is);
java.io.BufferedReader br = new java.io.BufferedReader(isr);
String line = null;
System.out.println("Response from server:\n");
while ( (line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
isr.close();
//writer.flush() ;
// writer.close();


}
}


In order to trigger the process using the Java code above the following steps can be followed, run these steps on the ESB server itself:

a) Compile ESBDemoAppClient.java using command javac ESBDemoAppClient.java, this will produce a
ESBDemoAppClient.class file.

b) You can run this ESBDemoAppClient.class file from the jdk 1.4.2 provided with the iAS, e.g. from $OH/jre/1.4.2/bin as ./java ESBDemoAppClient. This will produce the error.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms