Hi, > (org/apache/axis2/deployment/axis2_default.xml). In this file the > "enableMTOM" > is set to false, therefore the server does not MTOM-ize the response. This is the engine-wide configuration.. Actually it's possible to enable/disable MTOM/SwA per operation or per service wise as Gabriel has done above or using services.xml..
The message is MIME/multipart with content type application/XOP+XML... That means MTOM is enabled in your response.. I think the problem is with the Axis2 POJO deployment.. Try using DataHandler instead of byte[] as the return type.. >public DataHandler translateString(byte[] document) { You can use ByteArrayDataSource to create a DataHandler out of an byte[]... thanks, Thilina > You could pass a custom axis2.xml with "enableMTOM" set to true, or try to > enable it programmatically on the server side too. > > Regards, > Detelin > > > > On Mon, Apr 7, 2008 at 6:54 PM, Gabriel Landais <[EMAIL PROTECTED]> > wrote: > > Hi, > > I just don't understand if it's a bug or something that I don't > understand. I am not able to send MTOM response from my Axis2 server. Tried > with that simple application : > > > > public class SimpleService { > > > > public byte[] translateString(byte[] document) { > > return document; > > } > > } > > > > ------------------- > > > > public class SimpleServer { > > > > public static void main(String[] args) throws Exception { > > ConfigurationContext context = > ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, > null); > > AxisService service = > AxisService.createService(SimpleService.class.getName(), > context.getAxisConfiguration()); > > Iterator operations = service.getOperations(); > > while (operations.hasNext()) { > > AxisOperation axisOperation = (AxisOperation) operations.next(); > > axisOperation.addParameter(Constants.Configuration.ENABLE_MTOM, > Constants.VALUE_TRUE); > > } > > context.getAxisConfiguration().addService(service); > > SimpleHTTPServer server = new SimpleHTTPServer(context, 8080); > > server.start(); > > } > > > > } > > > > ----------------- > > > > public class SimpleClient { > > > > public static void main(String[] args) throws Exception { > > SimpleServiceStub simpleServiceStub = new SimpleServiceStub(); > > > simpleServiceStub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, > > Constants.VALUE_TRUE); > > > > TranslateString translateString = new TranslateString(); > > > > DataSource ds = new URLDataSource(new > URL("http://www.google.com/")); > > DataHandler dataHandler = new DataHandler(ds); > > > > translateString.setDocument(dataHandler); > > > > TranslateStringResponse translatedString = > simpleServiceStub.translateString(translateString); > > > > DataHandler content = translatedString.get_return(); > > InputStreamReader reader = new > InputStreamReader(content.getInputStream()); > > BufferedReader bufferedReader = new BufferedReader(reader); > > > > String line = bufferedReader.readLine(); > > > > while (line != null) { > > System.out.println(line); > > line = bufferedReader.readLine(); > > } > > } > > > > } > > > > --------------------- > > > > > > Request sent from client looks ok : > > > > POST /axis2/services/SimpleService HTTP/1.1 > > Content-Type: multipart/related; > boundary=MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395; > type="application/xop+xml"; > start="0.urn:uuid:[EMAIL PROTECTED]"; > start-info="application/soap+xml"; action="urn:translateString" > > User-Agent: Axis2 > > Host: 127.0.0.1:1080 > > Transfer-Encoding: chunked > > > > d1c > > --MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395 > > 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:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:translateString > xmlns:ns1="http://ws.apache.org/axis2"><document><xop:Include > href="cid:1.urn:uuid:[EMAIL PROTECTED]" > xmlns:xop="http://www.w3.org/2004/08/xop/include" > /></document></ns1:translateString></soapenv:Body></soapenv:Envelope> > > --MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395 > > Content-Type: text/html; charset=ISO-8859-1 > > Content-Transfer-Encoding: binary > > Content-ID: <1.urn:uuid:[EMAIL PROTECTED]> > > > > [...DATA...] > > > > --MIMEBoundaryurn_uuid_946BAB0526244FF3661207583017395-- > > 0 > > > > ---------------------- > > But returns is just weird. It is multiparted but still base64 encoded : > > > > HTTP/1.1 200 OK > > Date: Mon, 07 Apr 2008 15:43:38 GMT > > Server: Simple-Server/1.1 > > Transfer-Encoding: chunked > > Content-Type: multipart/related; > boundary=MIMEBoundaryurn_uuid_D2ADB7746CB22F21961207583018160; > type="application/xop+xml"; > start="0.urn:uuid:[EMAIL PROTECTED]"; > start-info="application/soap+xml"; action="urn:translateStringResponse" > > > > 20f1 > > --MIMEBoundaryurn_uuid_D2ADB7746CB22F21961207583018160 > > 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:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:translateStringResponse > xmlns:ns="http://ws.apache.org/axis2"><return> > > [...base64 encoded DATA...] > </return></ns:translateStringResponse></soapenv:Body></soapenv:Envelope> > > --MIMEBoundaryurn_uuid_D2ADB7746CB22F21961207583018160-- > > 0 > > > > -------------------- > > > > Any clue? > > Thanks! > > > > -- > > Gabriel <[EMAIL PROTECTED]> > > http://www.codelutin.com > > tel : 02 40 50 29 28 / fax : 09 59 92 29 28 > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- Thilina Gunarathne - http://thilinag.blogspot.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]