Special characters in Web Services
I have developed a Web Service in Java using JBuilder 2005 and deployed it on BEA Weblogic 8.1 SP5. Weblogic is configured to use the ISO-8859-1 encoding as well as JBuilder. I am living in South Africa and we need to cater for special characters. A typical test string is "MOK�ENA��������������A".
I have also developed a little test class to test this Web Service. The only parameter is a String type and it returns a String type. This String type must be able to handle special characters.
I understand that the String in Java is unicode with no encoding. How do I pass a string containing special characters to this web service. I am getting the error "SOAP Fault:javax.xml.rpc.soap.SOAPFaultException: Internal Error: unable to process your request: javax.xml.soap.SOAPException: weblogic.xml.stream.XMLStreamException: Malformed UTF-8 char -- is an XML encoding declaration missing? - with nested exception:
[weblogic.xml.stream.XMLStreamException: Malformed UTF-8 char -- is an XML encoding declaration missing? - with nested exception:
[java.io.CharConversionException: Malformed UTF-8 char -- is an XML encoding declaration missing?]]" .
Currently I am converting the string to a byte[] array and encode it with the .getBytes("ISO-8859-1") method of the String class and replace the String parameter in the Web Service with a byte[] type. This results in a longer than needed parameter that needs to go over the wire.
I want to do it the wright way using string type if possible.
What is the correct way of dealing with this special characters.
Regards
In theory you should be able to enter them via a special small pop up window. In System Preferences -> Keyboard -> and you can switch to show keyboard layout and such in the menu bar (assuming you're running SL).
Then you can open a glyphs window accessing all possible unicode characters:
⠫⠳⠭⠹㉢㈚↳↬ ䷑䷪䷬䷜
volker
Similar Messages
-
Special Character XML Web Service call from Flex
Hi,
Let me first give a little background.
I have to query and return data in XML format. To do so, I have created a custom DSC component. In cases where XML has special characters, LC throws error saying that XML is not properly formed. To over come this issue I used CDATA tag at DSC component. Now LC works as it should and I returns correct result.
I have a web service call from Flex to get this XML result. Every time i trigger this web service I get an error message saying </document> tag is missing.
I understand in Flex, web service returned data is wrapped in CDATA tag, thats what i causing all this issue.
I am not sure, how to handle this situation, I am sure this is a common problem and there should be ways to work around it.
I would really appreciate if any one could point me in the right direction.
Thank you ..The web service has four operations in it, I need pingQuery operation execution code since it doesnot need any input value.
I have used code something like this.. Any one please correct me if I am wrong..
<mx:WebService
<mx:WebService> id="webService" wsdl=""https://hydrogen.csd.sc.edu/axis2/services/AcademicHistoryService?wsdl
>
<mx:operation name="pingQuery"resultFormat="
object"result="resultHandler(event);"
fault="faultHandler(event);"
>
<mx:request>
<PingQuerySpecification>
<value>
fsdf
</value>
</PingQuerySpecification>
</mx:request>
</mx:operation>
</mx:WebService>
private function resultHandler(evt:ResultEvent):void {Alert.show(ObjectUtil.toString(evt.result));
private function faultHandler(evt:FaultEvent):void {Alert.show(evt.message.toString()); -
Special Character in Web Service using OAS and Weblogic
In the project, we are using OAS be the app server, all the "<" in the context of xml in web service are converted to "<" automatically.
However, when we deploy it to weblogic, the "<" was converted to "&<;&"
Then another app try to unmarshalling it, but the app cannot handle the < the throw the exception. Do you know why the how to change it back to "<"?
OAS version:10.1.3.2.0
Weblogic version:11gR1
Spring Version:2.5
OAS XML
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<makeHTMLStrForAwardServiceResponse xmlns="http://com.makeHTMLStrForAward/types/">
<htmlStr><html><head><style type="text/css">
</html>
</htmlStr>
</makeHTMLStrForAwardServiceResponse>
</soapenv:Body>
</soapenv:Envelope>
Weblogic XML
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<makeHTMLStrForAwardServiceResponse xmlns="http://com.makeHTMLStrForAward/types/">
<htmlStr>&<;&html>;&<;&head>;&<;&style type="text/css">
;&<;&/html>;</htmlStr>
</makeHTMLStrForAwardServiceResponse>
</soapenv:Body>
</soapenv:Envelope>
Edited by: user1287019 on Apr 20, 2011 10:13 AMHa Ha,
I found that one of the Spring WS lib we were using is 1.5.4.
It seems OAS ship with WS lib and the app use the OAS lib.
But weblogic did not have WS lib, then app need to use it's own lib. Then problem occur.
After change to version 1.5.8, the problem solved. -
MS Word Special characters in web pages
I am running into an issue when I paste text from MS Word documents into web pages (JSP) forms.
Characters like dashes paste. Then the form is submitted and when later retrieved and prepopulated from the DB, they come out garbled.
The database accepts UTF-8 encoding, and I changed the charset on the JSP's to use UTF-8 encoding, but none of this helped.
Could anyone suggest where else can I look for the problem?
Thanks.Thanks,
I am reading your article and attempting to implement the changes...
I am trying to understand something - my system is Vista, whose default encoding is Cp1252. Must I change it to UTF-8 as well, or is it sufficient to force UTF-8 in my application? -
Java client for calling a XI web service
Hello,
does anyone have created a Java client
with Apache Axis? I tried it and it works
for web service which aren't provided by
SAP XI, but if I use to call a XI web service
something went wrong.
The XI web service works. I tested it with
XML Spy.
I think there must be something special with
XI web service.
So anyone got a tutorial/guide for this???
thanks
chrisHola mi nombre es Luis,
Creyendo que eres español te escribo en tal idioma.
He visto que a ti también te devolvía un error de autentificación 401, y que lo subsanaste, pero a mi con la solución que te dieron no me vale, ya que implemento el código que te ofrecieron para arreglarlo y ahora me da un fallo de "Server Error" poniendo en usuario y password, los correspondientes a XI.
+Request_MI_outTurnoverDetailsDisplay_MI_outTurnoverDetailsDisplay req=new Request_MI_outTurnoverDetailsDisplay_MI_outTurnoverDetailsDisplay();
wdContext.nodeRequest_MI_outTurnoverDetailsDisplay_MI_outTurnoverDetailsDisplay().bind(req);
req._setUser("username");
req._setPassword("password");+
No sé si es que ese usuario y contraseña son otros distintos.
Si pudieras ayudarme, te lo agradecería.
Un saludo, Luis -
Hello,
I�d like to ask for your help in the following design issue:
I need to create an email sending web service (with Axis). Only just one method which returns with an integer return code. This handles the following:
- based on the given parameters gets the email addresses from an
LDAP server (with netscape ldap for java)
- makes a cache from them (only after a timeout period will be the cache
refreshed) (don�t know what tool to use for this)
- selects html templates which to be sent based on the given parameters
- sends emails with the appropriate templates (with Velocity)
- the whole process is logged (with log4j)
I have to write the code as generic as possible. I know that some design pattern should be used for this. (some from GoF , and I know there exists design patterns specially created for web services as well).
Could you enumerate me which patterns (and for what part of the program) would be the best choice to solve this problem? I have read through some books about patterns, but don�t have the knowledge to pick up the right one for a concrete problem like this..
Thank you in advance,
nagybalyThis sounds like a known issue which is tracked in ADAPT01103681. Code from a .NET DataProvider is executed twice if the provider has input parameters.
At this time there's no known solution for this. This was submitted to the development team and a fix is expected in Service Pack 2. At this time we have not announced a release date for SP2.
Edited by: David Hilton on Jun 18, 2009 3:02 PM
Corrected spelling. -
A web service design issue with patterns
Hello,
I�d like to ask for your help in the following design issue:
I need to create an email sending web service (with Axis). Only just one method which returns with an integer return code. This handles the following:
- based on the given parameters gets the email addresses from an
LDAP server (with netscape ldap for java)
- makes a cache from them (only after a timeout period will be the cache
refreshed) (don�t know what tool to use for this)
- selects html templates which to be sent based on the given parameters
- sends emails with the appropriate templates (with Velocity)
- the whole process is logged (with log4j)
I have to write the code as generic as possible. I know that some design pattern should be used for this. (some from GoF , and I know there exists design patterns specially created for web services as well).
Could you enumerate me which patterns (and for what part of the program) would be the best choice to solve this problem? I have read through some books about patterns, but don�t have the knowledge to pick up the right one for a concrete problem like this..
Thank you in advance,
nagybalyHello,
I�d like to ask for your help in the following design
issue:
I need to create an email sending web service (with
Axis). Only just one method which returns with an
integer return code. This handles the following:Lots of responsibilities here. You would do well to break this up into several classes that you can test separately.
I would also advise that you not embed all this in a servlet. Make a service that collaborates with several objects to accomplish the task and let the serlvet just call it.
.> - based on the given parameters gets the email
addresses from an
LDAP server (with netscape ldap for java)I'd recommend Spring's LDAP module. Pretty terrific stuff.
cache from them (only after a timeout period will be
the cache
refreshed) (don�t know what tool to use for
this)Maybe EhCache or OsCache or something like that.
- selects html templates which to be sent based on
the given parametersWhere does this come from? Certainly not the LDAP. A relational database? Write a DAO for the document template.
- sends emails with the appropriate templates (with
Velocity)Have an e-mail sender service using Java Mail.
- the whole process is logged (with log4j)Easily done.
I have to write the code as generic as possible. I
know that some design pattern should be used for
this. No pattern. There might be patterns, if you say that the DAOs to access the LDAP and RDB are patterns.
Stop thinking patterns and start thinking objects.
(some from GoF , and I know there exists design
patterns specially created for web services as
well).Nope.
Could you enumerate me which patterns (and for what
part of the program) would be the best choice to
solve this problem? I have read through some books
about patterns, but don�t have the knowledge to pick
up the right one for a concrete problem like this..
Thank you in advance,
nagybalyYou haven't read them because they aren't there. Your problem is pretty specific, even if it's common.
% -
Calling web service slow in wls81sp6
Hi, I call a .Net secure (https) web service in my ejb. It returns in couple seconds in wls81sp4. But since I upgraded to wls81sp6, every time it takes more than 1 minute to return. That's quite surprise. What's changed? How can I get the performance back?
Things get worse when I need to call web service several times in one ejb call. Sometime if my data set is big I break into chunk and call web service in a loop. I always get timeout exception now. Is there anything special about wls81sp6 web service? ThanksQuestion is what technology of J2EE u are using!
If it is EJB, then the fastest way would be to generate one more webservice and connect this one to WD.
This way you also can check if the webservice delivers any data with the testing environment.
Regards,
Benny -
How to deploy web service/client on websphere
Hi,
I have developed a web service client on Jdeveloper 10.1.3.1.0 and I deployed it on the embeded OC4J and OAS and it worked fine. BUT when I packaged it as EAR file and deployed it on websphere 6.0 {the production enviroment at the client side} It gave me NoClassForService00.
And in websphere application server it didn't recognize it as Web service client.
Any one faced this problem b4. PLZ advice.
ThnxHi Amol,
Thank you very much for replying my question. The contents in my application.xml are:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>testwsapp</display-name>
<description>J2EE Application testwsapp</description>
<module>
<web>
<web-uri>testws_War.war</web-uri>
<context-root>testws</context-root>
</web>
<alt-dd>testws_War.xml</alt-dd>
</module>
</application>
The contents in jaxrpc-ri-runtime.xml are:
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-rpc/ri/runtime' version='1.0'>
<endpoint
name='testws'
interface='contactws.testwsGenServer.testwsRPC'
implementation='contactws.testwsGenServer.testwsRPCBean'
tie='contactws.testwsGenServer.testwsRPC_Tie'
model='null'
wsdl='/WEB-INF/testws.wsdl'
service='{urn:testws/wsdl}Testws'
port='{urn:testws/wsdl}testwsRPCPort'
urlpattern='/testws'
</endpoint></endpoints>
I tried to access and check the web service using:
http://servername:port/testws/testws
The first testws is contextroot named and the second testws is url pattern, which was exactly like what you mentioned but I got "404 Not Found" error.
By the way, using the same ear to deploy to Windows Sun ONE App. Server 7 env. and then using the same url, I can access the web service. I am wondering if there is any special for deploying Web Service on Unix Sun ONE app. Server 7 env. or I missed something?
I hope I can hear from you soon.
Thank you again,
Jackie -
Oracle BPM Studio 10g R3 cataloging Web Services strips special characters
Hi folks,
I have a Web Service that I'd like to invoke from an activity in my process.
When I catalog the WSDL, BPM Studio creates the associated External Resource just fine except for one small problem, namely all Simple Types that have 'special characters' in their enumerated String values are stripped clean.
Example 1:
ADSL1
ADSL2
ADSL2+
--> The plus is stripped from ADSL2+, causing BPM Studio to flag two problems caused by duplicate 'ADSL' values
Example 2:
adsl1#foo/123
--> Everything to the left of 123 is stripped leaving only '123' as a value
In fact in the BPM Studio's Editor, the only special character that is allowed is the underscore. Everything else e.g. \ # etc etc cannot be keyed in.
Has anyone come across this before? Thanks for reading :-)
cheers
jm -
Problem with special characters when calling web services via ISG
Hi all,
I have a problem when trying to send or retrieve strings containing some special characters via Integrated SOA Gateway.
For example, when I call a PL/SQL function via ISG that returns a string containing curling single and double quote characters, these are not represented by valid XML character entity references. So when trying to open the response XML (returned by ISG) in a browser, I get a parser error...
Has anybody had a similar experience with ISG? How can I resolve that - is it an ISG bug?
Thanks
CarolinXML Parsing Error: not well-formed
Location: file:///C:/Users/sanders/Desktop/Text3.xml
Line Number 4734, Column 54: <DESCRIPTION>Overhead Track Lighting 4?</DESCRIPTION>Do you get the same error if you change the description from "Overhead Track Lighting 4?" to "Overhead Track Lighting 4"?
Do you have any invalid characters?
BI Publisher Reports End With Error When There Is An Ampersand Character ( & ) On The Xml Data File [ID 1081175.1]
Journal Entries Report Doesn'T Yield Output: Java Heap Error [ID 1115663.1]
Thanks,
Hussein -
Get user name - web services throws error if a name has special character
I am calling UserProfileService.asmx web service and using GetUserPropertyByAccountName. The method works for almost everyone except for those who has special characters in the Preferred Name. How do I fix this? We are having serious production issues and
would like to know how to fix the issue.
User: domain\aberg returns name as the name does not have any special characters. Arthur Berg
User: domain\jobill returns following error because this use has a dash in the last name. Joe O-Bill
User: domain\mobrien returns following error because this use has a dash in the last name. Mark O'Brien
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>A user with the account name DOMAIN\jobill could not be found. ---> An error was encountered while retrieving the user profile.</faultstring>
<detail>
<ErrorCode xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">UserCannotBeFound</ErrorCode>
<ErrorMessage xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">An error was encountered while retrieving the user profile.</ErrorMessage>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I am using codeplex tool "web service studio 2.0" to verify this.I have NO clue what is going on. When I go to user profile from Central Admin the user account is domainxp.net\username. But when I pull up the user using address bar (say in edit form) I see domain\usename. Could this be confusing the workflow which is
calling the web services?
I ran the following powershell and after few minutes it starting to resolve the user name without any errors. I like to know what is going on here. Problem is solved for now but I wont be surprise if I see the same problem after doing a Full AD sync.
$adUser = "domain\user"
$siteCollection = "http://local.site/sales"
Set-SPUser -Identity $adUser -Web $siteCollection -SyncFromAD
Thanks
Brooke -
I am using .Net Framework 4 C# web service project.
I am connecting with XMLA service (using as web reference) in my C# project. The issue seems to be able to handle the French characters once i am getting response back from the XMLA execute method.
At this moment the data is coming back as '??' whenever it contains french special characters.
I am pasting the code below and would appreciate help at earliest.
sapqasbwi.MsXmlAnalysis _sMxlA = new sapqasbwi.MsXmlAnalysis(); // Create XMLA reference object.
System.Net.NetworkCredential _nc = new System.Net.NetworkCredential(); // Creating Network credentials object
_nc.UserName = userid;
_nc.Password = _password;
_sMxlA.Credentials = _nc.GetCredential(new System.Uri(url), "Basic");
_sMxlA.Url = url;
sapqasbwi.ExecuteCommand cmd = new sapqasbwi.ExecuteCommand();
cmd.Statement = stText; // sText contains the query
_bwPropertyList.DataSourceInfo = "default";
_bwPropertyList.Format = "Tabular";
_bwPropertyList.AxisFormat = "ClusterFormat";
_bwPropertyList.Content = "SchemaData";
_bwParameters.PropertyList = _bwPropertyList;
_sMxlA.RequestEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); // already tried utf 8
//Execute BW Query
System.Xml.XmlElement returnXML;
returnXML = _sMxlA.Execute(cmd, _bwParameters); // Execute method only returns an XML element object.
This particular object is containing the '??' whenever a french character is found
The output i am receiving is as follows
<MainServiceAndStatuses>
<MainService>Entreposage ?? long terme</MainService>
<MainServiceStatus>Service Termin??</MainServiceStatus>
<TransactionID>1000006216_10_Cde client standard</TransactionID>
</MainServiceAndStatusesHi
Can you please send me the direct link for C# forum, i cannot find it on this forum.
thank
TheNauman -
Hi,
I have created a web service in SAP ECC from a RFC.
While configuring the web service in SOA management to publish it, getting error SRT Framework exception: ICF: Error when creating service node. [rc:wrong_icf_name] No special characters allowed in name
How to resolve the same.
Thanks
TanmayHello Tanmay,
Are you including quotes (') in the name, I assume not?
Regards,
Siddhesh -
How to send non-latin unicode characters from Flex application to a web service?
Hi,
I am creating an XML containing data entered by user into a TextInput. The XML is sent then to HTTPService.
I've tried this
var xml : XML = <title>{_title}</title>;
and this
var xml : XML = new XML("<title>" + _title + "</title>");
_title variable is filled with string taken from TextInput.
When user enters non-latin characters (e.g. russian) the web service responds that XML contains characters that are not UTF-8.
I run a sniffer and found that non-printable characters are sent to the web service like
<title>����</title>
How can I encode non-latin characters to UTF-8?
I have an idea to use ByteArray and pair of functions readMultiByte / writeMultiByte (to write in current character set and read UTF-8) but I need to determine the current character set Flex (or TextInput) is using.
Can anyone help convert the characters?
Thanks in advance,
best regards,
Sergey.Found tha answer myself: set System.useCodePage to false
Maybe you are looking for
-
HU_PACKING_AND_UNPACKING
Hi all, I would like to use the function called HU_PACKING_AND_UNPACKING, to pack one or more Handling Units of an outbound delivery into another Handling Unit. Normally this can be done through transaction vl02n and than go to packing (of HU's). I n
-
AC adapter replacement program for M4402
Hi everone, me again. Miss me? Given that my Pismo works absolutely fine now, the reason I am posting relating to the power pack is an obscure one. I recently stumbled across a page in the PowerBook G3 support area about replacing the M4402 power ada
-
When opening the Bookmarks menu, I see my bookmarks folder in the dropdown and can access them from there. However, if I click "Show All Bookmarks" the manager launches, but shows no bookmarks of any kind. No defaults, folders, uncategorized links...
-
Batch management number ranges
Hi guru's My client is using internal number ranges for my raw material but now they want to enter external number at the time of Goods reciept and also I want to make it mandatory for external number ranges. that mean system is proposing me inte
-
What happened to over the air updates
am I the only one, or has over the air updates been changed to over WiFi updates? Not the same thing. Pretty inconvenient when you're somewhere without WiFi and want to update your phone.