1

I have created a WCF service in which I have created the following method

public List<AddTravelDetails> ReadXML(XmlDocument xDoc)

Now I want to consume the service. Can anyone help me? How can I pass XmlDocument as input parameter for the ReadXML function?

Thanks, Rahul

5
  • I don't understand your question. Are you wondering how to assign a document to the xDoc variable? Commented Feb 28, 2013 at 10:20
  • Yes, I want to assign document to xDoc variable. Commented Feb 28, 2013 at 10:37
  • Does your document already exist on file somewhere or do you still have to create it in your code? Commented Feb 28, 2013 at 10:39
  • The document is saved in my D drive in .xml format Commented Feb 28, 2013 at 10:44
  • Why would you want to input raw XML into a service method? This renders WSDL and XSD useless, because the user can input anything they like. Can't you build a DataContract from the expected input and parse the XML on the client side into this DataContract? Besides that an XmlDocument just is a wrapper around an input string, if you really must do that then just use a string parameter and create the XmlDocument inside the service method with that string as input. Commented Feb 28, 2013 at 10:48

1 Answer 1

2
XmlDocument doc = new XmlDocument();
doc.Load(pathToYourFile);

Where pathToYourFile is for example: @"D:\yourfile.xml"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.