I have a related question regarding SwA support. In the axis2.xml, if I set enableSwA to true, my response can arrive at the client with attachment, but then all the requests (no matter there is any attachment) are considered as multipart requests and I get "Bad Request" error. The "Bad Request" error will eliminate if I set enableSwA to false. If I set enableSwA to false, I can only get the soap response but no attachment is received at the client.
The following is the code snippet where I try to enable SwA only for one service. /** in axis2.xml, enableSwA is set to false **/ FileDataSource ackDataSource = new FileDataSource(ackFullPath); DataHandler outDataHandler = new DataHandler(ackDataSource); String attachmentID = out.addAttachment(outDataHandler); /** try to enableSwA for this out MessageContext only */ out.setDoingSwA(true); The out.setDoingSwA(true) seems not take effect. Could you suggest how to solve the problem? I am using Axis2 1.2. Regards, Xinjun On 5/1/07, Thilina Gunarathne <[EMAIL PROTECTED]> wrote:
> > DataHandler(byte_data,"application/octet-stream"); You may use the ByteArrayDataSource for this purpose.. Alternatively you can try using "binary" instead of the "application/octet-stream"... HTH, Thilina > > BinaryData binaryData =new BinaryData(); > > binaryData.setBase64Binary(dataHandler); > > binaryData.setContentType(dataHandler.getContentType()); > > response.setBinaryData(binaryData); > > > > The problem is in the method toEnvelope setting the child for the body. > > > > I'm getting the following exception: > > > > java.lang.RuntimeException: org.apache.axiom.om.OMException: Referenced > > Attachment not found in the MIME Message. > > > ContentID:1.urn:uuid:[EMAIL PROTECTED] > > at > > > client.Medici_LinkSOAP12PortStub.fromOM (Medici_LinkSOAP12PortStub.java:5296) > > at > > > client.Medici_LinkSOAP12PortStub.getAttachment (Medici_LinkSOAP12PortStub.java:4103) > > at client.ClientUtilities.mtomTest(ClientUtilities.java:476) > > at client.Client.main(Client.java:69) > > Caused by: org.apache.axiom.om.OMException: Referenced Attachment not > found > > in the MIME Message. > > > ContentID:1.urn:uuid:[EMAIL PROTECTED] > > at > > > org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder.getDataHandler (MTOMStAXSOAPModelBuilder.java:103) > > at > > > medici_link.xmime.xsd.BinaryData$Factory.parse(BinaryData.java:429) > > at > > > medici_link.op_messages.xsd.GetAttachmentResponse$Factory.parse( GetAttachmentResponse.java:342) > > at > > > client.Medici_LinkSOAP12PortStub.fromOM (Medici_LinkSOAP12PortStub.java:5024) > > ... 3 more > > > > And with TCPMon I can see the fault as an attachment. > > > > Thanks and regards, > > > > Jorge Fernández > > > > > > > -- > Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > ________________________________ > > LLama Gratis a cualquier PC del Mundo. > Llamadas a fijos y móviles desde 1 céntimo por minuto. > http://es.voice.yahoo.com > > > HTTP/1.1 200 OK > Server: Apache-Coyote/1.1 > Content-Type: multipart/related; > boundary=MIMEBoundaryurn_uuid_3B82B5DA59C7F75D1E1178016055344; > type="application/xop+xml"; > start="<0.urn:uuid:[EMAIL PROTECTED]>"; > start-info="application/soap+xml"; > action="urn:getAttachment";charset=UTF-8Transfer-Encoding: > chunkedDate: Tue, 01 May 2007 10:40:54 > GMT516--MIMEBoundaryurn_uuid_3B82B5DA59C7F75D1E1178016055344Content-Type: > application/xop+xml; charset=UTF-8; > type="application/soap+xml"Content-Transfer-Encoding: > binaryContent-ID: > <0.urn:uuid:[EMAIL PROTECTED]> > <?xml version='1.0' encoding='UTF-8'?> > <soapenv:Envelope > xmlns:wsa="http://www.w3.org/2005/08/addressing" > xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> > <soapenv:Header> > <wsa:ReplyTo> > > <wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address> > <wsa:ReferenceParameters> > <axis2:ServiceGroupId > xmlns:axis2="http://ws.apache.org/namespaces/axis2 ">urn:uuid:3B82B5DA59C7F75D1E1178016053150</axis2:ServiceGroupId> > </wsa:ReferenceParameters> > </wsa:ReplyTo> > > <wsa:MessageID>urn:uuid:3B82B5DA59C7F75D1E1178016055296</wsa:MessageID> > <wsa:Action>urn:getAttachment</wsa:Action> > > <wsa:RelatesTo>urn:uuid:B5AEE5ABDE83138F781178016055102</wsa:RelatesTo> > </soapenv:Header> > <soapenv:Body> > <ns3:getAttachmentResponse > xmlns:ns3="http://op_messages.medici_link/xsd"> > <ns3:binaryData > xmlns:s1="http://www.w3.org/2005/05/xmlmime" > s1:contentType="application/octet-stream"> > <xop:Include > href="cid:1.urn:uuid:[EMAIL PROTECTED]" > xmlns:xop="http://www.w3.org/2004/08/xop/include" /> > </ns3:binaryData> > </ns3:getAttachmentResponse> > </soapenv:Body> > > </soapenv:Envelope>38--MIMEBoundaryurn_uuid_3B82B5DA59C7F75D1E1178016055344 > 10c1 > --MIMEBoundaryurn_uuid_3B82B5DA59C7F75D1E1178016055487 > Content-Type: application/xop+xml; charset=UTF-8; > type="application/soap+xml" > Content-Transfer-Encoding: binary > Content-ID: > > <0.urn:uuid:[EMAIL PROTECTED]> > <?xml version='1.0' encoding='UTF-8'?> > <soapenv:Envelope > xmlns:wsa="http://www.w3.org/2005/08/addressing" > xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> > <soapenv:Header> > > <wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action> > > <wsa:RelatesTo>urn:uuid:B5AEE5ABDE83138F781178016055102</wsa:RelatesTo> > </soapenv:Header> > <soapenv:Body> > <soapenv:Fault> > <soapenv:Code> > > <soapenv:Value>soapenv:Sender</soapenv:Value> > </soapenv:Code> > <soapenv:Reason> > <soapenv:Text xml:lang="en-US">Error while > writing to the OutputStream.</soapenv:Text> > </soapenv:Reason> > <soapenv:Detail> > <Exception>org.apache.axis2.AxisFault: Error > while writing to the OutputStream.
 at > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest( HTTPTransportUtils.java:290)
 > at > org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java :116)
 > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
 > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:252)
 > at > org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:173)
 > at > org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:213)
 > at > org.apache.catalina.core.StandardContextValve.invoke( StandardContextValve.java:178)
 > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :126)
 > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :105)
 > at > org.apache.catalina.core.StandardEngineValve.invoke( StandardEngineValve.java:107)
 > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java :148)
 > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java :869)
 > at > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection (Http11BaseProtocol.java:664)
 > at > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( PoolTcpEndpoint.java:527)
 > at > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( LeaderFollowerWorkerThread.java:80)
 > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( ThreadPool.java:684)
 > at java.lang.Thread.run(Unknown Source)
