XML Element must have CDATA tages around it.

M

Mike

I am consuming a web service hosted by one of our clients. One of the
string properties of the object I am creating to pass to their web service
is called CustomerName. The XML they re receiving I just a standatd xml
elemnt:

<CustomerName>Joe Friday</CustomerName>

The client has told me that the customer name, Joe Firday, needs to have
CDATA tags around it:

<CustomerName>![CDATA[Joe Friday]]</CustomerName>

How can I get VS.NET 2003 to serialize the customer name in this way?

Thanks in advance.

Mike R
 
D

Dan Rogers

Why would they want to do this? I'd question that practice since there
really is no reason to expect the XML passed to pass non-safe XML.
--------------------
 
M

Mike

Thanks for all your help Dan.

The problem I have here is really the client. They cannot make any changes
to their web service because of their development cycle will push the
project back 3 months. I'm having to back my code into a poorly designed
and poorly written web service. Their web service was written by hand and is
not compliant. It's too hard to explain everything going on on their side.
That is why I am having so many problems. This is another example.

The program that is running on their side will crash is it doesn't see CDATA
tags around the customer name. So in the SOAP message I send them I need
the CDATA tags around customer name.

Thanks,

Mike



Dan Rogers said:
Why would they want to do this? I'd question that practice since there
really is no reason to expect the XML passed to pass non-safe XML.
--------------------
From: "Mike" <[email protected]>
Subject: XML Element must have CDATA tages around it.
Date: Fri, 4 Mar 2005 11:16:53 -0700
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
framework.webservices,microsoft.public.webservices
NNTP-Posting-Host: 206-169-51-163.gen.twtelecom.net 206.169.51.163
Path: TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.framework.webservices:9614
microsoft.public.webservices:2751
microsoft.public.dotnet.framework.aspnet.webservices:28418
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

I am consuming a web service hosted by one of our clients. One of the
string properties of the object I am creating to pass to their web service
is called CustomerName. The XML they re receiving I just a standatd xml
elemnt:

<CustomerName>Joe Friday</CustomerName>

The client has told me that the customer name, Joe Firday, needs to have
CDATA tags around it:

<CustomerName>![CDATA[Joe Friday]]</CustomerName>

How can I get VS.NET 2003 to serialize the customer name in this way?

Thanks in advance.

Mike R
 
D

Dan Rogers

I suppose you could embed the string CDATA[] around your real customer
name, and strip it off when you see it.
--------------------
Subject: Re: XML Element must have CDATA tages around it.
Date: Tue, 8 Mar 2005 10:28:55 -0700
Lines: 70
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
framework.webservices
NNTP-Posting-Host: 206-169-51-163.gen.twtelecom.net 206.169.51.163
Path: TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP10.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.framework.webservices:9681
microsoft.public.dotnet.framework.aspnet.webservices:28498
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Thanks for all your help Dan.

The problem I have here is really the client. They cannot make any changes
to their web service because of their development cycle will push the
project back 3 months. I'm having to back my code into a poorly designed
and poorly written web service. Their web service was written by hand and is
not compliant. It's too hard to explain everything going on on their side.
That is why I am having so many problems. This is another example.

The program that is running on their side will crash is it doesn't see CDATA
tags around the customer name. So in the SOAP message I send them I need
the CDATA tags around customer name.

Thanks,

Mike



Dan Rogers said:
Why would they want to do this? I'd question that practice since there
really is no reason to expect the XML passed to pass non-safe XML.
--------------------
From: "Mike" <[email protected]>
Subject: XML Element must have CDATA tages around it.
Date: Fri, 4 Mar 2005 11:16:53 -0700
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
Message-ID: <[email protected]>
Newsgroups:
microsoft.public.dotnet.framework.aspnet.webservices,microsoft.public.dotnet
framework.webservices,microsoft.public.webservices
NNTP-Posting-Host: 206-169-51-163.gen.twtelecom.net 206.169.51.163
Path:
TK2MSFTNGXA02.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.framework.webservices:9614
microsoft.public.webservices:2751
microsoft.public.dotnet.framework.aspnet.webservices:28418
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

I am consuming a web service hosted by one of our clients. One of the
string properties of the object I am creating to pass to their web service
is called CustomerName. The XML they re receiving I just a standatd xml
elemnt:

<CustomerName>Joe Friday</CustomerName>

The client has told me that the customer name, Joe Firday, needs to have
CDATA tags around it:

<CustomerName>![CDATA[Joe Friday]]</CustomerName>

How can I get VS.NET 2003 to serialize the customer name in this way?

Thanks in advance.

Mike R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top