You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Beth Ayres <Be...@sas.com> on 2007/12/07 18:08:44 UTC

Unsupported encoding error on Z/OS when using WS-Security

I am using AXIS2 1.3.  I have a client that runs on Z/OS.  When I make a web service call using WS-Security, I get a WSSecurityException: Unsupported encoding (EBCDIC).  I have debugged this problem and found the following.

In Axis2Util.getSOAPEnvelopeFromDOMDocument,

XMLUtils.outputDOM(doc.getDocumentElement(), os, true);

appears to prepend the encoding declaration to the document and encode that declaration itself in EBCDIC.  The rest of the document is encoded in UTF-8.

Then

ByteArrayInputStream bais =  new ByteArrayInputStream(os.toByteArray());
StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(bais), null);

StAXSOAPModelBuilder throws the WSSecurityException because of the EBCDIC.

According to the W3C XML spec:

"In the absence of information provided by an external transport protocol (e.g. HTTP or MIME), it is a fatal error<http://www.w3.org/TR/2006/REC-xml-20060816/> for an entity including an encoding declaration to be presented to the XML processor in an encoding other than that named in the declaration, or for an entity which begins with neither a Byte Order Mark nor an encoding declaration to use an encoding other than UTF-8."

I am not using HTTP or MIME, etc.  Therefore, the encoding declaration should not be in EBCDIC at all.

I see no way around this problem unless there is some option or setting to prevent the behavior.  Has anyone seen this before and have a solution?



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Unsupported encoding error on Z/OS when using WS-Security

Posted by Beth Ayres <Be...@sas.com>.
But the problem is that the encoding declaration itself is encoded in EBCDIC.  It is not us-ascii.

For example, in the following:

<?xml version-"1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
.
.
.

"<?xml version-"1.0" encoding="UTF-8"?>"  is encoded in EBCDIC

after being processed by

XMLUtils.outputDOM(doc.getDocumentElement(), os, true);
ByteArrayInputStream bais =  new ByteArrayInputStream(os.toByteArray());

The rest of the document is not in EBCDIC.


-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: Friday, December 07, 2007 12:45 PM
To: axis-user@ws.apache.org
Subject: Re: Unsupported encoding error on Z/OS when using WS-Security

according to spec for SOAP Binding Profile v1.0
http://www.ws-i.org/Profiles/SimpleSoapBindingProfile-1.0.html#Character_Enc
odings
"The Profile requires XML processors to support the "UTF-8" and "UTF-16"
character encodings, in order to aid interoperability.As a consequence of
this, in conjunction with SOAP 1.1's requirement to use the "text/xml" media
type (which has a default character encoding of "us-ascii") on envelopes"

unless otherwise specified us-ascii is the default character encoding

the spec further states:
"A MESSAGE's "Content-Type" HTTP header field-value MUST indicate the
correct character encoding, using the "charset" parameter. "
since you have not requested a specific *charset* the default 'us-ascii' is
assigned

M--
----- Original Message -----
From: "Beth Ayres" <Be...@sas.com>
To: <ax...@ws.apache.org>
Sent: Friday, December 07, 2007 12:08 PM
Subject: Unsupported encoding error on Z/OS when using WS-Security


I am using AXIS2 1.3.  I have a client that runs on Z/OS.  When I make a web
service call using WS-Security, I get a WSSecurityException: Unsupported
encoding (EBCDIC).  I have debugged this problem and found the following.

In Axis2Util.getSOAPEnvelopeFromDOMDocument,

XMLUtils.outputDOM(doc.getDocumentElement(), os, true);

appears to prepend the encoding declaration to the document and encode that
declaration itself in EBCDIC.  The rest of the document is encoded in UTF-8.

Then

ByteArrayInputStream bais =  new ByteArrayInputStream(os.toByteArray());
StAXSOAPModelBuilder stAXSOAPModelBuilder = new
StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(bai
s), null);

StAXSOAPModelBuilder throws the WSSecurityException because of the EBCDIC.

According to the W3C XML spec:

"In the absence of information provided by an external transport protocol
(e.g. HTTP or MIME), it is a fatal
error<http://www.w3.org/TR/2006/REC-xml-20060816/> for an entity including
an encoding declaration to be presented to the XML processor in an encoding
other than that named in the declaration, or for an entity which begins with
neither a Byte Order Mark nor an encoding declaration to use an encoding
other than UTF-8."

I am not using HTTP or MIME, etc.  Therefore, the encoding declaration
should not be in EBCDIC at all.

I see no way around this problem unless there is some option or setting to
prevent the behavior.  Has anyone seen this before and have a solution?



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Unsupported encoding error on Z/OS when using WS-Security

Posted by Martin Gainty <mg...@hotmail.com>.
according to spec for SOAP Binding Profile v1.0
http://www.ws-i.org/Profiles/SimpleSoapBindingProfile-1.0.html#Character_Enc
odings
"The Profile requires XML processors to support the "UTF-8" and "UTF-16"
character encodings, in order to aid interoperability.As a consequence of
this, in conjunction with SOAP 1.1's requirement to use the "text/xml" media
type (which has a default character encoding of "us-ascii") on envelopes"

unless otherwise specified us-ascii is the default character encoding

the spec further states:
"A MESSAGE's "Content-Type" HTTP header field-value MUST indicate the
correct character encoding, using the "charset" parameter. "
since you have not requested a specific *charset* the default 'us-ascii' is
assigned

M--
----- Original Message -----
From: "Beth Ayres" <Be...@sas.com>
To: <ax...@ws.apache.org>
Sent: Friday, December 07, 2007 12:08 PM
Subject: Unsupported encoding error on Z/OS when using WS-Security


I am using AXIS2 1.3.  I have a client that runs on Z/OS.  When I make a web
service call using WS-Security, I get a WSSecurityException: Unsupported
encoding (EBCDIC).  I have debugged this problem and found the following.

In Axis2Util.getSOAPEnvelopeFromDOMDocument,

XMLUtils.outputDOM(doc.getDocumentElement(), os, true);

appears to prepend the encoding declaration to the document and encode that
declaration itself in EBCDIC.  The rest of the document is encoded in UTF-8.

Then

ByteArrayInputStream bais =  new ByteArrayInputStream(os.toByteArray());
StAXSOAPModelBuilder stAXSOAPModelBuilder = new
StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(bai
s), null);

StAXSOAPModelBuilder throws the WSSecurityException because of the EBCDIC.

According to the W3C XML spec:

"In the absence of information provided by an external transport protocol
(e.g. HTTP or MIME), it is a fatal
error<http://www.w3.org/TR/2006/REC-xml-20060816/> for an entity including
an encoding declaration to be presented to the XML processor in an encoding
other than that named in the declaration, or for an entity which begins with
neither a Byte Order Mark nor an encoding declaration to use an encoding
other than UTF-8."

I am not using HTTP or MIME, etc.  Therefore, the encoding declaration
should not be in EBCDIC at all.

I see no way around this problem unless there is some option or setting to
prevent the behavior.  Has anyone seen this before and have a solution?



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org