Caused by: > org.apache.axiom.om.OMException: Error while writing to the > OutputStream.
 at > org.apache.axiom.om.impl.MIMEOutputUtils.complete(MIMEOutputUtils.java :72)
 > at > org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush( MTOMXMLStreamWriter.java:123)
 > at > org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume( OMNodeImpl.java:419)
 > at > org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo( SOAPMessageFormatter.java:55)
 > at > org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream (CommonsHTTPTransportSender.java:275)
 > at > org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke( CommonsHTTPTransportSender.java:203)
 > at > org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
 > at > org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive( AbstractInOutSyncMessageReceiver.java:48)
 > at > org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
 > at > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest( HTTPTransportUtils.java:279)
 > ... 17 more
Caused by: > javax.activation.UnsupportedDataTypeException: no object > DCH for MIME type application/octet-stream
 at > javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java :885)
 > at > javax.activation.DataHandler.writeTo(DataHandler.java:316)
 > at > javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
 > at > javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:845)
 > at > org.apache.axiom.om.impl.MIMEOutputUtils.writeBodyPart( MIMEOutputUtils.java:128)
 > at > org.apache.axiom.om.impl.MIMEOutputUtils.complete(MIMEOutputUtils.java :65)
 > ... 26 more
 > </Exception> > </soapenv:Detail> > </soapenv:Fault> > </soapenv:Body> > </soapenv:Envelope> > 38 > > --MIMEBoundaryurn_uuid_3B82B5DA59C7F75D1E1178016055487 > 2 > -- > 0 > > -- Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
