Return-Path: Delivered-To: apmail-axis-java-dev-archive@www.apache.org Received: (qmail 63832 invoked from network); 4 Jan 2011 17:19:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jan 2011 17:19:49 -0000 Received: (qmail 67240 invoked by uid 500); 4 Jan 2011 17:19:48 -0000 Delivered-To: apmail-axis-java-dev-archive@axis.apache.org Received: (qmail 67018 invoked by uid 500); 4 Jan 2011 17:19:48 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 67010 invoked by uid 99); 4 Jan 2011 17:19:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jan 2011 17:19:48 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of afkham@gmail.com designates 209.85.210.173 as permitted sender) Received: from [209.85.210.173] (HELO mail-iy0-f173.google.com) (209.85.210.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jan 2011 17:19:44 +0000 Received: by iye19 with SMTP id 19so14800849iye.32 for ; Tue, 04 Jan 2011 09:19:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=V4EbKspfkku5Rt4YBYSmTL7KD60ELcdbxsgCGu9SWCM=; b=PA5UyT9MapwafSeFVXFi5egEsOxYehtWA0dXyaeEPdJDOVCopXkRfSHkbDkfnvobi6 iaGbCshHgjHmhIkRAqj1Agm0FcN6DhFJmVdr44yaInICYPn3jR9wv2gx2fl+CNmQ635I 4Zr5TRr36QBkBoLsdiNffl2ouh9b0HCSJ6tIQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=dEJ5A2cZp9rjn7jE7GKhqwKSxRqFAAQYrUwAVeKqdWn7AJhEMt9mMVjMb2z1oSXqD3 S6+5mgSdVILvCCt0bMBDB9GK0coj7WpsPw5GZmLdejlLBLyJ+I+yUV30fYafdeEn3ESu +S0D5rSpD04JJzwdjocWcxuRIAMD1/pHvCVIE= Received: by 10.231.37.129 with SMTP id x1mr5907111ibd.1.1294161562197; Tue, 04 Jan 2011 09:19:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.16.133 with HTTP; Tue, 4 Jan 2011 09:19:02 -0800 (PST) In-Reply-To: References: From: Afkham Azeez Date: Tue, 4 Jan 2011 22:49:02 +0530 Message-ID: Subject: Re: MTOM broken? To: java-dev@axis.apache.org Content-Type: multipart/alternative; boundary=0003255740ce325e96049908785b --0003255740ce325e96049908785b Content-Type: text/plain; charset=ISO-8859-1 After some debugging, I found that the root cause for this is the code in lines 162-164 in AxisServlet. This code overrides the content-type set by the MessageFormatters. So, the serialized response message on the wire is invalid when enableMTOM is true on the server side. Here is the culprit code in AxisServlet. response.setContentType("text/xml; charset=" + msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING)); For example, here is one of the responses I received: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 *Content-Type: text/xml;charset=UTF-8* Transfer-Encoding: chunked Content-Encoding: gzip Vary: Accept-Encoding Date: Tue, 04 Jan 2011 15:19:52 GMT --MIMEBoundary_54171ca790b7b96d69703973e02d7a486e1fb748ceefd6fb Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: binary Content-ID: <0.44171ca790b7b96d69703973e02d7a486e1fb748ceefd6fb@apache.org> 244 --MIMEBoundary_54171ca790b7b96d69703973e02d7a486e1fb748ceefd6fb-- The correct response will have the Content-Type set to something similar to the following: *Content-Type: multipart/related; boundary="MIMEBoundary_826ad2cd3c9f9139ddc2e9428b810eb4137fd90930f13ff8"; type="application/xop+xml"; start="< 0.926ad2cd3c9f9139ddc2e9428b810eb4137fd90930f13ff8@apache.org>"; start-info="text/xml"* * * Azeez On Tue, Jan 4, 2011 at 7:26 PM, Afkham Azeez wrote: > Is MTOM working properly in the current Axis2 trunk? > > We have some services with the enableMTOM parameter set to true and when we > invoke those services using stubs generated using WSDL2Java, we get this > error on the client side. Basically, the client cannot process the response > it received. > > com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' > (code 45) in prolog; expected '<' > at [row,col {unknown-source}]: [1,1] > at > com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648) > at > com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047) > at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069) > at > org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225) > at > org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34) > at > org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225) > at > org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681) > at > org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214) > at > org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204) > at > org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.(StAXSOAPModelBuilder.java:154) > at > org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.(StAXSOAPModelBuilder.java:140) > at > org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:67) > at > org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:179) > at > org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145) > at > org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108) > at > org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67) > at > org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354) > at > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) > at > org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) > at > org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) > > > If enableMTOM is set to false either in the service or the relevant > operation, the invocation returns successfully. > > These services & clients were working fine earlier. > > Any idea what could have gone wrong? > > Thanks > Azeez > * > * > > -- *Afkham Azeez* Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com, * * *Member; Apache Software Foundation; **http://www.apache.org/* * email: **azeez@wso2.com* * cell: +94 77 3320919 blog: **http://blog.afkham.org* * twitter: **http://twitter.com/afkham_azeez* * linked-in: **http://lk.linkedin.com/in/afkhamazeez* * * *Lean . Enterprise . Middleware* * * --0003255740ce325e96049908785b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable After some debugging, I found that the root cause for this is the code in l= ines 162-164 in AxisServlet. This code overrides the content-type set by th= e MessageFormatters. So, the serialized response message on the wire is inv= alid when enableMTOM is true on the server side. Here is the culprit code i= n AxisServlet.

response.setContentType("text/xml; charset=3D"
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+ msgContext
= =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.getProperty(Constants.Co= nfiguration.CHARACTER_SET_ENCODING));

For example,= here is one of the responses I received:

HTTP/1.1 2= 00 OK
Content-Type: text/xml;charset=3DUTF-8
Transfer-Encodi= ng: chunked
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Tue, 04 J= an 2011 15:19:52 GMT

--MIMEBoundary_54171ca790b7b96d69703973e02d7a486e1fb748= ceefd6fb
Content-Type: a= pplication/xop+xml; charset=3DUTF-8; type=3D"text/xml"
Content-Trans= fer-Encoding: binary

<?xml vers= ion=3D'1.0' encoding=3D'UTF-8'?><soapenv:Envelope xml= ns:soapenv=3D"http://schemas.xmlsoap.o= rg/soap/envelope/"><soapenv:Body><ns:additionResponse = xmlns:ns=3D"http://charitha.org"><ns:return&g= t;244</ns:return></ns:additionResponse></soapenv:Body><= ;/soapenv:Envelope>
--MIMEBoundary_= 54171ca790b7b96d69703973e02d7a486e1fb748ceefd6fb--
<= span style=3D"background-color: rgb(204, 204, 204); ">
The correct response wil= l have the Content-Type set to something similar to the following:
Content-Type: multipart/related; bounda= ry=3D"MIMEBoundary_826ad2cd3c9f9139ddc2e9428b810eb4137fd90930f13ff8&qu= ot;; type=3D"application/xop+xml"; start=3D"<0.926ad2cd3c9f9139ddc2e9428b= 810eb4137fd90930f13ff8@apache.org>"; start-info=3D"text/xm= l"

Aze= ez

On Tue, Jan 4, 2011 at 7:26 PM, Afkha= m Azeez <afkham@gm= ail.com> wrote:
Is MTOM working properly in the current Axis2 trunk?

We = have some services with the enableMTOM parameter set to true and when we in= voke those services using stubs generated using WSDL2Java, we get this erro= r on the client side. Basically, the client cannot process the response it = received.

com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-= ' (code 45) in prolog; expected '<'
=A0at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedCh= ar(StreamScanner.java:648)
= at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReade= r.java:2047)
at com.ctc.wstx.sr.BasicS= treamReader.next(BasicStreamReader.java:1069)
at org.apache.axiom.util.stax.wrapper.XMLStreamRe= aderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.= stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDec= lStreamReaderWrapper.java:34)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next= (XMLStreamReaderWrapper.java:225)
at org.apache.axiom.om.im= pl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder= .StAXOMBuilder.next(StAXOMBuilder.java:214)
at org.apache.axiom.soap.= impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java= :204)
at org.apache.= axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuil= der.java:154)
at org.apache.axiom.soap.= impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:14= 0)
at org.apache.axi= s2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:67)
at org.apache.axis2.trans= port.TransportUtils.createDocumentElement(TransportUtils.java:179)
at org.apache.axis2.transpor= t.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.trans= port.TransportUtils.createSOAPMessage(TransportUtils.java:108)
at org.apache.axis2.transport.Tr= ansportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.descr= iption.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)=
at org.apache.axis2= .description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.descr= iption.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.cl= ient.OperationClient.execute(OperationClient.java:165)


If enableMTOM is set to false either i= n the service or the relevant operation, the invocation returns successfull= y.=A0

These services & clients were working fi= ne earlier.=A0

Any idea what could have gone wrong?

Thanks
Azeez





--
Afkham Azeez<= /b>
Senior Software Architect & Senior Manager;=A0WSO2, Inc.;=A0http://wso2.com,=A0


--0003255740ce325e96049908785b--