Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing image from a VFP app to a .NET web service
Message
 
To
30/01/2004 18:59:09
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
ASP.NET
Category:
Web Services
Miscellaneous
Thread ID:
00871762
Message ID:
00872608
Views:
18
Daniela and Keith,

Rick Strahl posted a message that provide sample .NET code to take the received byte array and create an image file. The message #863609 is the one to look at.

>Daniela,
>
>.NET likes images to be byte arrays - "Dim myImage() as Byte = CType(lcImage.ToArray(), Byte())". You might be okay passing the image as a string, but you will most likely run into character encoding problems based on your server's locale information. Try copying the string into an array in VFP and then sending the array to the Web Service.
>
>In the Web Service, once you have the image in a byte array, you can use the FileStream/StreamWriter or File classes to write the image to disk.
>
>Also, it will be neccessary to pass in the image MIME type (JPG, GIF, BMP, etc...) with the image so you know how to name the output file.
>
>I'm sorry that I can't post some sample code right now - I'm away from my development machine. I will check this thread later tonight to see if I can be more helpful.
>
>Good luck!
>
>>I have a problem to passing an image from a VFP app to a .NET web service
>>
>>In the VFP application I have something like:
>>
>>local lcImage
>>lcImage = FILETOSTR("c:\test.jpg")
>>oWs = CREATEOBJECT("MSSOAP.SoapClient")
>>oWs.MSSoapInit("http://theserver/ws.wsdl")
>>Ws.TransferImage(lcImage)
>>release oWs
>>
>>In the webservice I have a webmethod as following:
>>
>>WebMethod(Description:="Transfer image", EnableSession:=False) _
>>Public Sub TransferImage(ByVal lcImage As String)
>>
>>' in this method I'd like to read lcImage parameter and save it to the disk (as a .jpg file)
>>
>>End Sub
>>
>>Is it possible? Someone can help me?
>>
>>Thanks in advance
>>
>>Daniela
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform