Solved

Problem with & when using a web service

Posted on 2009-04-02
5
243 Views
Last Modified: 2012-05-06
I am using third party webservice to create records.

I read in from database this title

   "Customers & Records"

    However the webservice writes to database as

    "Customers & invoices"

notice it adds      "&"     instead of &

What is the best way around this?  I want it to write "&" as oppose to "&"


In my code I have  

customercategory thiscategory = new customercategory();
thiscategory.title = /////read in tite from database



0
Comment
Question by:mugsey
  • 2
  • 2
5 Comments
 
LVL 9

Expert Comment

by:VikramMullick
ID: 24047788
try using && instead of &
0
 

Author Comment

by:mugsey
ID: 24047795
Thanks but I cannot modify the database table I am reading from
0
 
LVL 9

Expert Comment

by:VikramMullick
ID: 24047817
I guess you might be using dataset/datatable for fetching data .
Then try to replace/append the & symbol and then send it to webservice.
0
 

Author Comment

by:mugsey
ID: 24047853
Yes I have been doing that with string.replace  but I need the "&" to be preserved
0
 
LVL 1

Accepted Solution

by:
Prodige earned 500 total points
ID: 24047875
It appears the problem is not so much with the fetching. The problem lies in how the web service communicates with the database. Posting via the webservice will adjust the input data to be a valid soap message and converts your & to the html / xml equivalent of & but it does not appear to be converting it back to an & when it hits the db.

If you have no access to the see what the web service is doing then you either have to search and replace the "&" with "and" or try using the url safe version which is "%26", last resort would be to try and use the hex version "#26"
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Import Data from Multiple Text Files in Excel 12 60
RegEx with optional part 4 42
How to limit User Input 2 27
Need syntax help building hyperlink 2 25
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question