axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Landais <land...@codelutin.com>
Subject Axis2 1.3 - ENABLE_MTOM
Date Mon, 07 Apr 2008 15:54:07 GMT
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:946BAB0526244FF3661207583017396@apache.org"; 
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:946BAB0526244FF3661207583017396@apache.org>
 
<?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:946BAB0526244FF3661207583017524@apache.org" 
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:946BAB0526244FF3661207583017524@apache.org>
 
[...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:D2ADB7746CB22F21961207583018161@apache.org"; 
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:D2ADB7746CB22F21961207583018161@apache.org>
 
<?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 <landais@codelutin.com>
http://www.codelutin.com
tel : 02 40 50 29 28 / fax : 09 59 92 29 28


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message