I may get a little of track here, but bear with me, I'm just trying to
be sure everything is straight in my mind.

The issue I always think of when sending binary data within an XML
document is that the document will typically (always, in the case of
Apache SOAP) use UTF-8 encoding.  Within that encoding standard, some
byte sequences are simply not legal.  Specifically, lead bytes (starting
11) must be followed by fill bytes (starting 10), so a lead byte
followed by a 7-bit character byte (starting 0) is not legal, nor are
two consecutive lead bytes (so that the byte order mark from Unicode
cannot appear in UTF-8).

If you are generating the UTF-8 data from Java's Unicode strings, you
should always get valid UTF-8 encoding.  Any exception would imply a bug
in Java's Unicode to UTF-8 conversion, right?

An issue you bring up is whether all UTF-8 characters are valid as XML
content.  Well, we know that some characters would need to be escaped to
ensure the XML is valid.  This is done in the serializer for strings by
converting, for example, '<' to '&lt;'.  (Historical note: at one time,
CDATA was used to encapsulate strings in Apache SOAP, but this was
removed for reasons I don't recall.)  The XML 1.0 spec section 2.2 also
shows that XML allows only a few of the ASCII control characters to be
used (tab, linefeed, carriage return).

Therefore, if the strings you create in Java do not include ASCII
control characters other than tab, linefeed and carriage return, SOAP
should be able to work with them just fine.

Scott Nichol

----- Original Message -----
From: "Jian Zhang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 09, 2002 10:53 AM
Subject: RE: Passing a Class File Content


>
> In this context: is that true that if we create
> a String object with a String literate like this:
>
> String strObj = "d89dnd^0d0d%%%</myXMLtag>";
>
> which contains arbitrary characters (but all are typed into),
> then it is developer's responsibility to make sure that
> all the characters used are legal XML characters, or
> they are indeed characters and we do not need to worry about whether
> they are valid XML characters or not?
>
> Thanks,
>
>
> -----Original Message-----
> From: Scott Nichol [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 09, 2002 10:20 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Passing a Class File Content
>
>
> You cannot send binary data as a string.  You should something like
> byte[] instead.
>
> Scott Nichol
>
> ----- Original Message -----
> From: "michel" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, December 08, 2002 8:11 PM
> Subject: Passing a Class File Content
>
>
> > I'm trying to send the content of a java class file  to a server
> through a
> > SOAP request (as an XMLType.XSD_STRING");
> >  but I'm getting the following error:
> >
> > "org.xml.sax.SAXParseException: An invalid XML character (Unicode:
> 0x0) was
> > found in the element content of the document"
> >
> >
> >
> > Is there some way of encoding the request to avoid the problem?
> >
> >
> >
> > Thanks for any response!!
> >
> >
> >
> >  /**  sends the content of a class file as a   XMLType.XSD_STRING
**/
> >   public final String upload(String content,String path) throws
> Exception {
> >     call.setOperationName(new QName("Admin","upload"));
> >     call.setReturnType(XMLType.SOAP_STRING);
> >
> >
>
call.addParameter("content",XMLType.XSD_STRING,ParameterMode.PARAM_MODE_
> IN);
> >     this.response = (String) call.invoke(new Object[]{content});
> >     call.removeAllParameters();
> >     return response;
> >   }
> >
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to