cancel
Showing results for 
Search instead for 
Did you mean: 

STATUS_CODE_NOT_OK - 500 internal Server Error

Former Member
0 Kudos

Dear All,

I have a scenario where it is from SAP ECC to MES.  The 500 internal Server Error is displayed when sending data to MES.

The receiving code is below for MES:

I noticed that the return parameter is HttpResponseMessage, because this is asynchronous interface. I advise MES developer change to void. But the error change to "STATUS_CODE_NOT_OK - 405 Method Not Allowed". I am really confusing.

The receiver adapter is HTTP_AAE. The configuration is below:

The error is below:

I have no idea about the error.

Thank you for your input.

Many thanks & Best regards,

Hubery

Accepted Solutions (1)

Accepted Solutions (1)

former_member182412
Active Contributor
0 Kudos

Hi Hubery,

If your system supports configure TraceHTTP parameter in the receiver channel then you can see what is the response you receiving from MES.

Regards,

Praveen.

Former Member
0 Kudos

Yes, Praveen, My PI version is 7.4 SP13 single stack. I noticed that your example is receiver adapter SOAP. Is it available for  the receiver adapter HTTP_AAE?

I will test and feedback.

Really appreciate YOU for  your always following.

Many thanks & best regards,

Hubery

former_member182412
Active Contributor
0 Kudos

Hi Hubery,

Yes it is available for HTTP_AAE adapter also from 7.4 SP09 onwards. Check this sap note.

2157425 - New Feature: Client side HTTP Tracing for HTTP_AAE adapter

Regards,

Praveen.

Former Member
0 Kudos

Dear Praveen,


I test with MES developer. The receiving data for MES is NULL. I send a json string. I not sure why it is blank.

My message mapping is as follow:


Payload(I noticed that xml header is included):

<?xml version="1.0" encoding="utf-8"?><n0:MT_SAP_CO11N80_OUT xmlns:n0="urn:public:pp2mes:co11n80" xmlns:prx="urn:sap.com:proxy:ED1:/1SAI/TASEA659AD7568FB87EF5A4:700:2008/06/25"><JSON>[{rid: "000000640500000009", saptype: "0", schno: "201507306110", orderno: "100000220", bagcode: "68531600601", procescode: "10", workcount: "2 ", operusername: "DONGHUI", operdatetime: "20150730212258 ", msg: ""}, {rid: "000000640500000011", saptype: "0", schno: "201404186110", orderno: "100000220", bagcode: "68531600601", procescode: "10", workcount: "2 ", operusername: "DONGHUI", operdatetime: "20150730213551 ", msg: ""}]</JSON></n0:MT_SAP_CO11N80_OUT>

Best regards,

Hubery

Former Member
0 Kudos

I think I need to remove the header "<?xml ......</n0:MT_SAP_CO11N80_OUT>".

Any solution can do that.

Would you please share some solution?

Best regards,

Hubery

former_member182412
Active Contributor
0 Kudos

Hi Hubery,

  • Is your source structure and target structure is different??
  • If yes then you can use message mapping for converting source structure to target structure via message mapping
  • After this message mapping you can use java mapping to convert XML to JSON
  • In the operation mapping first message mapping after that put java mapping
  • If source and target structure is same then only include java mapping in operation mapping.
  • Or can you provide source XML and required JSON so that i can help you

Regards,

Praveen.

Former Member
0 Kudos

Dear Praveen,

Before SAP ECC send the data to thirid-party system. SAP ECC  HAVE transformed the data to json string and assigned to interface field "JSON".  That is why the payload package a xml header like "<?xml ......</n0:MT_SAP_CO11N80_OUT>".

For this condition, The receiver system do not identity the data. That is why the receiving data is blank.

I noticed that I copy the json string to test. The content I mark as red is automatically added in the source text view.

Source text view:

How to solve it for special condition?

Best regards,

Hubery

former_member182412
Active Contributor
0 Kudos

Hi Hubery,

Dont use message mapping, use below java mapping in the operation mapping.


import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

public class GetJSONFromXMLElementJavaMap extends AbstractTransformation {

  @Override

  public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput)

  throws StreamTransformationException {

  try {

  Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(

  transformationInput.getInputPayload().getInputStream());

  transformationOutput.getOutputPayload().getOutputStream().write(

  document.getElementsByTagName("JSON").item(0).getTextContent().getBytes("utf-8"));

  } catch (Exception e) {

  throw new StreamTransformationException(e.getMessage());

  }

  }

}

Test:

Regards,

Praveen.

Former Member
0 Kudos

Dear Praveen,

You are super PI expert. Thank you so much for your always support.

Hope you have a good day!

Best regards,

Hubery

former_member182412
Active Contributor
0 Kudos

Hi Hubery,

Thanks for your kind works, I am glad your problem is resolved.

Regards,

Praveen.

Answers (0)