cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronous Java Proxy Server template - filling reponse message elements

Former Member
0 Kudos

Hi !

I'm writing a java proxy server for a synchronous interface. I'm somehow new in java...and I don't know how should I create elements for my response message inside the java method used to process the request message.

The response message format is something like this:

<field1>abc</field1>

<field2>

....<field2a>

........<fields2a1>

........</fields2a1>

....</field2a>

....<field2a>

....</field2a>

</field2>

according to the type "DT_Output_Type" type of the public class MyMethod defined in the java template generated by XI repository..

I think I should do something like this:

-


DT_Output_Type response = new DT_Output_Type();

DT_Output_Type.field2_List field2values = new DT_Output_Type.field2_List();

field2values.setfield2a(0,"1234");

response.setfield1 = "abc";

response.setfield2(field2values);

return response;

-


But I receive "Error invoking method". If I comment out the code where I assign values to sub-elements, everything works ok.

Thanks !

Matias

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

>>response.setfield1 = "abc";

dont you think this is wrong and it should be

response.setfield1("abc");

this is because setfield1 is a method and you are trying to use it like a member variable in the code.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi. It worked. I also read the SAP's Enabling Application-to-Application Processes PDF that explained how to deal with the structures provided by the generate proxy function.

Thanks.

Matias.

Former Member
0 Kudos

Hi Matias,

>><i>DT_Output_Type.field2_List field2values = new DT_Output_Type.field2_List();</i>

This will create instance for field2 only.

Before setting field2a using <i>field2values.setfield2a(0,"1234");</i> you must creat instance of field2a and also for field2a1.

I guess field2a will be an array.

so the order of creating instance and setting values can be ...

1. create instance of field2

2. create instance of field2a array

3. create instance of first array element of field2a

4. create instance of field2a1

5. set value for field2a1

6. set field2a1 in first array element of field2a

repeat steps 3-6 for next elements of field2a

7. set field2a array object (created in step 2) in field2

8. response.setfield2(field2values);

Also,

as mentioned by Amol, set value for filed1 should be

response.setfield1("abc");

Regards,

Uma