p j

p j

  • NA
  • 128
  • 10.8k

How create a WCF service with a class type parameter

Mar 24 2020 11:16 AM
I'm trying to create a new service UpdateApplicationBidStatus and it should have two parameters -
 
1. ApplicationBidPayload (class)
2. PartnerId (Int)
 
ExchangeService.cs
  1. public ExchangeService: IExchangeService  
  2. {  
  3.     public int UpdateApplicationBidStatus(ApplicationBidPayload _InputXml, string PartnerId)  
  4.    {  
  5.       //------  
  6.    }  

IExchangeService.cs
  1. [OperationContract]  
  2. [WebGet(UriTemplate = "/UpdateApplicationBidStatus/{InputXml}/{PartnerId}", RequestFormat = WebMessageFormat.Xml)]  
  3. int UpdateApplicationBidStatus(ApplicationBidPayload _InputXml, string PartnerId); 
ApplicationBidPayload .cs class structure -
  1. [Serializable]  
  2. [DataContract]  
  3. public class ApplicationBidPayload  
  4. {  
  5. [DataMember]  
  6. public PayloadApplication Applicant { getset; }  
  7. }  
  8. public class PayloadPropertyAddress  
  9. {  
  10. [DataMember]  
  11. public string Flat { getset; }  
  12. [DataMember]  
  13. public string BuildingName { getset; }  
  14. [DataMember]  
  15. public string StreetNo { getset; }  
  16. [DataMember]  
  17. public string StreetName { getset; }  
  18. [DataMember]  
  19. public string Area { getset; }  
  20. [DataMember]  
  21. public string Town { getset; }  
  22. [DataMember]  
  23. public string County { getset; }  
  24. [DataMember]  
  25. public string Postcode { getset; }  
  26. }  
  27. public class PayloadApplication  
  28. {  
  29. [DataMember]  
  30. public string ApplicationId { getset; }  
  31. [DataMember]  
  32. public string PropertyId { getset; }  
  33. [DataMember]  
  34. public PayloadPropertyAddress PropertyAddress { getset; }  
  35. [DataMember]  
  36. public string AdvertCloseDate { getset; }  
  37. [DataMember]  
  38. public string BidStatus { getset; }  
  39. [DataMember]  
  40. public string BidStatusDate { getset; }  
  41. [DataMember]  
  42. public string PropertyLandlord { getset; }  
  43. }
Getting Error while testing Service -
 
 
Error: Cannot obtain Metadata from http://localhost:63494/CBLService/ExchangeApplication.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:63494/CBLService/ExchangeApplication.svc Metadata contains a reference that cannot be resolved: 'http://localhost:63494/CBLService/ExchangeApplication.svc'. The requested service, 'http://localhost:63494/CBLService/ExchangeApplication.svc' could not be activated. See the server's diagnostic trace logs for more information.HTTP GET Error URI: http://localhost:63494/CBLService/ExchangeApplication.svc The HTML document does not contain Web service discovery information.

Answers (1)