"Phantom" class misteriously created when adding a web reference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MIGUEL

    #1

    "Phantom" class misteriously created when adding a web reference

    Hi all!

    Be patient because what I'm going to explain all of you it's more than
    very strange.

    I've developed a webservice project that contains two classes. One of
    them is going to act as a SOAP header, and the other class is the main
    class containing all the web methods. Besides, the project contains
    two references pointing at two normal DLLs built also with VS .NET
    2003. This references are needed because the web methods use them in
    several ways.

    The WebService must be accessed from a Winforms appplication over SSL.
    Therefore, I've deployed the webservice on the server, have installed
    server certificate and so on. No problems at all.

    From my Winforms application, I add a Web Reference to the WebService
    writting all the adress like this: https//xxx/WS/Service.asmx. The
    reference (named "localhost" ) is added without any problems.

    When I start programming and write: "localhost. ", intellisense shows
    me three classes instead of the two I've programmed! This third class
    is a class that is assembled in one of the DLL's to which my web
    service points. It's the class webmethods are using. But I've no
    created any class! VS.NET has done it for me? Incredible!

    Then I call a webmethod that must return me an IList (filled with
    objects of the third's class type ) and instead of that, it returns me
    an array of simple objects. The problem grows when I'm going to cast
    this simple objects of the array to the class I use in my Winforms
    application (same type of the third's appeared class). I got an
    execution error telling me "Invalid cast operation".

    The provisional solution is to cast this objects of the array to the
    third class that has been generated when adding the web reference.
    However if I then want to cast this objects (represented by a remote
    reference of the third class) one by one to my local type of objects
    (both of them should be of the same type), application also crashes
    with an "Invalid cast operation". It seems like the objects of the two
    classes (remote and local) are distinct.

    I know my explanation sounds incredible and besides, I found it very
    difficult to explain it with words. If you need more details, please
    let me know.

    Any help would be greatly appreciated. Thanks in advance.

Working...