473,388 Members | 1,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Webservice returning strings

Hi. I've got a problem that is totally baffling me. Its also a very
simple one. Basically the following code :

<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello" & Chr(13) & Chr(10) & "World"
End Function

Returns "HelloWorld" when I display it in a textbox or output it to a
file with StreamWriter. I'm creating an application that takes files
from the webserver, zips them and sends them to the client app. Along
the way it was dropping all my carriage-returns. When I tried executing
the above simple example, it still filters out the new lines. What
baffles me more is that when I first compress the file and pass an array
of bytes to the client, the client uncompresses the file correctly but
the output still contains no carriage-returns. I've tried all different
combinations of carriage-returns/line-feeds but regardless when I do a
string.indexOf(chr(13)) on the returned string I get nothing.

Thank you in advance for any help you can offer.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #1
2 1265
Richard,

I do not know if there is an easy solution for this problem. But what you
see is due t the fact that Web Services return XML data. In XML, chr(10) and
chr(13) are considered "insignificant white spaces", and do not show up.

I know this doesn't help much, but I could not ind a solution without
changing the way your web method handles the returned data (like returning
an aray of string lines, so you know each elemet is a different line).

Telmo
"Richard Bailey" <rb*****@401kexchange.com> wrote in message
news:uj**************@TK2MSFTNGP15.phx.gbl...
Hi. I've got a problem that is totally baffling me. Its also a very
simple one. Basically the following code :

<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello" & Chr(13) & Chr(10) & "World"
End Function

Returns "HelloWorld" when I display it in a textbox or output it to a
file with StreamWriter. I'm creating an application that takes files
from the webserver, zips them and sends them to the client app. Along
the way it was dropping all my carriage-returns. When I tried executing
the above simple example, it still filters out the new lines. What
baffles me more is that when I first compress the file and pass an array
of bytes to the client, the client uncompresses the file correctly but
the output still contains no carriage-returns. I've tried all different
combinations of carriage-returns/line-feeds but regardless when I do a
string.indexOf(chr(13)) on the returned string I get nothing.

Thank you in advance for any help you can offer.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #2
Ok, I came up with a solution but I was hoping there was a better way.
I just inserted <NL> where ever there was supposed to be a new line and
after downloading the file I replace the <NL> with actual
carriage-returns. I understand why transferring data from a web service
to a client application would cause the string to lose carriage-returns,
but even transferring string data from a private function to another
function loses them.

Oh well. For now I got my mickey mouse solution. If anyone has any
better ideas, please let me know. Thanks a bunch.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Karuppasamy | last post by:
H I have a WebService calling a Method in a Remote Object. The Remote method Returns an Object. This Webservice also returns the same object. All things are working fine when this Web Service is...
0
by: ksams | last post by:
Hi Hope this mail finds you in the best of health and in good sprit. I have a problem with Web Service in a Windows 2000 Advanced Serve Machine. I have a WebService calling a Method in a...
7
by: Ohad Young | last post by:
Hi, I was wondering if it is possible to code a webservice that returns a picture? If so, How? Thanks in advance, Ohad
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
7
by: Peter Kirk | last post by:
Hi I am trying to write a web service. This web service is a "generic webservice" for our solution - that is, it should be able to return different data depending on who calls it. For...
1
by: rival | last post by:
Hi. I've a single solution with many projects. I'm using VS2003 and framework 1.1 1. Data project - contains UserData class, inheriting from DataSet, and setting up constants and columns...
3
by: Pebble | last post by:
Hi folks, I have a WebService that simply acts as a thin wrapper to a .Net dll. Literally almost zero code in the WebService. Parameters passed to the WebService are simply used as...
2
by: Asim Qazi | last post by:
Hi All public class MyResponse { public bool m_bStatus; public string m_szErrorCode; public string m_szMessage; }
1
by: Ronchese | last post by:
Helllo. I need to return a XML from my WebService, but I'm not getting the result as a XML. I mean, instead of receiveing a tag (<xyy></xyz>), I'm receiving it encoded (with &lt; or &gt;). There is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.