473,385 Members | 1,355 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,385 software developers and data experts.

XML as a WebService parameter

Hi,
We recently converted a 1.1 project to 2.0 and this included a webservice
which accepted XML for one of the parameters. Since converting to 2.0 I am
getting the following message:
---
A potentially dangerous Request.Form value was detected from the client
(myparam="<root><blah....").
---

The fix used for ASPX pages is to include the @Page directive with
validateRequest="false" however this does not work for ASMX pages ("The
directive 'Page' is unknown").

Does anyone know of a way to turn this off for webservices?

Thanks!

Nov 8 '07 #1
4 8001
Hi Bill,

From your description, you have an ASP.NET webservice (asmx endpoint) which
has a webmethod accepting a XML string parameter, and you'll get validation
error when you call the webservice, correct?

regarding on the webservice, I'd like to confirm the following things:

** The xml parameter of your webmethod is of "String" type, correct?

** How are you consuming the webservice, through the asmx page(via http
post) or through a generated client proxy class?

Generally, for XML webserivice, since its underlying message is encoded via
SOAP XML, therefore, we should not directly pass parameter or return value
of raw XML string content. Here is a former blog article which has
mentioend this:

#Rant: Don't return XML in string variables
http://blogs.msdn.com/mpowell/archiv...12/130637.aspx

Also, if you do need to pass XML string content, you can consider the
following means:

** manually perform htmlencoding on it so that all the xml content are in
escaped format

** use a CDATA section to wrapper the xmlstring.

Here is a forum thread discussing on this problem too:

#Passing an XML string as part of an XML Web Service
http://forums.asp.net/p/1064300/1631786.aspx#1631786

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



-------------------
From: =?Utf-8?B?QmlsbEF0V29yaw==?= <Bi********@nospam.nospam>
Subject: XML as a WebService parameter
Date: Thu, 8 Nov 2007 05:43:01 -0800

Hi,
We recently converted a 1.1 project to 2.0 and this included a webservice
which accepted XML for one of the parameters. Since converting to 2.0 I am
getting the following message:
---
A potentially dangerous Request.Form value was detected from the client
(myparam="<root><blah....").
---

The fix used for ASPX pages is to include the @Page directive with
validateRequest="false" however this does not work for ASMX pages ("The
directive 'Page' is unknown").

Does anyone know of a way to turn this off for webservices?

Thanks!
Nov 9 '07 #2
Hi Steven,
The param is of type "string" and the webservice is called via other .net
apps (various methods).

We had this working fine under 1.1 and since the apps are all tightly
controlled, passing in an XML string was acceptable. Is this a consequence of
moving to 2.0? Do you know if it can be turned off?

Thanks.

"Steven Cheng[MSFT]" wrote:
Hi Bill,

From your description, you have an ASP.NET webservice (asmx endpoint) which
has a webmethod accepting a XML string parameter, and you'll get validation
error when you call the webservice, correct?

regarding on the webservice, I'd like to confirm the following things:

** The xml parameter of your webmethod is of "String" type, correct?

** How are you consuming the webservice, through the asmx page(via http
post) or through a generated client proxy class?

Generally, for XML webserivice, since its underlying message is encoded via
SOAP XML, therefore, we should not directly pass parameter or return value
of raw XML string content. Here is a former blog article which has
mentioend this:

#Rant: Don't return XML in string variables
http://blogs.msdn.com/mpowell/archiv...12/130637.aspx

Also, if you do need to pass XML string content, you can consider the
following means:

** manually perform htmlencoding on it so that all the xml content are in
escaped format

** use a CDATA section to wrapper the xmlstring.

Here is a forum thread discussing on this problem too:

#Passing an XML string as part of an XML Web Service
http://forums.asp.net/p/1064300/1631786.aspx#1631786

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



-------------------
From: =?Utf-8?B?QmlsbEF0V29yaw==?= <Bi********@nospam.nospam>
Subject: XML as a WebService parameter
Date: Thu, 8 Nov 2007 05:43:01 -0800

Hi,
We recently converted a 1.1 project to 2.0 and this included a webservice
which accepted XML for one of the parameters. Since converting to 2.0 I am
getting the following message:
---
A potentially dangerous Request.Form value was detected from the client
(myparam="<root><blah....").
---

The fix used for ASPX pages is to include the @Page directive with
validateRequest="false" however this does not work for ASMX pages ("The
directive 'Page' is unknown").

Does anyone know of a way to turn this off for webservices?

Thanks!

Nov 9 '07 #3
Hi,
Is it possible to turn off the parameter validation for a webservice? We
could pass in XML as a parameter in 1.1 but not in 2.0. These are all
internal apps and the incoming parameter poses much less of a security risk
than normal.

Thanks.

"BillAtWork" wrote:
Hi Steven,
The param is of type "string" and the webservice is called via other .net
apps (various methods).

We had this working fine under 1.1 and since the apps are all tightly
controlled, passing in an XML string was acceptable. Is this a consequence of
moving to 2.0? Do you know if it can be turned off?

Thanks.

"Steven Cheng[MSFT]" wrote:
Hi Bill,

From your description, you have an ASP.NET webservice (asmx endpoint) which
has a webmethod accepting a XML string parameter, and you'll get validation
error when you call the webservice, correct?

regarding on the webservice, I'd like to confirm the following things:

** The xml parameter of your webmethod is of "String" type, correct?

** How are you consuming the webservice, through the asmx page(via http
post) or through a generated client proxy class?

Generally, for XML webserivice, since its underlying message is encoded via
SOAP XML, therefore, we should not directly pass parameter or return value
of raw XML string content. Here is a former blog article which has
mentioend this:

#Rant: Don't return XML in string variables
http://blogs.msdn.com/mpowell/archiv...12/130637.aspx

Also, if you do need to pass XML string content, you can consider the
following means:

** manually perform htmlencoding on it so that all the xml content are in
escaped format

** use a CDATA section to wrapper the xmlstring.

Here is a forum thread discussing on this problem too:

#Passing an XML string as part of an XML Web Service
http://forums.asp.net/p/1064300/1631786.aspx#1631786

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



-------------------
From: =?Utf-8?B?QmlsbEF0V29yaw==?= <Bi********@nospam.nospam>
Subject: XML as a WebService parameter
Date: Thu, 8 Nov 2007 05:43:01 -0800

Hi,
We recently converted a 1.1 project to 2.0 and this included a webservice
which accepted XML for one of the parameters. Since converting to 2.0 I am
getting the following message:
---
A potentially dangerous Request.Form value was detected from the client
(myparam="<root><blah....").
---

The fix used for ASPX pages is to include the @Page directive with
validateRequest="false" however this does not work for ASMX pages ("The
directive 'Page' is unknown").

Does anyone know of a way to turn this off for webservices?

Thanks!
Nov 12 '07 #4
Hi Bill,

So are you calling the webservice through http POST or a client proxy
class? BTW, I've tried using a soap client proxy to call webservice and
input some string paramter(contains html markup), it doesn't raise such
exception. Would let me know your client type and the a simple text snippet
that can cause the problem?

So far what I can find is the <pages validateRequest= ... /setting in
web.config which is a global one for web pages. There is no dedicated
validation setting for webservice asmx endpoint.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: =?Utf-8?B?QmlsbEF0V29yaw==?= <Bi********@nospam.nospam>
Subject: RE: XML as a WebService parameter
Date: Mon, 12 Nov 2007 01:05:02 -0800
Hi,
Is it possible to turn off the parameter validation for a webservice? We
could pass in XML as a parameter in 1.1 but not in 2.0. These are all
internal apps and the incoming parameter poses much less of a security risk
than normal.

Thanks.

"BillAtWork" wrote:
Hi Steven,
The param is of type "string" and the webservice is called via other .net
apps (various methods).

We had this working fine under 1.1 and since the apps are all tightly
controlled, passing in an XML string was acceptable. Is this a
consequence of
moving to 2.0? Do you know if it can be turned off?

Thanks.

"Steven Cheng[MSFT]" wrote:
Hi Bill,

From your description, you have an ASP.NET webservice (asmx endpoint)
which
has a webmethod accepting a XML string parameter, and you'll get
validation
error when you call the webservice, correct?

regarding on the webservice, I'd like to confirm the following things:

** The xml parameter of your webmethod is of "String" type, correct?

** How are you consuming the webservice, through the asmx page(via http
post) or through a generated client proxy class?

Generally, for XML webserivice, since its underlying message is encoded
via
SOAP XML, therefore, we should not directly pass parameter or return
value
of raw XML string content. Here is a former blog article which has
mentioend this:

#Rant: Don't return XML in string variables
http://blogs.msdn.com/mpowell/archiv...12/130637.aspx

Also, if you do need to pass XML string content, you can consider the
following means:

** manually perform htmlencoding on it so that all the xml content are
in
escaped format

** use a CDATA section to wrapper the xmlstring.

Here is a forum thread discussing on this problem too:

#Passing an XML string as part of an XML Web Service
http://forums.asp.net/p/1064300/1631786.aspx#1631786

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.



-------------------
From: =?Utf-8?B?QmlsbEF0V29yaw==?= <Bi********@nospam.nospam>
Subject: XML as a WebService parameter
Date: Thu, 8 Nov 2007 05:43:01 -0800

Hi,
We recently converted a 1.1 project to 2.0 and this included a
webservice
which accepted XML for one of the parameters. Since converting to 2.0 I
am
getting the following message:
---
A potentially dangerous Request.Form value was detected from the client
(myparam="<root><blah....").
---

The fix used for ASPX pages is to include the @Page directive with
validateRequest="false" however this does not work for ASMX pages ("The
directive 'Page' is unknown").

Does anyone know of a way to turn this off for webservices?

Thanks!
Nov 13 '07 #5

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

Similar topics

0
by: cem marifet | last post by:
I am trying to pass in a value of null to a webservice parameter. I 've tried xsi:nil="true" attribute on the parameter tag. But it is not recognizing the value as null. Is there any thing else...
4
by: Razzie | last post by:
Hey all, I have a SOAP envelope with which I try to communicate to a webservice. Everything is fine, but when I try to access a parameter of the webservice method, I get the Object reference not...
5
by: Pete Hearn | last post by:
Hello All, New to the whole C#/Webservice/ADO.NET thing, so apologies in advance if this is a daft question! I have a webservice which returns a dataset - no problem there and all very...
7
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type...
5
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
5
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi, I have a webservice which uses a c# Dll,This Dll is a C# class library which contain few class . I am able to see the class when in the Web service but when i create a stubb class of the...
0
by: TraceyAnnison | last post by:
I wonder if you can help me - I'm new to this, and working in a project that has already been configured to work with Axis. We have a Java project built with the Spring framework, in order to...
1
by: =?Utf-8?B?d2R1ZGVr?= | last post by:
I have a web service hosting a WCF library, which works fine but produced a strange signature when interacting with vs 2005/2.0 clients. My method takes 3 strings and returns a bool as below. ...
4
by: Jonathan | last post by:
I have a SQL stored procedure for adding a new record in a transactions table. It also has two return values: CounterID and IDKey. I want to create a webservice that accepts the 10 input...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.