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