【发布时间】:2010-05-20 00:10:16
【问题描述】:
我正在尝试从我的 C# 应用程序调用 Web 服务(用 PHP 创建)。我已经在 Visual Studios 中成功添加了 Web 引用,但是我无法确切知道如何调用对 Web 服务的调用。我一直在关注本教程:http://sanity-free.org/article25.html 但是,当我尝试编译时,我得到一个“找不到类型或命名空间名称‘SimpleService’”。我的 C# 代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace inVision_OCR
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void translateButton_Click(object sender, EventArgs e)
{
// We need to snap the image here somehow . . .
// Open up the image and read its contents into a string
FileStream file = new FileStream("\\Hard Disk\\ocr_images\\test.jpg", FileMode.Open);
StreamReader sr = new StreamReader(file);
string s = sr.ReadToEnd();
sr.Close();
// Using SOAP, pass this message to our development server
SimpleService svc = new SimpleService();
string s1 = svc.getOCR("test");
MessageBox.Show(s);
}
}
}
【问题讨论】:
标签: c# .net visual-studio web-services