如何在Web应用程序中使用Web服务的类? [英] how to use webservice's class in web application?
问题描述
hi ..
我已经在3.5版中创建了Web服务,而我的应用程序在1.1版中.
并且我已经在网络服务中创建了一个类,因为该类不支持旧版本.
并且我想在我的应用程序中使用该类.但是当我创建webservice对象时,它仅显示webmethod..not不能调用的类.
那么,我该如何解决这个问题呢?
帮助将是有意义的..
hi..
I have created webservice in version 3.5 and my application is in version 1.1.
and i have created class in webservice because that class doesn''t support old version.
and i want to use that class in my application.. but when i create object of webservice it only shows the webmethod..not class to call.
So ,how can i solve this problem??
Help would be appreciable..
推荐答案
是否正在使用.Net WebServive?如果是这样,在解决方案资源管理器上右键单击您的客户端应用程序,然后选择添加服务引用.
Are using a .Net WebServive? If so the on solution explorer right click on your client app and choose add service reference.
假设下面的代码是您的Web服务
Assume the code below is your webservice
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
namespace WebServiceExample
{
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
InitializeComponent();
}
// Add the Description Attribute so you
// will know the purpose of your WebService
[WebMethod(Description="This Method prints HelloWorld")]
public string HelloWorld()
{
return "Hello World";
}
}
}
您是说要使用"Service1"类吗?还是在Service1中有一个内部类?
Are you saying that you want to use the class "Service1"? or you have an inner class within Service1?
这篇关于如何在Web应用程序中使用Web服务的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!