1   /*
2    * $Id: TestMtomImpl.java 11650 2008-04-27 09:21:50Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.cxf.testmodels;
12  
13  import java.io.IOException;
14  import java.io.InputStream;
15  
16  import javax.activation.DataHandler;
17  import javax.activation.FileDataSource;
18  import javax.jws.WebService;
19  import javax.xml.ws.Holder;
20  
21  import org.apache.cxf.mime.TestMtom;
22  
23  @WebService(serviceName = "TestMtomService", 
24          portName = "TestMtomPort", 
25          targetNamespace = "http://cxf.apache.org/mime", 
26          endpointInterface = "org.apache.cxf.mime.TestMtom",
27          wsdlLocation = "testutils/mtom_xop.wsdl")
28          
29  public class TestMtomImpl implements TestMtom {
30  
31      public void testXop(Holder<String> name, Holder<DataHandler> attachinfo) {
32          // TODO Auto-generated method stub
33          name.value = "return detail + " + name.value;
34          
35          try
36          {
37              InputStream inputStream = attachinfo.value.getInputStream();
38              while (inputStream.read() != -1);
39          }
40          catch (IOException e)
41          {
42              // TODO Auto-generated catch block
43              e.printStackTrace();
44          }
45          
46          attachinfo.value = new DataHandler(new FileDataSource("src/test/resources/mtom-conf.xml"));
47      }
48  
49  }