cancel
Showing results for 
Search instead for 
Did you mean: 

How to check input payload content type in java mapping

Former Member
0 Kudos

Hi Experts,

I am doing proxy to soap scenario, some times web service is returning html payload to PI and failing in PI, so i want to check the response payload whether it is html or xml, if it is html i want to map it to fault message and send it to proxy, please tell me how to check the content type of input payload in java mapping.

Regards,

Rachana.

Accepted Solutions (1)

Accepted Solutions (1)

prem_a
Participant
0 Kudos

Hi Rachana,

I guess you can do this using Runtime Constants to read the message header.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20dc21dd-e7f7-2e10-1c9f-a061cf9e4...

Regards

Prem A

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Rachana,

Once you convert the payload inputstream into string, you can do a simple indexOf check to see if it contains html, since an html starts with <html></html> e.g

if(payloadString.indexOf("<html>")>-1){

     your logic here

}

Hope this helps,

Mark