webservice问题
调用别人写好的webservice方法这个方法 其中一个参数是一个类
我在客户端怎么传递这个类咧 一直报错
public String createOrUpdatePerson(String requestApp, String requestOperator, String requestID, SynPersonInfo sysPersonInfo)
public class SynPersonInfo
{
private String name;
public String getName()
{
return this.name;
}
public void setName(String name) {
this.name = name;
}
} --------------------编程问答-------------------- 没有人知道怎么做么 --------------------编程问答-------------------- 提供具体的报错信息吧,还有把相关的Code贴上来 --------------------编程问答-------------------- public class WebServiceAgent
{
private object agent;
private Type agentType;
private const string CODE_NAMESPACE = "Beyondbit.WebServiceAgent.Dynamic";
/// <summary<
/// 构造函数
/// </summary<
/// <param name="url"<</param<
public WebServiceAgent(string url)
{
XmlTextReader reader = new XmlTextReader(url + "?wsdl");
//创建和格式化 WSDL 文档
ServiceDescription sd = ServiceDescription.Read(reader);
//创建客户端代理代理类
ServiceDescriptionImporter sdi = new ServiceDescriptionImporter();
sdi.AddServiceDescription(sd, null, null);
//使用 CodeDom 编译客户端代理类
CodeNamespace cn = new CodeNamespace(CODE_NAMESPACE);
CodeCompileUnit ccu = new CodeCompileUnit();
ccu.Namespaces.Add(cn);
sdi.Import(cn, ccu);
Microsoft.CSharp.CSharpCodeProvider icc = new Microsoft.CSharp.CSharpCodeProvider();
CompilerParameters cp = new CompilerParameters();
CompilerResults cr = icc.CompileAssemblyFromDom(cp, ccu);
agentType = cr.CompiledAssembly.GetTypes()[0];
agent = Activator.CreateInstance(agentType);
}
///<summary<
///调用指定的方法
///</summary<
///<param name="methodName"<方法名,大小写敏感</param<
///<param name="args"<参数,按照参数顺序赋值</param<
///<returns<Web服务的返回值</returns<
public object Invoke(string methodName, params object[] args)
{
MethodInfo mi = agentType.GetMethod(methodName);
return this.Invoke(mi, args);
}
///<summary<
///调用指定方法
///</summary<
///<param name="method"<方法信息</param<
///<param name="args"<参数,按照参数顺序赋值</param<
///<returns<Web服务的返回值</returns<
public object Invoke(MethodInfo method, params object[] args)
{
return method.Invoke(agent, args);
}
public MethodInfo[] Methods
{
get
{
return agentType.GetMethods();
}
}
}
public class BaseClass
{
private String name;
public String Name
{
get{return name;}
set{name=value;}
}
private String gender;
public String Gender
{
get{return gender;}
set{gender=value;}
}
private String idCard;
public String IdCard
{
get{return idCard;}
set{idCard=value;}
}
private String contStage;
public String ContStage
{
get{return contStage;}
set{contStage=value;}
}
private String workTime;
public String WorkTime
{
get{return workTime;}
set{workTime=value;}
}
private String unitTime;
public String UnitTime
{
get{return unitTime;}
set{unitTime=value;}
}
private String personType;
public String PersonType
{
get{return personType;}
set{personType=value;}
}
private String deptId;
public String DeptId
{
get{return deptId;}
set{deptId=value;}
}
private String postId;
public String PostId
{
get{return postId;}
set{postId=value;}
}
private String personCode;
public String PersonCode
{
get{return personCode;}
set{personCode=value;}
}
private String managerFlag;
public String ManagerFlag
{
get{return managerFlag;}
set{managerFlag=value;}
}
}
public class SynPersonInfo:BaseClass
{
private String name;
public new String Name
{
get{return name;}
set{name=value;}
}
private String gender;
public new String Gender
{
get{return gender;}
set{gender=value;}
}
private String idCard;
public new String IdCard
{
get{return idCard;}
set{idCard=value;}
}
private String contStage;
public new String ContStage
{
get{return contStage;}
set{contStage=value;}
}
private String workTime;
public new String WorkTime
{
get{return workTime;}
set{workTime=value;}
}
private String unitTime;
public new String UnitTime
{
get{return unitTime;}
set{unitTime=value;}
}
private String personType;
public new String PersonType
{
get{return personType;}
set{personType=value;}
}
private String deptId;
public new String DeptId
{
get{return deptId;}
set{deptId=value;}
}
private String postId;
public new String PostId
{
get{return postId;}
set{postId=value;}
}
private String personCode;
public new String PersonCode
{
get{return personCode;}
set{personCode=value;}
}
private String managerFlag;
public new String ManagerFlag
{
get{return managerFlag;}
set{managerFlag=value;}
}
}
SynPersonInfo u=new SynPersonInfo();
u.Name="xxx";
.
.
.
调用这个就报错agent.Invoke("createOrUpdatePerson", args)
补充:.NET技术 , C#