Skip to Content
avatar image
Former Member

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

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Aug 04, 2009 at 09:34 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • avatar image
    Former Member
    Aug 04, 2009 at 12:03 PM

    Hi Liu,

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 04, 2009 at 02:58 PM

    Thanks all...

    It's OK

    Add comment
    10|10000 characters needed characters exceeded