Hi all,
I create a Web Service project called 'eSelectService' and another Class
Library project called 'MonerisVO', and a Windows Form project called 'maps'
as well.
The reason why I need the Class Library project is because I don't want to
pass more than 30 parameters when I try to invoke the Web Method. I used the
class in Class Library as a value object to contain all the information I
need.
Here is the problem:
When I debug the Web Service project, I add the Class Library project's
output (Trans.dll) as a reference. Everything works fine.
But when I want to invoke the Web Service via my Windows Form project the
compiler says "cannot convert the MonerisVO.ValueObject from
eSelectService.ValueObject." So I remove the Trans.dll from the Windows Form
project's references. But the new problem is I cannot see the methods in
Trans.dll, even the overloaded constructor.
My guess is maybe I get some configuration options wrong.
Here are the codes:
Here is the source code:
//Web Services
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using MonerisVO;
namespace eSelectService
{
public class GateWay : System.Web.Services.WebService
{
public GateWay()
{
InitializeComponent();
}
[WebMethod]
public string test(string host, Trans tr)
{
//Can invoke the method here in the Web Services.
return "host=" + host
+ ", order_id=" + tr.OrderID
+ ", amount=" + tr.TotalAmount;
}
}
}
//Web Forms
using eSelectService;
....
private void btStart_Click(object sender, System.EventArgs e)
{
eSelectService.GateWay gt = new eSelectService.GateWay();
eSelectService.Trans = new eSelectService.Trans();
trans.Init("order_id_test", "4.01");
MessageBox.Show(" result=" + gt.process);
}
//Class Library: Trans.class
....
public class Trans
{
private string order_id;
private string amt;
public TransactionVO(){}
public string OrderID
{
get
{
return order_id;
}
set
{
order_id = OrderID;
}
}
public string TotalAmount
{
get
{
return amt;
}
set
{
amt = OrderID;
}
}
public Init(string id, string amt)
{
this.orderID = id;
this.TotalAmount = amt;
}
}
Is there anybody has the same problem like me? Or is there any good ideas?
Please help me out.
Thanks a lot.
Grace