I have generated a proxy class but I don't know how to consume it.
I also instantiated the class and accessed the class but I don't know how to get the response My Access code Controller class to access the proxy :
ProjectByElementsQuerySelectionByElements query = new
ProjectByElementsQuerySelectionByElements();
ProjectByElementsQueryMessage_sync sync = new ProjectByElementsQueryMessage_sync{
ProjectSelectionByElements = query
};
Proxy Soap class : This is the automatically generated from wsdl file and is a proxy class that I want to consume. public partial class ProjectStatusByQueryResponse {
private ProjectLifeCycleStatusCode projectLifeCycleStatusCodeField;
private UPTODATEOUTOFDATE_UpToDatenessStatusCode schedulingUpToDatenessStatusCodeField;
private StartingStatusCode startingStatusCodeField;
private ProjectTaskLifeCycleStatusCode taskLifeCycleStatusCodeField;
private BlockingStatusCode taskBlockingStatusCodeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectLifeCycleStatusCode ProjectLifeCycleStatusCode {
get {
return this.projectLifeCycleStatusCodeField;
}
set {
this.projectLifeCycleStatusCodeField = value;
}
}
public partial class ProjectByElementsQuerySelectionByElements {
private ProjectSelectionByResponsibleUnitID[] selectionByResponsibleUnitIDField;
private ProjectSelectionByProjectId[] selectionByProjectIDField;
private ProjectSelectionByProjectName[] selectionByProjectNameField;
private ProjectSelectionByProjectType[] selectionByProjectTypeField;
private ProjectSelectionByCustomerID[] selectionByCustomerIDField;
private ProjectSelectionByRequestingUnitID[] selectionByRequestingUnitIDField;
private bool selectionByBillableIndicatorField;
private bool selectionByBillableIndicatorFieldSpecified;
private ProjectSelectionByInterCompanyIndicator[] selectionByIntercompanyIndicatorField;
private ProjectSelectionByResponsibleEmployeeID[] selectionByResponsibleEmployeeIDField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByResponsibleUnitID", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByResponsibleUnitID[] SelectionByResponsibleUnitID {
get {
return this.selectionByResponsibleUnitIDField;
}
set {
this.selectionByResponsibleUnitIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByProjectID", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByProjectId[] SelectionByProjectID {
get {
return this.selectionByProjectIDField;
}
set {
this.selectionByProjectIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByProjectName", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByProjectName[] SelectionByProjectName {
get {
return this.selectionByProjectNameField;
}
set {
this.selectionByProjectNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByProjectType", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByProjectType[] SelectionByProjectType {
get {
return this.selectionByProjectTypeField;
}
set {
this.selectionByProjectTypeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByCustomerID", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByCustomerID[] SelectionByCustomerID {
get {
return this.selectionByCustomerIDField;
}
set {
this.selectionByCustomerIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByRequestingUnitID", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByRequestingUnitID[] SelectionByRequestingUnitID {
get {
return this.selectionByRequestingUnitIDField;
}
set {
this.selectionByRequestingUnitIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public bool SelectionByBillableIndicator {
get {
return this.selectionByBillableIndicatorField;
}
set {
this.selectionByBillableIndicatorField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool SelectionByBillableIndicatorSpecified {
get {
return this.selectionByBillableIndicatorFieldSpecified;
}
set {
this.selectionByBillableIndicatorFieldSpecified = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByIntercompanyIndicator", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByInterCompanyIndicator[] SelectionByIntercompanyIndicator {
get {
return this.selectionByIntercompanyIndicatorField;
}
set {
this.selectionByIntercompanyIndicatorField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("SelectionByResponsibleEmployeeID", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ProjectSelectionByResponsibleEmployeeID[] SelectionByResponsibleEmployeeID {
get {
return this.selectionByResponsibleEmployeeIDField;
}
set {
this.selectionByResponsibleEmployeeIDField = value;
}
}
}
The proxy class file is added to the project to instantiate the proxy class to call the wcf service. If you don’t understand how to call the wcf service in this way, you can refer to ServiceModel Metadata Utility Tool.
In addition, you can also call the wcf service by adding a service reference. This is the simplest way. Right-click the project and select addservicereference in add, and then add the service reference.