cancel
Showing results for 
Search instead for 
Did you mean: 

Message and Java Mapping

Former Member
0 Kudos

Hello -

I have a java mapping and a message mapping implemented in one interface.

Java mapping basically adds a header and does nothing else.

Message mapping has all the mapping. Its not complex but straight.

I have the Message mapping first and then the Java mapping in the Interface Mapping.

what happens is i could see the headers written through Java mapping in my output xml file which is good but i cannot view the message mapping output in the file.

Any ideas.

Thanks,

Tirumal

Accepted Solutions (0)

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Tirumal,

i think there might be cache problem (or you forgot to activate your changed Interface Mapping). Copy the Interface Mapping and refer the copy in Inteface Determination to check out.

Regards,

Udo

moorthy
Active Contributor
0 Kudos

Hi,

Is your output of Message Mapping is input to Java Mapping? If so, then i think there will not be any problem.

Also check the checkbox of Maintain Order at Runtime in the Interface Determination ?

Are you able to test in the Interface Mapping Editor ? Test with giving data (first input i.e input to Message Mapping)and check are you getting required output after your Java Mapping.

Hope this helps.

Regards,

Moorthy

Former Member
0 Kudos

Hi

I am generating the headers in the java mapping using this:

public void startDocument ()

throws SAXException {

write("<?xml version='1.0' encoding='UTF-8'?>");

write("<!DOCTYPE cXML SYSTEM 'http://xml.cxml.org/schemas/cXML/1.1.008/cXML.dtd'>");

}

Maintain Order at Runtime is checked in the Interface Determination.

Ok, in the interface Mapping Editor i get 2 messages:

1.

11:09:48 Start of test

Call method execute of the application Java mapping com.sap.xi.tf._Orders_MM_

Java mapping com/sap/xi/tf/_Orders_MM_ completed. (execute() of com.sap.xi.tf._Orders_MM_

Call method execute of the application Java mapping com.sap.aii.mapping.api.SampleWithSaxParser

Java mapping com/sap/aii/mapping/api/SampleWithSaxParser completed. (execute() of com.sap.aii.mapping.api.SampleWithSaxParser

Executed successfully

11:09:48 End of test

2. XML not well formed

None of the above messages seem to be of Message Mapping don't know why its not getting written in the output.

Thanks,

Tirumal

moorthy
Active Contributor
0 Kudos

HI,

As suggested , check for Cache First.

And one more thing, just check your Java Mapping independently, so that you will make sure that java mapping is working fine. While testing Java Mapping independenty, give the output of Message Mapping and check are you getting required output or not>>

You can check the cache in SXI_CACHE in XI ABAP stack.

Regards,

Moorthy

Former Member
0 Kudos

Hi -

When you say , give the output of Message mapping, should i give it in a file format and see if i am getting the desired output from the java program?

Thanks

Tirumal

moorthy
Active Contributor
0 Kudos

<i>**When you say , give the output of Message mapping, should i give it in a file format</i>

Your Java Mapping will read the XML input,pasre the input and produce the xml output. SO you need to give xml output of Message Mapping. Not in a file format.

Hope this helps

Moorthy

Former Member
0 Kudos

Hi -

Lets say this is the output from the message mapping:

<Orders_MT>

<OrderID>123123</OrderID>

<OrderDate>2006-04-05</OrderDate>

<Amount>100</Amount>

</Orders_MT>

How do i give the above message mapping output to the Java input? I mean should i fill in the functions for the startelement, endelement in the java program(sax parser).

Thanks,

Tirumal

moorthy
Active Contributor
0 Kudos

I think , in your case, it is happening in this way. You are doing Message Mapping and in the Java Mapping you are just writing headers. So you are getting output like that. Am I right ? So it is overwriting your message mapping

You can use multiple mappings for the interface, provided output of first mapping will be input to next mapping like this. Then only, I think purpose will be solved.

In your case, in the Java Mapping, you need to parse entire xml message (i.e ouput of Message Mapping), and while writing the output , produce the message such way that, you get the header first and rest all next.

If , Java Mapping means, you need to use SAX/DOM parser. and all the events. But in your case, you can easily write the output message in the endDocument Event...

Pls acknowledge

Regards,

Moorthy

Former Member
0 Kudos

Hi,

You are right. I am doing message mapping and then the Java mapping.

In this scenario i have modified the java functions startElement, endElement, endDocument, startDocument to get the output.

Then i supplied this output to my Java Mapping program. It worked here independently.

I made up the jar file and imported it again and tested the mapping.

This time it worked.

I did get the output as desired. Now the real part comes as testing with the real file a very huge file.

Thanks for your patience. Will award you points.

Thanks,

Tirumal

Former Member
0 Kudos

Hi,

You are right. I am doing message mapping and then the Java mapping.

In this scenario i have modified the java functions startElement, endElement, endDocument, startDocument to get the output.

Then i supplied this output to my Java Mapping program. It worked here independently.

I made up the jar file and imported it again and tested the mapping.

This time it worked.

I did get the output as desired. Now the real part comes as testing with the real file a very huge file.

Thanks for your patience. Will award you points.

Thanks,

Tirumal

Former Member
0 Kudos

Hi -

How can i write the entire output generated through message mapping in the endDocument if Message mapping is the first and Java mapping is the second in the interface mapping?

Thanks,

Tirumal

moorthy
Active Contributor
0 Kudos

Hi,

Gerat, Nice to hear that it worked.

You can store entire document into a list and then populate the entire list in the endDocument event. This store should happen in the startElement event while pasrisng the message (Message Mapping output).

Anyway it is depend on the complexity of the mapping, logic,feasibilit etc.

Thanks,

Moorthy