我从客户处获得了 .wsdl 文件。通过使用此网络服务,我需要验证客户信息。那么如何实现这一目标。无论客户是否在场 xml:
<xs:element name="FetchClubMembershipRequest">
<xs:annotation>
<xs:documentation>Request to fetch customers' membership information.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="Customer_ID" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="1" name="Customer_Code" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="1" name="Last_Name" type="xs:string" />
<xs:element minOccurs="1" maxOccurs="1" name="First_Name" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
这是来自 wsdl.file
最佳答案
转到“项目”>“添加 Web 引用”并输入 wsdl 文件的 url 或本地路径,然后 VS 将获取 WSDL 文件,如果一切正常,它将显示在左侧,并启用底部的“添加引用”按钮,以便我们可以将其添加到我们的项目中。
public yourWebService.xyz ws = new yourWebService.xyz();
Private void btnValidate_Click()
{
// your webservice validation logic..
// here m considering your webservice as checking wheather a input is number
if(ws.checkIsNumber(txtNumber.text))
//something if true
else
//something if wrong
}
关于asp.net - 如何使用 ASP.NET 调用 Web 服务(.wsdl),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4436227/