Issue
I am new to consuming web services with .Net and facing following issue. I have a WSDL with following definition
<s:element name="ClassTransfer">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="trans" type="tns:ClassStudent" />
<s:element minOccurs="0" maxOccurs="1" name="RollNo" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ClassStudent">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Subject" type="s:string" />
…
</s:sequence>
</s:complexType>
And in code when calling the function
SchoolWebService.RemoteClassApi objSchool = new SchoolWebService.RemoteClassApi();
res= objSchool.ClassTransfer(…)
it required me to provide two parameters:
ClassStudent trans
& string RollNo
RollNo
can be provided simply as a string but I don’t know how to provide trans
object?
Solution
Normally the class "ClassStudent" should have been generated so try
var studentToTransfer = new ClassStudent {Subject = "Foo"};
SchoolWebService.RemoteClassApi objSchool = new SchoolWebService.RemoteClassApi();
res= objSchool.ClassTransfer(studentToTransfer , "5A" );
NB : The class are generated in the folder "services references" of your project. It doesn't follow the "one file one class" principle ;)
Answered By - Pak Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.