【发布时间】:2014-02-27 00:30:31
【问题描述】:
我正在构建一个调用第三方 Web 服务的表单应用程序,但不断收到 "namespace name soapcontext could not be found" 错误。
我已经添加了一个指向 Web 服务的 wsdl 的 Web 引用。这是我所拥有的:
private void btnGetInfo_Click(object sender, EventArgs e)
{
QTWebSvcsService svc = new qtref.QTWebSvcsService();
// The getVehicleInformation method accepts an AssetIdentifier and returns a
// VehicleInfo object. Instantiate them both.
qtref.AssetIdentifier ai = new qtref.AssetIdentifier();
qtref.VehicleInfo vi = new qtref.VehicleInfo();
// Replace these strings with valid company name, user name and password
string sUsername = "[usernasme]";
string sCompanyname = "[company]";
string sIdentity = sUsername + "@" + sCompanyname;
string sPassword = "[password]";
//This is where it fails
SoapContext requestContext = RequestSoapContext.Current;
}
这是确切的错误:
Error 1 The type or namespace name 'SoapContext' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Sophia Carter\Documents\Visual Studio 2010\Projects\DemoGetVehInf\DemoGetVehInf\Form1.cs 45 13 DemoGetVehInf
【问题讨论】:
标签: c# web-services soap visual-c#-express-2010