on 01-17-2007 11:57 PM
Hi guys,
I'm having problems sending characters such as é ç è ô ... to my soap adapter. My scenario is that I am using a servlet to encode my soap envelop and then i'm sending it to my soap adapter. Here is a sample of my code :
HttpURLConnection connection = null;
StringBuffer sb = new StringBuffer();
...
sb.append(mapProp.getProperty(SOAP_BEG_ENVL));
sb.append(mapProp.getProperty(SOAP_BEG_BODY));
sb.append(mapProp.getProperty(SOAP_BEG_MT));
sb.append(mapProp.getProperty(SOAP_BEG_HDR));
sb.append(mapProp.getProperty(SOAP_BEG_INST)
+ confProp.getProperty(INSTITUTION)
+ mapProp.getProperty(SOAP_END_INST));
sb.append(mapProp.getProperty(SOAP_BEG_DATE)
+ date
+ mapProp.getProperty(SOAP_END_DATE));
sb.append(mapProp.getProperty(SOAP_BEG_TIME)
+ time
+ mapProp.getProperty(SOAP_END_TIME));
sb.append(mapProp.getProperty(SOAP_END_HDR));
sb.append(mapProp.getProperty(SOAP_BEG_DETAIL));
buffReader = request.getReader();
do {
data = buffReader.readLine();
if (data != null) {
data = data.replaceAll("&", "&");
data = data.replaceAll("<", "<");
data = data.replaceAll(">", ">");
data = data.replaceAll(""", """);
data = data.replaceAll("'", "'");
sb.append(mapProp.getProperty(SOAP_BEG_DATA)
+ data
+ mapProp.getProperty(SOAP_END_DATA));
}
}
while(data != null);
sb.append(mapProp.getProperty(SOAP_END_DETAIL));
sb.append(mapProp.getProperty(SOAP_END_MT));
sb.append(mapProp.getProperty(SOAP_END_BODY));
sb.append(mapProp.getProperty(SOAP_END_ENVL));
//java.net.Authenticator.setDefault(new Auth());
url = new URL(confProp.getProperty(HTTP_URL));
connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestProperty("Content-Length", String.valueOf(sb.toString().length()));
connection.setRequestProperty("Content-Type","text/xml; charset=ISO-8859-1");
connection.setRequestProperty("SOAPAction","SomeAction");
connection.setRequestMethod( "POST" );
Charset cs = Charset.forName("ISO-8859-1");
out = connection.getOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(out, cs);
osw.write(sb.toString().toCharArray());
osw.close();
out.close();
...
This is the error message I get back from my client :
java.io.IOException: Server returned HTTP response code: 400 for URL: https://XXXXX.wshs.:3405/dev/RM/Sync/Procurement
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:814)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA12275)
at App.main(App.java:117)
I have no problems when their are no accented characters.
thanks for your help.
Steeve
Hi,
How do you do that? I''m passing the charset via the web service but it has no affect.
Thanks
Steeve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You are using a sender soap adapter right?
If so, you need to enter the encoding as part of the url and not in the module.
http://host:port /XISOAPAdapter/MessageServlet?channel<b>=...&xmlenc=iso-8859-1</b>
Regards,
Smitha.
Hi,
Have you changed the encoding scheme at the receiver soap adapter?
By default the soap adater has a UTF-8 encoding.
Regards,
Smitha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.