Saturday, August 31, 2013

Consuming webservice in C#

Hi all, Thank you all for the replies.


I ran svcutil. I got a proxy file generated, which i have attached here. Attached the WSDL file also. The webservice method name is wsadd. It takes 2 intergers and returns their Sum. In the attached Proxy file which class should i instantiate and which method should i invoke to invoke the webservice. Pls advice.


Thanks,


Sai



//------------------------------------------------------------------------------

// <auto-generated>

// This code was generated by a tool.

// Runtime Version:2.0.50727.5472

//

// Changes to this file may cause incorrect behavior and will be lost if

// the code is regenerated.

// </auto-generated>

//------------------------------------------------------------------------------







[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]

[System.ServiceModel.ServiceContractAttribute(Namespace="urn:hpccsystems:ecl:wsadd", ConfigurationName="roxieServiceSoap")]

public interface roxieServiceSoap

{



// CODEGEN: Generating message contract since the wrapper name (wsaddRequest) of message wsaddRequest does not match the default value (wsadd)

[System.ServiceModel.OperationContractAttribute(Action="/roxie/wsadd?ver_=1.0", ReplyAction="*")]

[System.ServiceModel.XmlSerializerFormatAttribute()]

wsaddResponse wsadd(wsaddRequest request);

}



/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:hpccsystems:ecl:wsadd")]

public partial class ArrayOfEspException

{



private string sourceField;



private EspException[] exceptionField;



/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Order=0)]

public string Source

{

get

{

return this.sourceField;

}

set

{

this.sourceField = value;

}

}



/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute("Exception", Order=1)]

public EspException[] Exception

{

get

{

return this.exceptionField;

}

set

{

this.exceptionField = value;

}

}

}



/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:hpccsystems:ecl:wsadd")]

public partial class EspException

{



private string codeField;



private string audienceField;



private string sourceField;



private string messageField;



/// <remarks/>

public string Code

{

get

{

return this.codeField;

}

set

{

this.codeField = value;

}

}



/// <remarks/>

public string Audience

{

get

{

return this.audienceField;

}

set

{

this.audienceField = value;

}

}



/// <remarks/>

public string Source

{

get

{

return this.sourceField;

}

set

{

this.sourceField = value;

}

}



/// <remarks/>

public string Message

{

get

{

return this.messageField;

}

set

{

this.messageField = value;

}

}

}



/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:hpccsystems:ecl:wsadd")]

public partial class wsaddResponseResults

{



private wsaddResponseResultsResult resultField;



/// <remarks/>

public wsaddResponseResultsResult Result

{

get

{

return this.resultField;

}

set

{

this.resultField = value;

}

}

}



/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:hpccsystems:ecl:wsadd")]

public partial class wsaddResponseResultsResult

{



private Dataset datasetField;



/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Namespace="urn:hpccsystems:ecl:wsadd:result:result_1")]

public Dataset Dataset

{

get

{

return this.datasetField;

}

set

{

this.datasetField = value;

}

}

}



/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:hpccsystems:ecl:wsadd:result:result_1")]

public partial class Dataset

{



private DatasetRow[] rowField;



private string nameField;



/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute("Row", Order=0)]

public DatasetRow[] Row

{

get

{

return this.rowField;

}

set

{

this.rowField = value;

}

}



/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string name

{

get

{

return this.nameField;

}

set

{

this.nameField = value;

}

}

}



/// <remarks/>

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.648")]

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:hpccsystems:ecl:wsadd:result:result_1")]

public partial class DatasetRow

{



private string result_1Field;



/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(DataType="integer", Order=0)]

public string Result_1

{

get

{

return this.result_1Field;

}

set

{

this.result_1Field = value;

}

}

}



[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]

[System.ServiceModel.MessageContractAttribute(WrapperName="wsaddRequest", WrapperNamespace="urn:hpccsystems:ecl:wsadd", IsWrapped=true)]

public partial class wsaddRequest

