For the case from the partner to SAP, are they specifying the correct encoding in the XML declaration? Hopefully so.
Even if they do that, I’m entirely sure that xmlStringToXMLNode honors the encoding specified in the XML declaration. You may need to explicitly specify the encoding parameter when you make the call.
You’ll need to make sure the SAP integration and perhaps SAP itself is configured to support UTF-8 when passing the translated data to SAP.
For the other direction, you’ll need to explicitly add the XML declaration line yourself. Specify false for the addHeader parameter of documentToXMLString. Create your own XML declaration and then concat it with the resulting XML string from documentToXMLString. Then you can call pub.string:stringToBytes to convert the character set and send those bytes as the payload.
A key approach is to work on one part at a time to make sure each step along the way is doing what you expect.
#Integration-Server-and-ESB#Flow-and-Java-services#webMethods