473,654 Members | 3,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Library differences when adding Web Reference

Here's what happens: I got a Web Service installed locally on my IIS. Then I got a client project, which will call this service. But when I add the Web Reference to the Web Service, and look at the imported classes with Object Browser, there are classes missing. How can that be?

The classes in question are of course public, and I see them in Object Browser in the Web Service project. The classes are auto-generated from an XSD file, using the xsd.exe tool (but that shouldn't matter).

Gustaf
Jun 29 '07 #1
5 1969
"Gustaf" <gu*****@algone t.sewrote in message
news:e7******** ******@TK2MSFTN GP04.phx.gbl...
Here's what happens: I got a Web Service installed locally on my IIS. Then
I got a client project, which will call this service. But when I add the
Web Reference to the Web Service, and look at the imported classes with
Object Browser, there are classes missing. How can that be?

The classes in question are of course public, and I see them in Object
Browser in the Web Service project. The classes are auto-generated from an
XSD file, using the xsd.exe tool (but that shouldn't matter).
What kind of classes are missing? For instance, are SOAP Fault classes
missing? If so, that's because .NET ignores SOAP Faults as far as processing
a WSDL is concerned.
--
John Saunders [MVP]

Jun 29 '07 #2
John Saunders [MVP] wrote:
What kind of classes are missing? For instance, are SOAP Fault classes
missing? If so, that's because .NET ignores SOAP Faults as far as
processing a WSDL is concerned.
Thanks for helping. The one class I see is missing, is the class that corresponds to the root element type in the schema. I noticed that only complex types get their class representations when generating code with xsd.exe, not element declarations. So, in this case

<xs:element name="MyRoot" type="MyRootTyp e"/>

<xs:complexTy pe name="MyRootTyp e">
<xs:sequence>
<xs:element name="MyItem" type="MyItemTyp e"
minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>

there is no MyRoot class generated, but a MyRootType class. In my case, it's the MyRootType class that's missing when I import the classes using a Web Reference.

Gustaf
Jul 2 '07 #3
"Gustaf" <gu*****@algone t.sewrote in message
news:uM******** ******@TK2MSFTN GP05.phx.gbl...
John Saunders [MVP] wrote:
>What kind of classes are missing? For instance, are SOAP Fault classes
missing? If so, that's because .NET ignores SOAP Faults as far as
processing a WSDL is concerned.

Thanks for helping. The one class I see is missing, is the class that
corresponds to the root element type in the schema. I noticed that only
complex types get their class representations when generating code with
xsd.exe, not element declarations. So, in this case

<xs:element name="MyRoot" type="MyRootTyp e"/>

<xs:complexTy pe name="MyRootTyp e">
<xs:sequence>
<xs:element name="MyItem" type="MyItemTyp e"
minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>

there is no MyRoot class generated, but a MyRootType class. In my case,
it's the MyRootType class that's missing when I import the classes using a
Web Reference.
Do you use the MyRootType directly? Does your Web Reference code compile?

I've noticed that XSD.EXE will only include types it thinks are being used,
and this isn't always the same set of types you think are being used. In one
case, I had to play around for days to get it to include the types I wanted.

As an experiment, could you add a web method that returns a MyRoot and then
see what that generates in the Web Reference?
--
John Saunders [MVP]

Jul 2 '07 #4
John Saunders [MVP] wrote:
Do you use the MyRootType directly? Does your Web Reference code compile?
I can set up the Web Reference without complaints, so I suppose that part is okay as far as Visual Studio is concerned. The Web Service project compiles, and if I check Object Browser from that project, I see all the classes I want. Then when I include the Web Reference to this Web Service from another project, one class disappears.
I've noticed that XSD.EXE will only include types it thinks are being
used, and this isn't always the same set of types you think are being
used. In one case, I had to play around for days to get it to include
the types I wanted.
I noticed that too. If you include an element with no parent in the schema, it's not represented in the generated code. Naturally, the root element has no parent, but the class for the root element type is indeed generated (with the XmlRootAttribut e attribute), and is recognized in the Web Service project.

So it appears to me that whatever happens, happens when setting up the Web Reference.
As an experiment, could you add a web method that returns a MyRoot and
then see what that generates in the Web Reference?
It generates a method with a return value of the class one level below the root element. But nevemind that now. After so much time spent on this, I had to stop working on it. Thanks anyway.

Gustaf
Jul 4 '07 #5
John Saunders [MVP] wrote:
I'd like to create a reproducer for this, because I can see it as an
issue that will come up for many developers. Unfortunately, I'm tied up
at the moment and may not get to it in the next couple of days.
I have now simplified the schema and stripped it from all sensitive information, so I can make it public here, for you and others to test. I have also tested that the schema produces the result described. Here's the schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns="http://example.org/Response"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace ="http://example.org/Response"
elementFormDefa ult="qualified" >

<xs:complexTy pe name="ResponseT ype">
<xs:sequence>
<xs:element name="ErrorCode " type="xs:string "/>
<xs:element name="ErrorMess age" type="xs:string "/>
</xs:sequence>
</xs:complexType>

<xs:complexTy pe name="ResponseL istType">
<xs:sequence>
<xs:element name="Response" type="ResponseT ype" minOccurs="0" maxOccurs="unbo unded"/>
</xs:sequence>
</xs:complexType>

<xs:element name="ResponseL ist" type="ResponseL istType"/>

</xs:schema>

And here's step-by-step instruction on how you produce the same error:

1. Generate a file with classes from the schema with the xsd.exe tool.
2. Create a new Web Service project, and import the generated file.
3. Add a WebMethod that returns a ResponseListTyp e object:

[WebMethod]
public ResponseListTyp e GetResponseList () {
return null;
}

4. Using Object Browser, confirm that the ResponseListTyp e class is included. It is.
5. Create a Console Application project and add a web reference to the web service.
6. Using Object Browser, look for the ResponseListTyp e class among the classes imported by the web reference. It won't be there.

Gustaf


Jul 6 '07 #6

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

Similar topics

43
4965
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own libraries. I'm not sure if that's a good thing or not. AFAIK, most of Qt is compatable with the Standard Library. That is, QLT can interoperate with STL, and you can convert back and forth between std::string and Qt::QString, etc. Are there any...
2
2192
by: Lady_A | last post by:
Hi, I need to add a reference to a static library (*.lib) to a COM/ATL project in VS.NET. Apparently if this library is not in my solution that is not possible using the ordinary way : Add Reference. The Add Reference Dialog only allows me to browse and add a *.dll,*.ocx,*.tlb, *.olb and *.exe. No *.lib! While if it is in the same solution I automatically see the library
2
4119
by: Zippy | last post by:
Some months ago, we requested help from this newsgroup on how to replace the library reference of a database with another library reference, prior to creating an MDE. I got the following answer from Stephen K. Young, which does the job: >In message <ahjurk$t18vo$1@ID-65843.news.dfncis.de>, Stephen K. Young ><s@k.y.invalid> writes >Using automation you can temporarily replace a developer library reference >with a compiled library...
16
2447
by: Randy Yates | last post by:
I have an Access database that has been running fine on multiple platforms (Windows 2000, Windows XP, etc.) for several years. Recently, the database has begun to issue "Run-Time Error 2467" on one XP platform when certain forms are opened. Other forms result in a total application crash with the resulting "Bug Report" dialog sequence. The same forms within the same application run fine under Win2000. I'm wondering if this is due to...
10
2679
by: Julian | last post by:
I get the following error when i try to link a fortran library to a c++ code in .NET 2005. LINK : fatal error LNK1104: cannot open file 'libc.lib' the code was working fine when built using .NET2003. also, when I do not try to link the fortran library (just to see if that was the cause), it builds the exe without any problems. i don't even know how to begin addressing this problem...any help would be
0
1749
by: tony | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. In this user control we have a class called B One project that build a class library dll. In this class library we have a class called C In the user control project I have a project reference to the class library.
4
2119
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r) and the Language Objects Library) that I have converted over to C#. It works okay. However, in the C# version, one has to build the class library into the generated application, because I haven't structured this one thing right. I would like to...
20
5217
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've used various techniques ( loop unrolling, loop jamming...) and tried some matrix libraries : newmat (slow for large matrix) , STL (fast but ..not usefull) , hand coding (brain consuming...), and recently Meschach...
3
3218
by: S S | last post by:
Hi Are there some known issues using STL with shared library. Recently I got some crash for which the reason I dont see any, and searching on goolge shown some such issues with shared library. If somebody can help ? Thanks in advance. S
0
8380
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
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1598
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.