{



[System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:hpccsystems:ecl:wsadd", Order=0)]

[System.Xml.Serialization.XmlElementAttribute(DataType="integer")]

public string i1;



[System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:hpccsystems:ecl:wsadd", Order=1)]

[System.Xml.Serialization.XmlElementAttribute(DataType="integer")]

public string i2;



public wsaddRequest()

{

}



public wsaddRequest(string i1, string i2)

{

this.i1 = i1;

this.i2 = i2;

}

}



[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]

[System.ServiceModel.MessageContractAttribute(WrapperName="wsaddResponse", WrapperNamespace="urn:hpccsystems:ecl:wsadd", IsWrapped=true)]

public partial class wsaddResponse

{



[System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:hpccsystems:ecl:wsadd", Order=0)]

public ArrayOfEspException Exceptions;



[System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:hpccsystems:ecl:wsadd", Order=1)]

public wsaddResponseResults Results;



[System.ServiceModel.MessageBodyMemberAttribute(Namespace="urn:hpccsystems:ecl:wsadd", Order=2)]

[System.Xml.Serialization.XmlAttributeAttribute()]

public int sequence;



public wsaddResponse()

{

}



public wsaddResponse(ArrayOfEspException Exceptions, wsaddResponseResults Results, int sequence)

{

this.Exceptions = Exceptions;

this.Results = Results;

this.sequence = sequence;

}

}



[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]

public interface roxieServiceSoapChannel : roxieServiceSoap, System.ServiceModel.IClientChannel

{

}



[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]

public partial class roxieServiceSoapClient : System.ServiceModel.ClientBase<roxieServiceSoap>, roxieServiceSoap

{



public roxieServiceSoapClient()

{

}



public roxieServiceSoapClient(string endpointConfigurationName) :

base(endpointConfigurationName)

{

}



public roxieServiceSoapClient(string endpointConfigurationName, string remoteAddress) :

base(endpointConfigurationName, remoteAddress)

{

}



public roxieServiceSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :

base(endpointConfigurationName, remoteAddress)

{

}



public roxieServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :

base(binding, remoteAddress)

{

}



[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]

wsaddResponse roxieServiceSoap.wsadd(wsaddRequest request)

{

return base.Channel.wsadd(request);

}



public ArrayOfEspException wsadd(string i1, string i2, out wsaddResponseResults Results, out int sequence)

{

wsaddRequest inValue = new wsaddRequest();

inValue.i1 = i1;

inValue.i2 = i2;

wsaddResponse retVal = ((roxieServiceSoap)(this)).wsadd(inValue);

Results = retVal.Results;

sequence = retVal.sequence;

return retVal.Exceptions;

}

}










<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:tns="urn:hpccsystems:ecl:wsadd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:hpccsystems:ecl:wsadd" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns:ds1="urn:hpccsystems:ecl:wsadd:result:result_1" elementFormDefault="qualified" targetNamespace="urn:hpccsystems:ecl:wsadd">
<xsd:import schemaLocation="../result/Result_1.xsd" namespace="urn:hpccsystems:ecl:wsadd:result:result_1" />
<xsd:complexType name="EspException">
<xsd:all>
<xsd:element minOccurs="0" name="Code" type="xsd:string" />
<xsd:element minOccurs="0" name="Audience" type="xsd:string" />
<xsd:element minOccurs="0" name="Source" type="xsd:string" />
<xsd:element minOccurs="0" name="Message" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ArrayOfEspException">
<xsd:sequence>
<xsd:element minOccurs="0" name="Source" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Exception" type="tns:EspException" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="Exceptions" type="tns:ArrayOfEspException" />
<xsd:complexType name="EspStringArray">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Item" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EspIntArray">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="Item" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="XmlDataSet">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="CsvDataFile">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="RawDataFile">
<xsd:restriction base="xsd:base64Binary" />
</xsd:simpleType>
<xsd:element name="wsaddRequest">
<xsd:complexType>
<xsd:all>
<xsd:element minOccurs="0" maxOccurs="1" name="i1" type="xsd:integer" />
<xsd:element minOccurs="0" maxOccurs="1" name="i2" type="xsd:integer" />
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="wsaddResponse">
<xsd:complexType>
<xsd:all>
<xsd:element minOccurs="0" name="Exceptions" type="tns:ArrayOfEspException" />
<xsd:element minOccurs="0" name="Results">
<xsd:complexType>
<xsd:all>
<xsd:element name="Result">
<xsd:complexType>
<xsd:all>
<xsd:element minOccurs="0" ref="ds1:Dataset" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:all>
<xsd:attribute name="sequence" type="xsd:int" />
</xsd:complexType>
</xsd:element>
<xsd:element name="string" nillable="true" type="xsd:string" />
</xsd:schema>
</types>
<message name="wsaddSoapIn">
<part name="parameters" element="tns:wsaddRequest" />
</message>
<message name="wsaddSoapOut">
<part name="parameters" element="tns:wsaddResponse" />
</message>
<portType name="roxieServiceSoap">
<operation name="wsadd">
<input message="tns:wsaddSoapIn" />
<output message="tns:wsaddSoapOut" />
</operation>
</portType>
<binding name="roxieServiceSoap" type="tns:roxieServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="wsadd">
<soap:operation soapAction="/roxie/wsadd?ver_=1.0" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="roxie">
<port name="roxieServiceSoap" binding="tns:roxieServiceSoap">
<soap:address location="http://192.168.19.130:8002/WsEcl/soap/query/roxie/wsadd" />
</port>
</service>
</definitions>


No comments:

Post a Comment