1

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

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

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

  • I only experienced web service with serializing data and deserializing the data that comes back.

From the docs:

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.

E.Meir
  • 2,146
  • 7
  • 34
  • 52
  • _"but the service that I need to work with now- don't use functions that I can call to retrieve data"_ - what does it provide then? A "Write-Only" Service? Sounds odd. – Fildor Feb 27 '18 at 14:53
  • Have you tried [this](https://stackoverflow.com/a/4304356/982149) or [this](https://stackoverflow.com/a/14360303/982149)? – Fildor Feb 27 '18 at 14:54
  • @Fildor, i got a documentation on the service that i need to consume, and its describing: 1) XML structure for requests and responses for the services 2) Definition for each element within the XML – E.Meir Feb 27 '18 at 15:11

1 Answers1

3

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/

Shetty
  • 1,792
  • 4
  • 22
  • 38
  • I already added it as a web reference- this is not what i have asked i asked "how i can consume a service without any functions- Thanks – E.Meir Feb 27 '18 at 15:13
  • There will be methods. Looking at the Request and Response xml structure i can say there will be a method like "GetOrderDetail". If you have added service reference, open the proxy class to see what methods are available. You can check this in WSDL as well – Shetty Feb 27 '18 at 15:24
  • i am looking in "Reference.cs" of the web references service and i dont see any function. only- classes, properties and variables.. – E.Meir Feb 27 '18 at 15:30
  • can we open a chat window here, and i will share with you the end-point so that you can see? – E.Meir Feb 27 '18 at 15:33
  • sure i can try. – Shetty Feb 27 '18 at 15:34
  • Thanks. but how can i open the chat window? :/ – E.Meir Feb 27 '18 at 15:34