Web服务和客户端位于不同的计算机上。Net与JAVA
我使用C和Java创建了web服务及其消费web客户端,它们在同一台机器上工作,但我不知道如何从不同的机器上消费这些服务。有人知道我需要采取什么步骤,或者至少为我指明了正确的方向吗 这是我的web服务的摘录。网Web服务和客户端位于不同的计算机上。Net与JAVA,java,.net,web-services,webclient,Java,.net,Web Services,Webclient,我使用C和Java创建了web服务及其消费web客户端,它们在同一台机器上工作,但我不知道如何从不同的机器上消费这些服务。有人知道我需要采取什么步骤,或者至少为我指明了正确的方向吗 这是我的web服务的摘录。网 using System; using System.Configuration; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web; using
using System;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://deitel.com/", Description = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
SqlConnection conn;
SqlDataReader dr;
public WebService()
{
conn = new SqlConnection("Data Source=Owner-PC\\SQLEXPRESS;Initial Catalog=myDatabase;Integrated Security=True");
}
[WebMethod(Description = "Insert Person into People table.")]
public void insertPerson(long id, string name, string surname, int age, long contact, string location)
{
SqlCommand command = new SqlCommand("INSERT INTO People(ID, Name, Surname, Age, Contact, Location) VALUES ('" + id
+ "','" + name + "','" + surname + "','" + age + "','"+ contact + "','" + location + "')", conn);
conn.Open();
command.ExecuteNonQuery();
conn.Close();
}
}
您如何使用客户端的web服务?按机器名或ip地址?你能解释或展示一些代码吗?如果你做的每件事都是正确的,并且使用web作为通道,那么在客户端的配置中更改ip地址或机器名就很容易了……我想它符合机器名的条件。如果我尝试一下,它会起作用,但我不知道在另一台机器上为客户机提供它的过程是什么。知道吗?使用它的客户端应该用JAVA实现。我认为这可以归结为如何配置客户端。您需要发布您的客户端代码