如何使用WSDL Web服务 [英] How to consume WSDL web service

查看:59
本文介绍了如何使用WSDL Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用(发送请求并检索响应)WSDL SAOP Web服务.

I need to consume (send request and retrieve the response) of WSDL SAOP web service.

WSDL文档是使用请求和响应的对象构建的.

The WSDL document is built with objects of request and response.

如何用XML结构调用它并获得XML结构数据作为响应?

How can I call it with XML structure and get as response the XML structure data?

  • 我只经历过Web服务,对数据进行序列化和反序列化返回的数据.

来自文档:

public class GetOrderDetailRequest : Request
{
  public string UserName { get; set; } //Required
  public int SiteID { get; set; }    //Required
  public string Password { get; set; } //Required
  public string OrderID { get; set; }  //Required
}

//    Sample Request XML
//    <GetAdminOrderDetail>
//      <MethodParameters>
//        <req>
//          <OrderID>9063384</OrderID>
//          <Password>test</Password>
//          <SiteID>123</SiteID>
//          <UserName>test</UserName>
//        </req>
//      </MethodParameters>
//    </GetAdminOrderDetail>


// GetOrderDetailResponse object
public class AdminOrderDetail
{
 public List<OrderedColumn> Columns { get; set; }       
 public Invoice Invoice { get; set; }               
 public List<OrderedItem> Items { get; set; }       
 public AdminOrderDetails Details { get; set; }     
}

我在网上找到的唯一示例是在服务中调用一个函数的示例,但是我现在需要使用的服务-不要使用我可以调用的函数来检索数据.

The only examples that I found online, are ones with calling a function in the service, but the service that I need to work with now- don't use functions that I can call to retrieve data.

推荐答案

我假设您正在使用c#客户端来使用WCF服务.您需要向客户项目添加服务引用.这将从WSDL创建必要的类,并帮助您创建调用Web服务的请求并获得响应.看看这个 http://www.c-sharpcorner.com/UploadFile/0c1bb2/using-wcf-service-in-console-application/

I am assuming you are using a c# client to consume a WCF service. You need to add service reference to your client project. This creates necessary classes from the WSDL and helps you to create request to call web service and get response. Take a look at this http://www.c-sharpcorner.com/UploadFile/0c1bb2/consuming-wcf-service-in-console-application/

这篇关于如何使用WSDL Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