../E10229-13.mobi />

26 Programmatically Accessing Instance Message Data

This chapter provides an overview of the Instance Message Java API for programmatically accessing instance message data.

This chapter contains the following topics:

For more information about the Instance Message API, InstanceMessageUtil class, see Oracle Fusion Middleware B2B Instance Message Java API Reference.

26.1 Programmatically Accessing Instance Message Data

Instance Message Java API is a Java API provided in Oracle B2B to retrieve runtime data that is exchanged between Trading Partners.

Some Instance Message Java API use cases include:

  • Resubmitting from a back-end application

  • Checking the status for a particular order number

  • Payload introspection by a back-end application

  • Checking the remaining retries for the message

  • Checking the wire message of the payload

Instance Message API queries the runtime data and provides results in the form of Instance data for various criteria. Instance Message API is a java wrapper on top of Instance Message View which encapsulates both business and wire messages.

Note:

When using this API, you must set additional libraries as part of the classpath in addition to b2b.jar and weblogic.jar or wlthint3client.jar.

Instance Message API Query Options

The Instance Message Java API enables you to retrieve the instance messages based on the following criteria:

  • Agreement name

  • Control number, group control number, transaction control number, Trading Partner name, and document type

  • Date range and Trading Partner

  • Date range, direction, and Trading Partner

  • Message ID

  • Message state

  • Protocol message ID

  • Trading Partner

  • Trading Partner and direction

  • Trading Partner and document type

  • Trading Partner and message state

  • Xpath expression (can be evaluated on one or two XPath expressions)

  • XPath value (can be evaluated on one or two XPath expressions)

  • Conversation ID

For more information about the Instance Message API, see Oracle Fusion Middleware B2B Instance Message Java API Reference.

26.2 Instance Message Java API Examples

You can write your logic based on the out put of

Vector messages = (Vector) imUtil.getInstanceMessagesForTP("GlobalChips")

as shown in Example 26-1.

Another similar exposed method is getInstanceMessagesForMsgId(String messageId). All of the methods are documented in Oracle Fusion Middleware B2B Instance Message Java API Reference.

Example 26-1 Retrieval based on Trading Partner Name

import java.util.Vector;
import oracle.tip.b2b.utility.InstanceMessageUtil;
 
public class MyInstanceData {
    public static void main(String[] args) throws Exception {
 
        InstanceMessageUtil imUtil = new InstanceMessageUtil();
        Vector messages = (Vector) imUtil.getInstanceMessagesForTP("GlobalChips");
        System.out.println(messages.size());
    }
}

26.3 Troubleshooting Instance Message Java API

See the following topics for troubleshooting information:

26.3.1 Handling a Large Number of Messages

If the query returns a large number of messages then the weblogic.socket.MaxMessageSizeExceededException may occur.

To recover from this issue, increase weblogic.MaxMessageSize, and pass -Dweblogic.MaxMessageSize=100000000 in the client command line. This parameter setting will allow you to receive 100 MB messages.

For example:

java -cp
.:$ORACLE_HOME/wlserver_10.3/server/lib/wlthint3client.jar:$SOA_HOME/
/soa/modules/oracle.soa.b2b_11.1.1/b2b.jar
-Dweblogic.MaxMessageSize=100000000 TestInstanceMsg

26.3.2 Handing Large Payloads

Rather than return the payload itself, a large inbound or outbound payload will return as a reference to the location of the payload.

For example:

/tmp/GlobalChips_1_custnonxml_largepayload.dat@9844C4341297D3EB7B60000011A0CC9D
.dat 

See Appendix A, "Handling Large Payloads" for more information about how Oracle B2B handles large payloads.

26.3.3 Executing Queries Remotely Using Weblogic.jar

If while using weblogic.jar and executing queries remotely you may see classpath issues for Oracle WebLogic Server, and the java.lang.ClassNotFoundException:weblogic.security.subject.AbstractSubject exception.

To recover, execute queries using wlthint3client.jar.

For example:

java -cp
.:$ORACLE_HOME/wlserver_10.3/server/lib/wlthint3client.jar:$SOA_HOME/
/soa/modules/oracle.soa.b2b_11.1.1/b2b.jar TestInstanceMsg