Honestly, that all looks correct.  Any chance you can package up a test case, 
including what is happening on the client side?

Dan


On Tuesday 28 September 2010 5:28:15 am Alexander Woude wrote:
> Hi guys,
> 
> I try to sent a file (jpg or pdf) to my Webservice using MTOM.
> When I try to write the file to disk, the file is only 1 k big and contains
> different data then I expect. I test the service with attachment through
> SOAP.
> 
> What do I do wrong?
> 
> Service Implementation:
> 
> @WebService(endpointInterface = "zz.com.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
> 
>     public int uploadData(
>             @XmlMimeType("*/*") DataHandler code) {
>         try {
>             OutputStream fos = new FileOutputStream(new
> File("c:\\MTOM.jpg"));
> 
>             InputStream fis = code.getInputStream();
> 
>             byte[] b = new byte[1000000];
>             int bytesRead = 0;
>             while ((bytesRead = fis.read(b)) != -1) {
>                 fos.write(b, 0, bytesRead);
>             }
>             fos.flush();
>             fos.close();
>             fis.close();
> 
>         } catch (IOException e) {
>             // TODO Auto-generated catch block
>             e.printStackTrace();
>         }
>         return 0;
>     }
> }
> 
> BEANS.XML
> 
> <jaxws:endpoint id="helloWorld" implementor="zz.com.HelloWorldImpl"
>         address="/HelloWorld">
> 
>         <jaxws:properties>
>             <entry key="mtom-enabled" value="true" />
>             <entry key="mtom-threshold" value="0" />
>         </jaxws:properties>
> 
>     </jaxws:endpoint>

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to