我有一个WSDL文件。
我需要使用2个Custom类型的参数执行请求,并获得响应。
我在客户端应用程序中添加了一个服务引用,如下所示:
using WSDLCall.wsdlReference;
生成代理后。
getCustomerData custInfo = new getCustomerData();
这里,getCustomerData
是一个类,它有2个自定义类型参数。
我需要为这些参数指定值并获得响应。
我的wsdl架构:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.9.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://someurl" +
"gement/v1")]
public partial class GetCustomerData : object, System.ComponentModel.INotifyPropertyChanged {
private CustID custAccIDField;
private OtherOrgId1 idField;
///
[System.Xml.Serialization.XmlElementAttribute(Order=0)]
public CustID custAccID {
get {
return this.custAccIDField;
}
set {
this.custAccIDField = value;
this.PropertyChanged("custAccID");
}
}
///
[System.Xml.Serialization.XmlElementAttribute(Order=1)]
public OtherOrgId1 id {
get {
return this.idField;
}
set {
this.idField = value;
this.PropertyChanged("id");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void PropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
答案 0 :(得分:0)
您没有发布您的wsdl架构,因此您必须替换您的方法和类名。
要拨打电话:
var client = new WSDLCall.wsdlClient();
var param1 = new WSDLCall. ??? ();
var param2 = new WSDLCall. ??? ();
var result = client.getCustomerData(param1, param2);
答案 1 :(得分:0)
首先,您的定义结构中是否有端点?
如果没有,请在using WSDLCall.wsdlReference = new WSDLCall.wsdlReference(name, url)
接下来,请确保在wsdl中声明了自定义类型。
然后,您可以在参数中指定值
getCustomerData custInfo = new getCustomerData(); custInfo.Foo = new Foo {Id = 1,Text =“Foo”}; ...
但是如果你没有任何方法来检索数据,你就无法“得到回应”
状况良好,您将拥有一个用于构建数据的类(具有自定义类型参数的CustomerData)和方法,如getCustomer(int id),getAllCustomer(),setCustomer(Customer cust),...
正如我所看到的,构造函数返回不是void,并在构造函数中发送带有2个参数的数据。因此,您也可以使用自定义对类进行实例化,但与上面相同的自定义类型也应该在wsdl中声明。
编辑:正如所宣布的那样,您的WSDL中没有CustID和OtherOrgId1的定义。检查中的网址[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://someurl" +
"gement/v1")]
如果在这个地方有params的定义。 没有这个定义,你不能要求任何东西。