473,385 Members | 2,005 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.

webservices, return xml without .net injecting xml schema

Hey all,

I want to return an xml structure without .net trying to inject any of
its xml schema? Can this be done?

Here is the scenario:
I'm running into an issue with the return string of my .NET
webservice. I am attempting to return an xml string similar to this:

<?xml version="1.0" encoding="utf-8" ?>
<sInfo>
<name>tom</name>
<title>boss</title>
<stuff>
<anyType>wow</anyType>
<anyType>wow2</anyType>
</stuff>
</sInfo>

But instead I receive this:
<?xml version="1.0" encoding="utf-8" ?>
<sInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://tempuri.org/">
<name>tom</name>
<title>boss</title>
<stuff>
<anyType xsi:type="xsd:string">wow</anyType>
<anyType xsi:type="xsd:string">wow2</anyType>
</stuff>
</sInfo>

Note, for my webservice I am returning a struct. The definition of that
struct is:
public class sInfo{
public string name;
public string title;
public ArrayList stuff;
//public Array smArray;
public sInfo()
{
stuff = new ArrayList();
}
}

Most importantly I do not want any of the 'xsi:type=' attributes to
be present in the return structure. Is there any way to override the
return so that I can return self defined xml. I am even willing on
returning hand built xml, but .NET encapsulates the structure within a
<string> tag?

So to summarize, I want to return an xml structure without .net trying
to inject any of its xml schema? Can this be done?

Nov 17 '05 #1
3 2305
AtariPete,

There is no schema that is being passed back. What you are seeing is
attributes that conform to a schema agreed upon for web services being
returned.

Why do you want to remove this? Why not expose your web service, create
your proxy (which will create the structure exposed by your web service),
and then use that? Why the concern over what is sent on the line?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"AtariPete" <pc******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hey all,

I want to return an xml structure without .net trying to inject any of
its xml schema? Can this be done?

Here is the scenario:
I'm running into an issue with the return string of my .NET
webservice. I am attempting to return an xml string similar to this:

<?xml version="1.0" encoding="utf-8" ?>
<sInfo>
<name>tom</name>
<title>boss</title>
<stuff>
<anyType>wow</anyType>
<anyType>wow2</anyType>
</stuff>
</sInfo>

But instead I receive this:
<?xml version="1.0" encoding="utf-8" ?>
<sInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://tempuri.org/">
<name>tom</name>
<title>boss</title>
<stuff>
<anyType xsi:type="xsd:string">wow</anyType>
<anyType xsi:type="xsd:string">wow2</anyType>
</stuff>
</sInfo>

Note, for my webservice I am returning a struct. The definition of that
struct is:
public class sInfo{
public string name;
public string title;
public ArrayList stuff;
//public Array smArray;
public sInfo()
{
stuff = new ArrayList();
}
}

Most importantly I do not want any of the 'xsi:type=' attributes to
be present in the return structure. Is there any way to override the
return so that I can return self defined xml. I am even willing on
returning hand built xml, but .NET encapsulates the structure within a
<string> tag?

So to summarize, I want to return an xml structure without .net trying
to inject any of its xml schema? Can this be done?

Nov 17 '05 #2
Its a matter of not needing the schema. The return xml is predefined
(except for the total # of <anytype>'s returned). Thus it is of no need
to the clients.

Nicholas, Is there no way to prevent these attributes from being
injected into the xml? Let me know, your feedback is much appreciated.

Nov 17 '05 #3
If this is the case, you really don't want to use a web service, since
they conform to pre-defined schemas which you need to abide by.

There isn't way to strip the attribute and namespace information
(technically, the schema is not in the XML that is being returned, it
conforms to a schema though) when using a web service.

What you really want is a http response that returns XML, not a web
service. I would just create an ASPX page that returns a content type of
"text/xml" and manually write the XML through the Response object exposed by
the page.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"AtariPete" <pc******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Its a matter of not needing the schema. The return xml is predefined
(except for the total # of <anytype>'s returned). Thus it is of no need
to the clients.

Nicholas, Is there no way to prevent these attributes from being
injected into the xml? Let me know, your feedback is much appreciated.

Nov 17 '05 #4

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

Similar topics

1
by: James | last post by:
Here's what I'm kicking around... Really here's what's kicking me around... Trying to design a webservices system that will allow a client to submit forms in background threads when client connects...
1
by: Patrik | last post by:
Hi I want to return a dataset from a webservice and exclude the schema. How can I do this? /Patrik
1
by: Peter Nofelt | last post by:
Hey all, I want to return an xml structure without .net trying to inject any of its xml schema? Can this be done? Here is the scenario: I'm running into an issue with the return string of my...
9
by: Bruce Hodge | last post by:
Hi, We have a couple of clients who are having trouble connecting to .Net webservices, (they're coming from PHP and VFP). We were looking to provide a diagonostic tool that displayed the soap...
5
by: cyberstrike | last post by:
Hi guys, my company was wondering if it's possible to develop ASP.NET/Webservices easily using a IIS installed on a server instead of installing IIS locally on the development boxes. Can you...
3
by: androoo | last post by:
Hi all I have read both scott mitchells (4 guys) articles on why he doesnt like to use datasets from webservices and I have some questions if anyone has some experience in this. How secure is...
0
by: Pasho | last post by:
hi I have been facing problem using C# webservices (secured using SSL). In my webservice(secured with SSL) It works fine if I try to access data from database through dataset. If I try to...
4
by: Benny Dein | last post by:
Hi I want to create a servlet or something similar by which im able to create virtual webservices. Lets say i would like to create a webservice with a method called 'getDate' which returnes...
0
by: failfaizan | last post by:
I made a webservice but i got the following error: Custom tool error:Unable to import WebService/Schema.Unable to import binding. Is there any problem in my WSDL.Here is my WSDL file.Plz help me...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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...
0
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,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.