Как я могу вернуть xdocument из службы wcf ??? что мне нужно сделать, чтобы метод метода wxf возвращал объект xdocument?return xdocument from wcf service
6
A
ответ
7
Вы не можете. XDocument не реализует IXmlSerializable. XElement реализует IXmlSerializable, чтобы вы могли перенести его через WCF.
Вы также можете перенести строку вместо XDocument и проанализировать ее локально.
Ex:
Сервер:
public string DoSomething()
{
XDocument myXDocument = new XDocument();
// Do stuff
return myXDocument.ToString();
}
Клиент:
XDocument doc = XDocument.Parse(myWebService.DoSomething());
1
Вы можете также вернуть объект XElement.
public XElement DoSomething()
{
XDocument myXDocument = new XDocument();
// Load the XDocument.
return myXDocument.Root;
}
Смежные вопросы
- 1. return html from wcf service
- 2. null value return from WCF service operation
- 3. Httpwebrequest from wcf service
- 4. Return X509Certificate from Web Service
- 5. WCF Rest Service Return HttpWebResponse
- 6. call exe from wcf service
- 7. cant find wcf service from another wcf service iis 7
- 8. ajax call to wcf service return error
- 9. Ansync thread from WCF RESTful Service
- 10. XDocument Root.Elements() return null
- 11. Azure WCF Service Consuse Azure WCF Service
- 12. «return return» from обработчик события
- 13. java.util.collection return from webservice
- 14. Ajax WCF Restful Service Call Return Blank Страница
- 15. WCF Service - Return Класс объекта с именем класса
- 16. .NET SOAP Web Service return JSON
- 17. WCF service selfhosting
- 18. Simple Service WCF
- 19. function service return undefined
- 20. REST service return
- 21. Self Hosted WCF Service
- 22. AJAX Enabled WCF Service
- 23. wcf singleton service multithreaded
- 24. ngResource return return callback result by service
- 25. NotifyDataChanged from service Android
- 26. Angular2 multicast from service
- 27. dispatchKeyEvent from Service
- 28. start service from NotificationListenerService
- 29. Calling service from Html
- 30. WCF Service Client Lifetime
50% программирования находит правильное заклинание. Благодаря! –