Skip to Content
0
Former Member
Aug 10, 2007 at 09:23 AM

Problem with special characters with SOAP Adapter

181 Views

Hi

We uses SAP XI 3.0 SPS18.

We need to add a SOAP header and for that we implement a adapter module and use the SOAP adapter with the "Don't use SOAP" flag.

The problem is now, that the adapter sends SOAP Messages with wrong special character within the payload.

We have inside an element the following String :

"

The SOAP receiver receives:

<ns1:Description Value="- Pivotant (ou fixe)&lt;BR&gt;- Hauteur réglable&lt;BR&gt;- Angle d&apos;orientation réglable&lt;BR&gt;- Grille de protection métallique&lt;BR&gt;- Ã&#152; env. 40 cm&lt;BR&gt;- 3 vitesses&lt;BR&gt;- Bouton à 4 positions (0-1-2-3)&lt;BR&gt;- Alimentation en courant: 230 V, 50 Hz, 50 W&lt;BR&gt;"

As you see, all special characters are wrong now.

To test the module, I simply reduce the module to the coding below but the same problem.

Any idea ?

Regards,

Gerald

package xi.charset;

import java.io.IOException;

import javax.ejb.CreateException;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

import com.sap.aii.af.mp.module.Module;

import com.sap.aii.af.mp.module.ModuleContext;

import com.sap.aii.af.mp.module.ModuleData;

import com.sap.aii.af.mp.module.ModuleException;

import com.sap.aii.af.ra.ms.api.InvalidParamException;

import com.sap.aii.af.ra.ms.api.Message;

import com.sap.aii.af.ra.ms.api.XMLPayload;

/**

  • @ejbHome <{xi.charset.CharsetTesterHome}>

  • @ejbLocal <{xi.charset.CharsetTesterLocal}>

  • @ejbLocalHome <{xi.charset.CharsetTesterLocalHome}>

  • @ejbRemote <{xi.charset.CharsetTester}>

  • @stateless

  • @transactionType Container

*/

public class CharsetTesterBean implements SessionBean, Module {

public void ejbRemove() {

}

public void ejbActivate() {

}

public void ejbPassivate() {

}

public void setSessionContext(SessionContext context) {

myContext = context;

}

private SessionContext myContext;

/**

  • Create Method.

*/

public void ejbCreate() throws CreateException {

// TODO : Implement

}

/* (non-Javadoc)

  • @see com.sap.aii.af.mp.module.Module#process(com.sap.aii.af.mp.module.ModuleContext, com.sap.aii.af.mp.module.ModuleData)

*/

public ModuleData process(ModuleContext moduleContext,ModuleData inputModuleData) throws ModuleException {

Object obj = null;

Message msgIn = null;

XMLPayload xmlPayload = null;

// Extrahieren des Payloads

obj = inputModuleData.getPrincipalData();

msgIn = (Message) obj;

xmlPayload = msgIn.getDocument();

String codepage = xmlPayload.getEncoding();

String text = xmlPayload.getText();

// Set output

try {

try {

xmlPayload.setContent(text.getBytes("utf-8"),"utf-8");

} catch (InvalidParamException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

// xmlPayload.setText(text);

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

inputModuleData.setPrincipalData(msgIn);

return inputModuleData;

}

}