473,727 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSD is missing an element

Hi,

I am a new to web service world. For the leaning purpose, I have
created a web service in 2005 with one asmx.cs file, in this file, I
have one method called GetUser() which returns a custom user object,
something like

[WebMethod]
public User GetUser()

When I run it from IDE, I noticed after clicking the Service
Description link that the XSD for my custom object user is missing an
element id, which is a read only property of object, and it would
shown if change it to read write.
1. Why this is happening? any way I can manually or explicitly set the
XSD for my class object?
2. It seems that asp.net automatically generate wsdl for me, any way I
can control the content and element of it?

Thanks in advance.
Jul 11 '08 #1
2 1563
<hu********@gma il.comwrote in message
news:92******** *************** ***********@p25 g2000hsf.google groups.com...
Hi,

I am a new to web service world. For the leaning purpose, I have
created a web service in 2005 with one asmx.cs file, in this file, I
have one method called GetUser() which returns a custom user object,
something like

[WebMethod]
public User GetUser()

When I run it from IDE, I noticed after clicking the Service
Description link that the XSD for my custom object user is missing an
element id, which is a read only property of object, and it would
shown if change it to read write.
1. Why this is happening?
The XML Serializer only works with public read/write properties. Since your
property is read-only, it will be ignored.
any way I can manually or explicitly set the
XSD for my class object?
2. It seems that asp.net automatically generate wsdl for me, any way I
can control the content and element of it?
Yes. You don't need to have .NET generate the WSDL and schemas for you. You
can create your own by hand. The only problem is that there is no way that I
know of to "plug in" to what ASP.NET does when it sees "?WSDL". You will
have to turn off the "?WSDL" functionality by removing the <documentatio n>
protocol in web.config.
--
John Saunders | MVP - Connected System Developer

Jul 11 '08 #2
On Jul 11, 11:19*am, "John Saunders" <n...@dont.do.t hat.comwrote:
<huohaod...@gma il.comwrote in message

news:92******** *************** ***********@p25 g2000hsf.google groups.com...
Hi,
I am a new to web service world. For the leaning purpose, I have
created a web service in 2005 with one asmx.cs file, in this file, I
have one method called GetUser() which returns a custom user object,
something like
[WebMethod]
public User GetUser()
When I run it from IDE, I noticed after clicking the Service
Description link that the XSD for my custom object user is missing an
element id, which is a read only property of object, and it would
shown if change it to read write.
1. Why this is happening?

The XML Serializer only works with public read/write properties. Since your
property is read-only, it will be ignored.
any way I can manually or explicitly set the
XSD for my class object?
2. It seems that asp.net automatically generate wsdl for me, any way I
can control the content and element of it?

Yes. You don't need to have .NET generate the WSDL and schemas for you. You
can create your own by hand. The only problem is that there is no way that I
know of to "plug in" to what ASP.NET does when it sees "?WSDL". You will
have to turn off the "?WSDL" functionality by removing the <documentatio n>
protocol in web.config.

--
John Saunders | MVP - Connected System Developer

Thanks a lot for the helps.

For some reasons I couldn't find the <documentationi n the web.cofig
file, and I am not sure how would asp.net handles after removing the ?
wsdl functinality.

Thanks again.

Jul 11 '08 #3

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

Similar topics

6
8346
by: David B. Bitton | last post by:
I am having a problem deserializing XML when the root node is missing a namespace declaration. My Type has an XmlTypeAttribute with a namespace defined. If I attempt to deserialize the XML, I get the dreaded <elementname xmlns=''> was not expected exception. If I comment out the XmlTypeAttribute, it works just fine. Just so you know, when I instantiate an instance of an XmlSerializer, I pass a default namespace to the ctor. ...
5
8066
by: Paul Nations | last post by:
I'm in a real pickle. I've inherited a project with major problems. It receives encrypted XML files from a website not under my control (so I can't modify the web app) for insertion into a database. I'm under intense pressure to get the data into the database NOW. I can decrypt the files alright and they look like xml, they'll import into Access 2K3 with no problem, but VB.Net will not read them. It's complaining about no root...
3
16297
by: Samem N via DotNetMonster.com | last post by:
Does anyone know how to solve this error? I dont know where it went wrong. Any help would be appreciated .Thanks ERROR ______ Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
0
4842
by: Jigar.Patel | last post by:
I have simple remoting server exposing following simple method. When I try to add webreference to this server in another project, it gives me following error: Custom tool error: Unable to import WebService/Schema. Unable to import binding 'MyRemoteObjectBinding' from namespace 'http://schemas.microsoft.com/clr/nsassem/RemoteServer/RemoteServer%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull'. Unable to import...
2
2882
by: Scott Emick | last post by:
I am still having issues with getting Root Element Missing instead of the actual error that the webservice call is supposed to be returning. I'm using VB .Net 2003. Has anyone else been able to get around what seems like a bug in the dotnet framework? Scott Emick
0
8891
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
9406
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9185
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
9120
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...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4786
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2158
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.