Reusing Parameters across web methods

Discussion in 'ASP .Net Web Services' started by Brian, Feb 27, 2004.

  1. Brian

    Brian Guest

    I have a WSDL interface written by our customer. I want to create our own web service instance that we can test our software against. So I used wsdl.exe to generate a base WebService class that has the methods described in the WSDL

    I then created the web service and provided an override of each method and copied the WebAttributes from the abstract class to the instance class (Why don't I inherit the attributes???).

    When I try to look at the ASMX page I get an error stating that my element "<SampleElementName>" cannot be resolved because it is both a method message as well as a type.

    What really is happening is that "<SampleElementName>" is the message parameter type in the WSDL and it is used in two web methods. If I make the name unique by changing the 'RequestElementName' attribute of the SoapDocumentMethodAttribute, then it works.

    When I look at the WSDL generated, there are two element definitions that are exactly the same except for the element name (which only differs by the character '1')

    Why can't I use the same element across two methods? Why doesn't wsdl.exe throw an error and complain like aps.net does

    Thank

    Brian
     
    Brian, Feb 27, 2004
    #1
    1. Advertising

  2. Brian

    Dan Rogers Guest

    Hi Brian,

    In general, it is straightforward to do what you want, assuming I
    understand your problem as I read it here.

    Without seeing a reproducible example, however, I'm hard pressed to
    pinpoint the specifics.

    Having a message name and a complex type being the same can be problematic,
    and may be part of the issue. I'd have to see the original WSDL to suggest
    a work around or perhaps a fix. There are several attributes you can use
    to avoid different kinds of problems.

    If you can send me a cut-down example that illustrates the issue, that
    would be helpful.

    Thanks

    Dan Rogers (danro)
    Microsoft Corporation
    --------------------
    >Thread-Topic: Reusing Parameters across web methods
    >thread-index: AcP9e80B6scBIiNeSYe4NXmzIscUIw==
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >From: "=?Utf-8?B?QnJpYW4=?=" <>
    >Subject: Reusing Parameters across web methods
    >Date: Fri, 27 Feb 2004 13:51:05 -0800
    >Lines: 15
    >Message-ID: <>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="Utf-8"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >Content-Class: urn:content-classes:message
    >Importance: normal
    >Priority: normal
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
    >Path: cpmsftngxa06.phx.gbl
    >Xref: cpmsftngxa06.phx.gbl

    microsoft.public.dotnet.framework.aspnet.webservices:22039
    >NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
    >
    >I have a WSDL interface written by our customer. I want to create our own

    web service instance that we can test our software against. So I used
    wsdl.exe to generate a base WebService class that has the methods described
    in the WSDL.

    I then created the web service and provided an override of each method and
    copied the WebAttributes from the abstract class to the instance class (Why
    don't I inherit the attributes???).

    When I try to look at the ASMX page I get an error stating that my element
    "<SampleElementName>" cannot be resolved because it is both a method
    message as well as a type.

    What really is happening is that "<SampleElementName>" is the message
    parameter type in the WSDL and it is used in two web methods. If I make
    the name unique by changing the 'RequestElementName' attribute of the
    SoapDocumentMethodAttribute, then it works.

    When I look at the WSDL generated, there are two element definitions that
    are exactly the same except for the element name (which only differs by the
    character '1').

    Why can't I use the same element across two methods? Why doesn't wsdl.exe
    throw an error and complain like aps.net does?

    Thanks

    Brian
    >
     
    Dan Rogers, Nov 11, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. astrorail
    Replies:
    4
    Views:
    618
    Tony Morris
    Oct 1, 2004
  2. Vince C.
    Replies:
    1
    Views:
    2,334
    Vince C.
    Jul 2, 2003
  3. Ivan Voras

    Reusing object methods?

    Ivan Voras, Apr 29, 2005, in forum: Python
    Replies:
    6
    Views:
    410
    Michele Simionato
    May 1, 2005
  4. Niranjan

    Reusing web user controls across application

    Niranjan, Aug 17, 2003, in forum: ASP .Net Building Controls
    Replies:
    5
    Views:
    164
    Teemu Keiski
    Aug 18, 2003
  5. Kenneth McDonald
    Replies:
    5
    Views:
    375
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page