• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

WEB SERVICE IN VB.NET AND JAVA

Hi All, I have implemented my webservice using java and using
Axis 1.3. The client is developed using .Net 2005 (vb.net).

basically the client sends to the server a string.

my problem is that sometimes. i get this error when i'm sending the string......

org.xml.sax.SAXParseException: Character reference "&#x0" is an invalid XML character.

 i don't know which character cannot reconize.....
 
0
marianatagliaferro
Asked:
marianatagliaferro
  • 2
  • 2
1 Solution
 
nayernaguibCommented:
I think your problem is that the string you pass to the web service sometimes contains invalid characters.
You probably need to encode the string to guarantee that no invalid characters will be sent. Base64 encoding is one good choice.

_______________

  Nayer Naguib
0
 
marianatagliaferroAuthor Commented:
do you have an example to this encode in vb.net and decoded in java
0
 
nayernaguibCommented:
Here's the VB .NET part:

        Dim s As String
        s = Convert.ToBase64String(New System.Text.ASCIIEncoding().GetBytes("Hello, Base64 World!!"))

Now the string s holds the value "SGVsbG8sIEJhc2U2NCBXb3JsZCEh", which is the Base64 encoded version of the string "Hello, Base64 World!!".
The Java part should look like this:

      try {
            String encoded = "SGVsbG8sIEJhc2U2NCBXb3JsZCEh";
            byte[] buffer = new sun.misc.BASE64Decoder().decodeBuffer(encoded);
            String s=new String(buffer);
      }
      catch (Exception e) {
      }

Now the string s holds the value "Hello, Base64 World!!".

_______________

  Nayer Naguib
0
 
marianatagliaferroAuthor Commented:
Thank you very much!!!!! it worked perfectly.... :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now