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.&#xd; at
>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(
HTTPTransportUtils.java:290)&#xd;
>  at
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java
:116)&#xd;
>        at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)&#xd;
>    at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)&#xd;
>    at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:252)&#xd;
>       at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:173)&#xd;
>       at
> org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:213)&#xd;
>     at
> org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178)&#xd;
>     at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)&#xd;
>   at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)&#xd;
>   at
> org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:107)&#xd;
>       at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
:148)&#xd;
>     at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:869)&#xd;
>      at
>
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
(Http11BaseProtocol.java:664)&#xd;
>      at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527)&#xd;
>      at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)&#xd;
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)&#xd;
>      at java.lang.Thread.run(Unknown Source)&#xd;Caused by:
> org.apache.axiom.om.OMException: Error while writing to the
> OutputStream.&#xd;   at
> org.apache.axiom.om.impl.MIMEOutputUtils.complete(MIMEOutputUtils.java
:72)&#xd;
>      at
> org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(
MTOMXMLStreamWriter.java:123)&#xd;
>        at
> org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(
OMNodeImpl.java:419)&#xd;
>       at
> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(
SOAPMessageFormatter.java:55)&#xd;
>      at
>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream
(CommonsHTTPTransportSender.java:275)&#xd;
>   at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
CommonsHTTPTransportSender.java:203)&#xd;
>  at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)&#xd;
>    at
> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(
AbstractInOutSyncMessageReceiver.java:48)&#xd;
>   at
> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)&#xd;
> at
>
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(
HTTPTransportUtils.java:279)&#xd;
>  ... 17 more&#xd;Caused by:
> javax.activation.UnsupportedDataTypeException: no object
> DCH for MIME type application/octet-stream&#xd;     at
> javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java
:885)&#xd;
> at
> javax.activation.DataHandler.writeTo(DataHandler.java:316)&#xd;
>      at
> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)&#xd;
>        at
> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:845)&#xd;
> at
> org.apache.axiom.om.impl.MIMEOutputUtils.writeBodyPart(
MIMEOutputUtils.java:128)&#xd;
>         at
> org.apache.axiom.om.impl.MIMEOutputUtils.complete(MIMEOutputUtils.java
:65)&#xd;
>         ... 26 more&#xd;
> </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]


Reply via email to