I was using axis2-1.1.1,so I've downloaded the 1.2 version, installed and set the MTOM enabled at axis2.xml.
Of course, I've recompiled the service and the client application...,

Now the error messaging is (when running the client):
============================ ERROR
=======================================================

java.lang.RuntimeException: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException:
Unexpected EOF; was expecting a close tag for element <ns1:return>
 at [row,col {unknown-source}]: [1,14236]

===================================================================================

The TCPMONITOR messagins are:

===================== REQUEST
=======================================================
POST /axis2/services/GetImageService HTTP/1.1
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_29847B40D998EE2D421178658131132; type="application/xop+xml"; start="<0.urn:uuid:[EMAIL PROTECTED]>"; start-info="text/xml"; charset=UTF-8
SOAPAction: "urn:receiveImage"
User-Agent: Axis2
Host: 127.0.0.1:3333
Transfer-Encoding: chunked

1d1
--MIMEBoundaryurn_uuid_29847B40D998EE2D421178658131132
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:[EMAIL PROTECTED]>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><receiveImage /></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_29847B40D998EE2D421178658131132--
0
===================== REQUEST
=======================================================

===================== RESPONSE
=======================================================
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_FFC36B12EF782CBABF1178658131946; type="application/xop+xml"; start="<0.urn:uuid:[EMAIL PROTECTED]>"; start-info="text/xml";charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 08 May 2007 21:02:12 GMT

2000
--MIMEBoundaryurn_uuid_FFC36B12EF782CBABF1178658131946
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:[EMAIL PROTECTED]>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:receiveImageResponse xmlns:ns1="http://axiomWSimage.first/xsd"><ns1:return><ns:image xmlns:ns="http://www.dees.ufmg.br">/9j/4AAQSkZJRgABAQEASABIAAD//gAMQXBwbGVNYXJrDf/bAIQAIRcZHRkVIR0bHSUjIScxUTUxLS0xY0dLO1F1Z3t5c2dxb4KSup6CirCMb3Gi3KSwwMbQ0tB9nOT04sryuszQyAEjJSUxKzFfNTVfyIZxhsjIy ..... snip ....... TdK/487r/dP/AKCaBJ6GrZ6wt1deT5RQEHYxbO7HtjilvtXitJkjEZkyAxOcYBrH0f8A4/4Px/nSaz/x+L/1yX+VAXOkuLpYLRrjBZQoIA75qnba3BPJsdWiJ+7nnP5Uuof8gI/9c0/pXPWn/H3D9aAbN5NbRr3yBCRGXKeZu/XGKLvUdOjuGSWJZHXhiY88/lWLD/yEF/67H+ZqPU/+Qlcf9dDQNO5//9k=</ns:image>38

--MIMEBoundaryurn_uuid_FFC36B12EF782CBABF1178658131946
2
--
2000
--MIMEBoundaryurn_uuid_FFC36B12EF782CBABF1178658131946
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:[EMAIL PROTECTED]>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:receiveImageResponse xmlns:ns1="http://axiomWSimage.first/xsd"><ns1:return><ns:image xmlns:ns=" http://www.dees.ufmg.br ">/9j/4AAQSkZJRgABAQEASABIAAD//gAMQXBwbGVNYXJrDf/bAIQAIRcZHRkVIR0bHSUjIScxUTUxLS0xY0dLO1F1Z3t5c2dxb4KSup6CirCMb3Gi3KSwwMbQ0tB9nOT04sryuszQyAEjJSUxKzFfNTVfyIZxhsjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjI/8QBogAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoLAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGB................ snip.............
XhiY88/lWLD/yEF/67H+ZqPU/+Qlcf9dDQNO5//9k=</ns:image></ns1:return></ns1:receiveImageResponse></soapenv:Body></soapenv:Envelope>
38

--MIMEBoundaryurn_uuid_FFC36B12EF782CBABF1178658131946
2
--
0
===================== RESPONSE
=======================================================

Debbuging with eclipse, I've noted that the exception happens when executing the client line command: OMElement element = stub.receiveImage().get_return();

what should I do now? Ath the tcpmon messages now we can see the word "binary"....
Please, anyone help me............

remembering, my client code source is:

===================== CLIENT SOURCE CODE
=======================================================

public static void main(String [] args) throws Exception {

// create the stub
GetImageServiceStub stub = new GetImageServiceStub();
 
// Enable MTOM in the client side
stub._getServiceClient().getOptions().setProperty(
Constants.Configuration.
ENABLE_MTOM , Constants. VALUE_TRUE);

//Increase the time out when sending large attachments
stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(200000);

// result string
String resultMsg= "";
try {
// invoking the service and getting the response ....
// getting the OMelement from the response  of the webService
OMElement element = stub.receiveImage().get_return();
OMText binaryNode = (OMText) element.getFirstOMChild();
    binaryNode.setBinary(
true );

    String fileName =
"test.jpg";

   
//Extracting the data and saving
    DataHandler actualDH=(DataHandler) binaryNode.getDataHandler();
  
   
   
//DataSource ds = new inp
    FileOutputStream imageOutStream = new FileOutputStream(fileName);
   
//binaryNode.serializeAndConsume(imageOutStream);
    actualDH.writeTo(imageOutStream);
    resultMsg =
"File received!!! Name: "+fileName;
}
catch (Exception e) {
resultMsg =
"error\n" +e.getMessage();
}

System.
out .println( "Done!\n" +resultMsg);
}
===================== CLIENT SOURCE CODE
=======================================================

At 07:30 8/5/2007, you wrote:
Hi Luca,
Looking at the message traces it seems that your attachment is
transmitted inline.. Not as a MTOM attachment... It seems like you do
not have MTOM enabled in the Axis2 server (Notice that the MIME
boundaries are missing)... Please check the axis2.xml of your axis2
server......

Following is an alternative quick fix to get this work...
     OMText binaryNode = (OMText) element.getFirstOMChild();
binaryNode.setBinary(true);
     //Extracting the data and saving

thanks,
Thilina

--
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to