DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 03 Aug 2007 03:14:02 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.webservices        back       

Thread Index
  1    Filipe Marcelino
          2    Filipe Marcelino


Stream from vb.net Webservice to java client   
hi,

i have a webservice written in vb.net with this method:

    <WebMethod()> _
    Public Function GetBinaryFile() As Byte()
        'Open a file stream.
        Dim pobjFileStream As System.IO.FileStream = New
System.IO.FileStream("C:\Inetpub\wwwroot
\WebService1\DPackSetup2003.exe", IO.FileMode.Open)
        'Allocate a byte array that will hold the contents.
        Dim pbytBytes As Byte() = New Byte(pobjFileStream.Length - 1)
{}
        'Now read the stream.
        pobjFileStream.Read(pbytBytes, 0, pobjFileStream.Length)
        'Now convert to a base64 string and return.
        Return pbytBytes
    End Function

What this method does is to return a byte array with the contents of
the file. What i want to do is to have a java client that will get
this byte array and write it to disk. I came up with the following
method:

    private void jButton3MouseClicked(java.awt.event.MouseEvent evt)
{
// TODO add your handling code here:


        try { // Call Web Service Operation
            javawebservice_dotnet_axis.Service1 service = new
javawebservice_dotnet_axis.Service1();
            javawebservice_dotnet_axis.Service1Soap port =
service.getService1Soap();
            // TODO process result here
            javawebservice_dotnet_axis.Stream result =
port.getBinaryFile();

            //Grava ficheiro
            java.io.OutputStreamWriter aux = new
java.io.OutputStreamWriter(new java.io.FileOutputStream("C:\\Documents
and Settings\\me\\Desktop\\savedStream.exe") );
            aux.write(result.toString());
            aux.flush();
            aux.close();


        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }
    }

Theorically i should serialize the result to disk but when the program
reaches the code line 'javawebservice_dotnet_axis.Stream result =
port.getBinaryFile();', it automatically jumps to the end of the
method whitout throwing any kind of exception.

Can someone help me on this?

Thanks in advance for your attention,
Marcelino
Date:Fri, 03 Aug 2007 03:14:02 -0700   Author:  

Re: Stream from vb.net Webservice to java client   
On 3 ago, 11:14, Filipe Marcelino  wrote:

> hi,
>
> i have a webservice written in vb.net with this method:
>
>     <WebMethod()> _
>     Public Function GetBinaryFile() As Byte()
>         'Open a file stream.
>         Dim pobjFileStream As System.IO.FileStream = New
> System.IO.FileStream("C:\Inetpub\wwwroot
> \WebService1\DPackSetup2003.exe", IO.FileMode.Open)
>         'Allocate a byte array that will hold the contents.
>         Dim pbytBytes As Byte() = New Byte(pobjFileStream.Length - 1)
> {}
>         'Now read the stream.
>         pobjFileStream.Read(pbytBytes, 0, pobjFileStream.Length)
>         'Now convert to a base64 string and return.
>         Return pbytBytes
>     End Function
>
> What this method does is to return a byte array with the contents of
> the file. What i want to do is to have ajavaclientthat will get
> this byte array and write it to disk. I came up with the following
> method:
>
>     private void jButton3MouseClicked(java.awt.event.MouseEvent evt)
> {
> // TODO add your handling code here:
>
>         try { // Call Web Service Operation
>             javawebservice_dotnet_axis.Service1 service = new
> javawebservice_dotnet_axis.Service1();
>             javawebservice_dotnet_axis.Service1Soap port =
> service.getService1Soap();
>             // TODO process result here
>             javawebservice_dotnet_axis.Stream result =
> port.getBinaryFile();
>
>             //Grava ficheiro
>            java.io.OutputStreamWriter aux = newjava.io.OutputStreamWriter(newjava.io.FileOutputStream("C:\\Documents
> and Settings\\me\\Desktop\\savedStream.exe") );
>             aux.write(result.toString());
>             aux.flush();
>             aux.close();
>
>         } catch (Exception ex) {
>             // TODO handle custom exceptions here
>         }
>     }
>
> Theorically i should serialize the result to disk but when the program
> reaches the code line 'javawebservice_dotnet_axis.Stream result =
> port.getBinaryFile();', it automatically jumps to the end of the
> method whitout throwing any kind of exception.
>
> Can someone help me on this?
>
> Thanks in advance for your attention,
> Marcelino


I already found out what was happening. Apparently the wsdl file from
the webservice wasn't updated. After updating the file, all run great.

Thanks anyway.
Date:Fri, 03 Aug 2007 07:03:52 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us