on 09-23-2016 3:25 PM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Hi Hubery,
Regards,
Praveen.
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
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.
User | Count |
---|---|
85 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.