Hello All

I have tried to consolidate the issues I faced during PI 3.1 to PO 7.5 upgrade and replacement of Advantco rest to SAP REST adapter.

IPAD sends Json request to PO, where json to xml conversion was done and request was sent to CRM .CRM then sends back the xml to PO where after xml to json conversion it was sent back to IPAD.  This synchronous scenario used  SAP REST sender adapter and Soap receiver (Proxy).

The issues listed in a series of Issue # 1 to 10. Each is provided with a set of solution steps and diagrams wherever possible.

Below links, inputs from Colleagues (Anupam gosh, Farooq Ahmed and Amit Gupta) and Forums were of big help indeed.

https://blogs.sap.com/2014/12/18/pi-rest-adapter-json-to-xml-conversion/2016/

https://blogs.sap.com/2014/12/18/pi-rest-adapter-blog-overview/

System Information:

SAP version used: SAP PO 7.5 SP6 (later upgraded to SP7)

Scenario: IPAD =>PO=>CRM : Scenario: Synchronous IPAD (JSON) to ECC (Proxy)

IPAD sends JSON request to SAP PO which is then sent to CRM using proxy. CRM then sends XML response back to PO where after the XML to Json conversion it is sent back to IPAD.

  • Scenario – End to End Data Flow Diagram

Rest your SAP REST Adapter issues with some Troubleshooting Tips

Issue # 1

  1. Missing MessageType Tag in Response: This issue occurred when there was no MessageType Tag found in the JSON response to IPAD.

        Error: As depicted below in incorrect json response – there was no “ iPadLoginResponseMT “          tag seen which in turn was not able to get parsed by IPAD app because of this missing tag.

         Incorrect Response: Below Json response received from PO contained no MessageType tag .

       Response Data                          

        {           successResponse =         {

            partnerID = xxxxx;

        };}

      Correct Response: Below was the expected json response . 

      Response Data

       {    iPadLoginResponseMT =     {

        successResponse =         {

            partnerID = xxxxx;        };    };}

Solution: Below XSL mapping help adding the MT tag in the jason and hence was placed at response message in the Operational Mapping resolved the issue.

XSLT Mapping:

  

    

  

   “*[not(@*|*|comment()|processing-instruction())

     and normalize-space()=”

     ]”/>

Issue # 2

Attachment not supported: IPAD sends Json Request with an attachment of type Attachment.jpeg  to PO which is further sent to CRM using proxy.

Error:

Json request with an attachment was not sent to CRM Applicatioon as Sender SAP REST adapter did not support attachments.

Solution:

  • SP6 upgrade to SP7 has the feature of support attachment in it (below screen)
  • Update ESR metadata

In SAP PO SAP REST Adapter SP6 does not supports attachment hence upgrading to SP7 (below snapshot) Worked.

Rest your SAP REST Adapter issues with some Troubleshooting Tips

**Main Request payload name can be left blank.

Issue # 3

Incorrect ContentType: IPad send Json Request message with an attachment “attachment.jpg” to the CRM receiver.In PO, the content type of attachment is incorrect.

Error:

Json request with an attachment was received in CRM system of type application/json than application/xml.

Application document of type application/json than application/xml was received and seen in PO

Rest your SAP REST Adapter issues with some Troubleshooting Tips

Below snapshot is from the SXMB_MONI-CRM(receiver) where apart from MainDocument, attachment is received as highlighted below than as Attachment (image/jpeg).

Rest your SAP REST Adapter issues with some Troubleshooting Tips

Solution:

After a Module was placed in SAP sender REST channel before the standard SAP adapter call.

AF_Modules/MessageTransformBean

Transform.ContentType ContentType = application/xml

Rest your SAP REST Adapter issues with some Troubleshooting Tips

Input message format in sender SAP REST channel was maintained as below,

Rest your SAP REST Adapter issues with some Troubleshooting Tips

Issue # 4

Missing Double quotes: In the Response Json Message, double quotes was missing in some of the field values which could not be parsed at IPAD end and resulted in error.

Error:

In the response Json the quotes were found missing because of which API failed at IPAD end while processing the response message.

Correctl json: “adrc_ post_code1″:”xxxxxxxx”,

Incorrect  json “adrc_post_code1”:xxxxxxx    (double quotes missing)

Solution:

1. Check whether the all the fields are declared in Conversion rules of SAP Sender REST channel or not. And Make sure to check if below points are checked while maintaining Conversion Rules.

2. Check for spaces in the field value entered in columns of table under Conversion Rules like -xml namespace/Prefix/Name/Type/ArrayType/Default Value

Rest your SAP REST Adapter issues with some Troubleshooting Tips

3. Declaration of Header field as well, for example. In the below AccountNotes and text_lines shall also be declared under conversion rules.

Rest your SAP REST Adapter issues with some Troubleshooting Tips

4. JSON to XML Conversion Error- Duplicate declaration in conversion rule in sender SAP REST channel lead to error in response in PO during json to xml conversion.

** Remember correctly maintaining Conversion rules in Sender channel can help you fix many issues. Make sure to check the same am sure it will resolve most of the errors.

Issue # 5

Error: Http404: No channel found to handle “POST” request was observed while sending jason request to PO.

Solution: URL corrected to what is maintained in SAP REST sender channel.

Rest your SAP REST Adapter issues with some Troubleshooting Tips

Issue # 6

Http 401 Error:Error code 401 faced while Ipad request was sent to PO.

Solution :  Authorisation/password can be checked for Background RFC user for communication between Sender and PO.

Issue # 7

Error :: After request reached CRM application and  No structure in response was seen nor the payload was recorded in CRM system.

Solution: Wrapper class namespace in SAP REST Sender channel should be kept same as what is declared in Message Type in ESR.

Rest your SAP REST Adapter issues with some Troubleshooting Tips

 

Issue # 8

Error in response payload: Response payload having multiple level structure from IPAD failed in PO.

Solution: Changed occurrences of fields to 0..unbounded from 0..1.

Issue # 9

Most common issue faced while dealing with SAP REST adapter was the below ones which were dealt with deploying xslt map in request and response mapping .

a. Missing structure (Header) in Response Messages, e.g Missing MessageType (MT) tags in Json.

b. Missing xml namespace in response Jason .

Issue # 10

Attachment becomes a part of message body:When Ipad request was sent to PO , Attachment in request message was seen as part of a message body in SAP PO.

Error: Below snapshot of payload at the sender  where attachment is also part of the body .

 

Rest your SAP REST Adapter issues with some Troubleshooting Tips

Solution:

a. Upgrade to SP7, worked.
b. Sender SAP REST channel =>Character Set name => UTF-8
c. Metadata update

 

**** End of Blog *****

Thanks

Pratibha.

New NetWeaver Information at SAP.com

Very Helpfull

User Rating: Be the first one !