Hi Andreas,

Calling this "the correct behavior" seems a stretch to me. It's the expected behavior using the Woodstox output handling, but it leads to strange results in practice. There's no justification in terms of the XML specification for escaping the LF character, since the specification explicitly allows for the various CR/LF combinations (and normalizes them all on input).

It'd be better if Axis2 disabled this Woodstox peculiarity by default.

 - Dennis


Andreas Veithen wrote:
Yuri,

This is actually the correct behavior. There is a discussion in
WSCOMMONS-243 [1] and WSTX-94 [2] about why this is so. If you need to
override this behavior, you may use the feature introduced by
WSCOMMONS-461.

Andreas

[1] https://issues.apache.org/jira/browse/WSCOMMONS-243
[2] http://jira.codehaus.org/browse/WSTX-94

On Wed, Jul 15, 2009 at 04:11, iuriep<[email protected]> wrote:
Hello,

I have implemented a web service and deployed it on Apache Axis2 1.4

One of the XML elements (Payload element) declared as XML type 'String' may
include text containing CRLF (carriage-return, linefeed) character sequence.

The problem is that CRLF character sequence is normalized by Axis into #xD.
The LF character is escaped in the output.

The Java code used to serialize the content of Payload element was generated
by WSDL2Java tool and looks like this:

public void serialize(final QName parentQName,
                         final OMFactory factory,
                         MTOMAwareXMLStreamWriter xmlWriter,
                         boolean serializeType)
           throws XMLStreamException, ADBException {

       protected String localPayload;
       ...
       if (localPayload == null) {
           // write the nil attribute
           throw new ADBException(PAYLOAD_CANNOT_BE_NULL);
       } else {
           xmlWriter.writeCharacters(localPayload);
       }
       ...
}

In the tcpmonitor the SOAP message that is being sent looks like:

POST /axis2/services/Core/realtime/?OrgTaskID=100303 HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8;
action="RealTimeTransaction"
User-Agent: Axis2
Host: iuriep-ws:8079
Transfer-Encoding: chunked

<?xml version='1.0' encoding='UTF-8'?>
  <soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
     <soapenv:Header>
        <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
soapenv:mustUnderstand="true">
           <wsse:UsernameToken
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
wsu:Id="UsernameToken-29624571">
              <wsse:Username>user100303</wsse:Username>
              <wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";>kL1dVUPf5U</wsse:Password>
           </wsse:UsernameToken>
        </wsse:Security>
     </soapenv:Header>
     <soapenv:Body>
        <ns1:COREEnvelopeRealTimeRequest
xmlns:ns1="http://www.caqh.org/SOAP/WSDL/CORERule2.0.1.xsd";>
           <PayloadType>X12_276_004010X093A1</PayloadType>
           <ProcessingMode>RealTime</ProcessingMode>
           <PayloadID>a7cea1a0-6cb9-11de-8782-000c2987b7be</PayloadID>
           <TimeStamp>2009-07-09T06:52:30Z</TimeStamp>
           <SenderID>EDIFECS TSK0021</SenderID>
           <ReceiverID>987654321</ReceiverID>
           <CORERuleVersion>2.0.1</CORERuleVersion>
<Payload>ISA*00*00*987654321*0652*0*P*:#xD;GS*HR*TSK0021*004010X093A1#xD;ST*276*0001#xD;BHT*0010*13**4*3*22*0#xD;DMG*D8*19821103*M#xD;NM1*IL*1*PULSIPHER*BILL*K***MI*5643796#xD;TRN*1*ICN98765432#xD;REF*1K*DCN123467#xD;AMT*T3*2312#xD;DTP*232*RD8*20080401-20080430#xD;SE*16*0001#xD;GE*1*100001112#xD;IEA*1*100001112#xD;</Payload>
        </ns1:COREEnvelopeRealTimeRequest>
     </soapenv:Body>
  </soapenv:Envelope>


I have used WSDL2java tool to generate the stubs, skeletons, and data types
from WSDL
I am also using the Pampart 1.4 module to include security headers into the
SOAP message.

Thanks in advance for any suggestion,
Yuri
--
View this message in context: 
http://www.nabble.com/New-Line-character-is-escaped-in-the-created-SOAP-message-in-Axis2-1.4-web-service.-tp24490808p24490808.html
Sent from the Axis - User mailing list archive at Nabble.com.



Reply via email to