Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 9th, 2003, 05:00 AM
Authorized User
 
Join Date: Nov 2003
Location: Ha Noi, , Vietnam.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default About method of class in Web Service

Hi all

My web service has class clsDemo. The class has method methodTry (public string methodTry).
Create class proxy for this web service. Receive class has not methodTry() method, only has properties public and variables public
WHY???
Help me! Thanks for your help!

Reply With Quote
  #2 (permalink)  
Old December 9th, 2003, 10:20 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Have you defined this method as a "WebMethod"? I believe in C# the syntax is...

[WebMethod]
public string methodTry()...

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old December 10th, 2003, 04:23 AM
Authorized User
 
Join Date: Nov 2003
Location: Ha Noi, , Vietnam.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much
    The method mentioned aboved does not belong to the ws but to a class in that ws. It is here

    File DataType.asmx.cs
    //...
    public class DataType : System.Web.Services.WebService
    {
        //
        public class clsName
        {
            public string m_ID = "";
            public string m_Comment = "";
            private string m_Hide = "";

            public string methodTry() // It has not in proxy class
            {
                return (m_Hide);
            }
        }

        //...
        public clsName GetClass(string strId, strComment)
        {
            clsName cl = new clsName();
            cl.m_ID = strId;
            cl.m_Comment = strComment;
            cl.m_Hide = "hide";
            return (cl);
        }
        //...
    }
    //...

    File proxy class DataType.cs
    //...
        public class DataType : System.Web.Services.Protocols.SoapHttpClientProtoc ol
    {
                /// <remarks/>
                public DataType()
        {
                        this.Url = "http://localhost/Ws/DataType.asmx";
                }
        //...
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://tempuri.org/")]
    public class clsName
    {
                /// <remarks/>
                public string m_ID;

                /// <remarks/>
                public string m_Comment;

        //??? Hope something at here
    }

Reply With Quote
  #4 (permalink)  
Old December 10th, 2003, 04:26 AM
Authorized User
 
Join Date: Nov 2003
Location: Ha Noi, , Vietnam.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ah, as far as i still don't solve problem Execute method of web service, about database
( http://p2p.wrox.com/topic.asp?TOPIC_ID=6909 )

Reply With Quote
  #5 (permalink)  
Old December 10th, 2003, 12:03 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The WSDL for a web service is only going to define the data structures and web methods available. The idea of a web service is to have the web service do the work and just return data. It makes little sense to have a web service return you code. That kind of defeats the purpose of the service.

Perhaps what you are intending here is to create a property accessor. Public properties of classes will show up in the web service data structures. Set up your class like this:

public class clsName
{
    public string m_ID = "";
    public string m_Comment = "";
    private string m_Hide = "";

    public string methodTry() // It has not in proxy class
    {
        get
        {
            return (m_Hide);
        }
    }
}

And you should end up with something like this in your proxy class:

public class clsName
{
    /// <remarks/>
    public string m_ID;

    /// <remarks/>
    public string m_Comment;

    /// <remarks/>
    public string methodTry;
}

I'm not sure what will actually happen with a readonly property in the proxy class so I might be wrong on this.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote
  #6 (permalink)  
Old December 11th, 2003, 09:09 PM
Authorized User
 
Join Date: Nov 2003
Location: Ha Noi, , Vietnam.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, Peter!
Because, I read documment to see WS supports a significant number of data types and there is class type. I think it also supports for methods of class. Then it limit, class only use to contain data.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
servlet service() method Nicholsen Servlets 0 January 28th, 2007 09:17 PM
Method calls within same class w/Interface gmontanaro C# 0 April 6th, 2006 05:44 PM
Execute method of web service, about database? hueduongit .NET Web Services 3 December 3rd, 2003 03:18 AM
Object as parameter in a web service method evandro.paula .NET Web Services 3 October 14th, 2003 02:20 PM



All times are GMT -4. The time now is 09:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.