473,715 Members | 5,945 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1277
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 "insignific ant 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*****@401kex change.com> wrote in message
news:uj******** ******@TK2MSFTN GP15.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
410
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 running in a Windows XP. But when I am trying to run the same webservice in a Windows 2000 Advanced Server Machine, I am getting the following error “System.Web.Services.Protocols.SoapException: Server was unable to process request. ...
0
2013
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 Remote Object. The Remot method Returns an Object. This Webservice also returns the same object All things are working fine when this Web Service is running in
7
7493
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
19596
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 having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
7
9551
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 example, we have 5 possible data items: name, address, company, creation_date, telephone (in reality there are 100s of possible data).
1
2926
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 like those found in the Duwamish 7 sample 2. WebServices project - wraps up business logic 3. C# winforms consumer connecting to the WebServices. This project has the data project as a reference.
3
1913
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 parameters to methods on the dll, and all parameters to my web methods are strings. (The strings, just for further info, contain XML).
2
1627
by: Asim Qazi | last post by:
Hi All public class MyResponse { public bool m_bStatus; public string m_szErrorCode; public string m_szMessage; }
1
1455
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 some right way to return the correct XML from my WebService? Just for example, the WebMethod looks like it:
0
8821
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9196
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9103
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3175
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.