cancel
Showing results for 
Search instead for 
Did you mean: 

XI Http adapter receiver issue, how to change the target payload format

Former Member
0 Kudos

Dear all,

In my project, I need to call a servlet program using Http/xml.

The message format accepted by the server program is like this:

request:

<?xml version="1.0" encoding="GBK"?>

<PACKET type="REQUEST" version="1.0" >

<HEAD>

<REQUEST_TYPE>01</REQUEST_TYPE>

</HEAD>

<BODY>

<BASE_PART>

<QUERY_SEQUENCE_NO></QUERY_SEQUENCE_NO>

</BASE_PART>

</BODY>

</PACKET>

response:

<?xml version="1.0" encoding="GB2312"?>

<PACKET type="RESPONSE" version="1.0" >

<HEAD>

<REQUEST_TYPE>01</REQUEST_TYPE>

<RESPONSE_CODE>1</RESPONSE_CODE>

<ERROR_CODE>0000</ERROR_CODE>

<ERROR_MESSAGE>xxx</ERROR_MESSAGE>

</HEAD>

<BODY>

<BASE_PART>

<QUERY_SEQUENCE_NO>01PICC057106001156421487812453</QUERY_SEQUENCE_NO>

</BASE_PART.

</BODY>

<PACKET>

My first question is if I can use the servie by SAP PI http adapter?

If yes, and how to design the data type? The <HEAD> <BODY> are on the same level...

Commonly, I only can set the data type like this:

<?xml version="1.0" encoding="UTF-8"?>

<MT_HTTP_IN>

<HEAD>

<REQUEST_TYPE>1</REQUEST_TYPE>

</HEAD>

<BODY>

<BASE_PART>

<QUERY_SEQUENCE_NO>123</QUERY_SEQUENCE_NO>

</BASE_PART>

</BODY>

</MT_HTTP_IN>

The problem is how to remove the <MT_HTTP_IN> then insert the tab <PACKET type="REQUEST" version="1.0" >? I wonder if I need use JAVA mapping? and could u give me a related samples?

Thanks a lot!

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

Can't you have name of the Message Type as PACKET instead of MT_HTTP_IN?

Also, you may have attribute while creating datatype to accommodate "type =request" and version=1.0.

Regards,

Prateek

Former Member
0 Kudos

Hi Prateek,

Thanks for your quick reply!

But where can I input the "type =request" and version=1.0 while creating the Date type?

And if I use the PACKET instead MT_HTTP while creating the message type, can the payload be set as "<PACKET type="REQUEST" version="1.0" >"?

JaganMohan
Participant
0 Kudos

Dear Xun Liu,

If you need <PACKET type="REQUEST" version="1.0" >, then you need to create attributes 'type' and 'version' under node <PACKET>. At mapping level you can pass constant values for those attibutes.

Regards,

JP.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks all...

It's OK

prasannakrishna_mynam
Contributor
0 Kudos

Hi Liu,