View Javadoc

1   /*
2    * $Id: TestMtomImpl.java 22553 2011-07-25 07:50:46Z claude.mamo $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.module.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  import org.apache.cxf.mime.types.XopStringType;
23  
24  @WebService(serviceName = "TestMtomService", portName = "TestMtomPort", targetNamespace = "http://cxf.apache.org/mime", endpointInterface = "org.apache.cxf.mime.TestMtom", wsdlLocation = "testutils/mtom_xop.wsdl")
25  public class TestMtomImpl implements TestMtom
26  {
27  
28      public XopStringType testXopString(XopStringType data)
29      {
30          return data;
31      }
32  
33      public void testXop(Holder<String> name, Holder<DataHandler> attachinfo)
34      {
35          name.value = "return detail + " + name.value;
36  
37          try
38          {
39              InputStream inputStream = attachinfo.value.getInputStream();
40              while (inputStream.read() != -1);
41          }
42          catch (IOException e)
43          {
44              e.printStackTrace();
45          }
46  
47          attachinfo.value = new DataHandler(new FileDataSource("src/test/resources/mtom-conf-service.xml"));
48      }
49  
50  }