SagJavaObjectGateway.

Hi,

I am using SagJavaObjectGateway to call a class with a method greet() which has the following signature.

public String greet(String input) {
return "Happy XMas " + input;
}

My client is a Natural code which calls a Java RPC server which inturn forwards the request to a sequence. I am then extracting the input from the request and passing it to the class using SagJavaObjectGateway.

The string returned from method is stored in the property resultstring as I have added the property xbd.object.property=“resultstring” in the step

I have copied the sequence below in a document which is attached.

    <set>
    <step>
    <step>
    <step>
    <step>

How do I pass this result back to the natural client.

Simply put, Is there any way of working with the response of SagJavaObjectGateway call?

Also Is it possible to use a JavaObjectGateway to invoke a method which has custom objects as input and return type?

Thanks a lot in advance. Any help would be highly appreciated.

Thanks,
Gijish
SAGJavaObjectGateway.doc (24 KB)

Hi Gijish,

How you return the result of your Java call to Natural depends entirely on how you have programmed the RPC Server you are using to initiate sequence processing.
The Service Orchestrator is set up to accept processing requests via “XML over HTTP”, SOAP, JMS, “File System” and EMail. Keeping in mind that the Service Orchestrator is designed to process messages based on XML, the property value you obtain from the Java Object Gateway could be placed into some XML Node using a Set Target step. That same XML could then be returned as the processing response.

A simpler way of implementing your own java code would be to implement a custom component as described in the documentation. To support that effort, the Service Orchestrator provides an API to simplify interactions with the sequencer. In both cases, JavaObejectGateway and Custom Component, you are limited to passing either String or Byte objects to your class. This is due to the way the various data within sequence processing is represented.
If you have some unalterable classes you would like to use, you might consider wrapping that class in your own code and doing some conversions of the data you pass in as string or byte to enable the class call.

Regards,

Hi Matthew,

Thanks a lot for your response. I have two queries.

“In both cases, JavaObejectGateway and Custom Component, you are limited to passing either String or Byte objects to your class” -

Does your above statement means that if I am going to call a method of a Java class then the method can only accept parameters of type String or Byte Array? If yes then this is imposing a strict restriction on how a method should be written instead of calling an existing method.

My second query is w.r.t.o custom component. I looked into the documentation and it looks like each component has to be registered in SMH. So if i need to call 10 methods then do I need to write 10 components and register them in SMH. If yes then this will increase the number of components significantly and again with the restriction of String or Byte Array types that could be used, it looks like JOG could be used to invoke simple Java methods from sequence.

I have a method which looks like this.

public ResponseVO greetMeSecondTime(RequestVO reqObj) {

}

public class RequestVO {

            private int requestId;
private String requestMessage;

}

public class ResponseVO {

private Status status;
private String responseMessage;

}

public class Status {

private int statusCode;
private String statusText;

}

As seen the request param is a Java Object and response is another Java object. Is this mehtod invocable from sequence using JOG.

Thanks,
Gijish

Hi Gijish,

As I mentioned in my initial reply, the restriction to string and byte is entirely controlled by the environment the API is to be used in. Service Orchestrator properties are maintained as strings and the message object as a byte array therefore other data types were not considered. If you can provide some valid use cases for other data types you should probably open an enhancement proposal in ServLine24.

In short, the method you provided as an example is not callable from your sequence.

Your question about custom components is a common one. Actually, you do not have to write and register multiple components for the various methods you want to implement. Most users create a single component which contains numerous methods, all having different signatures and uses. You can of course use the JOG instead but you may have to rewrite entire sequences to re-implement the methods again. If you create a custom component then you can reuse the methods quite easily using drag and drop.

Regards,