how to pass a xml text string as parameter to a web service?

I defined the the web service as the following:

[WebMethod]
public string SaveQuestion(string qusxml)
{
...
return "OK";
}

the parameter 'qusxml' is a xml text string. But in the client, I try to pass a xml string to it, it return a error like this,
System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (5, 28). ---> System.Xml.XmlException: 'Text' is an invalid node type. Line 5, position 28.
at System.Xml.XmlReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read10_SaveQuestion()
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

Anyone can tell me how to pass a xml text string as parameter? thanks
0
geneyuan
6/3/2004 11:17:47 AM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

2 Replies
922 Views

Similar Articles

[PageSpeed] 21

In your consumer code or client you would have something like this.


try
{
XmlDocument _xdoc = new XmlDocument();
'load the document
string _result = ws.SaveQuestion( _xdoc.OuterXml );
}
catch( Exception _ex )
{
}

0
marascof
6/3/2004 12:20:49 PM
Thank you for your reply.

My client code is the following: (in client-side javascript)
var xmldoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmldoc.async = false;

var node = null;

node = xmldoc.createProcessingInstruction("xml", "version='1.0' encoding='utf-8'");
xmldoc.appendChild(node);
node = null;
var root = xmldoc.createElement("QUESTION");
xmldoc.appendChild(root);

var curEle = xmldoc.createElement("CONTENT");
curEle.text = Form1.editor.value;
root.appendChild(curEle);
curEle = null;

curEle = xmldoc.createElement("ANSWER");
curEle.text = Form1.ans.value;
root.appendChild(curEle);
curEle = null;

alert(xmldoc.xml);
savequsid = service.SmallQA.callService(savequestionResult, "SaveQuestion", xmldoc.xml);


Is there a problem? How to do? thanks.
0
geneyuan
6/4/2004 1:21:15 AM
Reply:

Similar Artilces:

xml web service --uploading the file to the xml web service
how can we upload the file in the xml web service 1.i mean what will be the return value in the proxy class 2.and how am i going to send the file to the xml web service----regards Bipul Kumar Here are some links to articles that helped us get this done: http://msdn.microsoft.com/webservices http://www.microsoft.com/downloads/details.aspx?familyid=06255a94-2635-4d29-a90c-28b282993a41&displaylang=en https://www.sys-con.com/dotnet/article.cfm?id=458 Hope this helps....

Passing an XML string as part of an XML Web Service
Hi there I am not too sure how to explain this but here goes..... I have a Web Service and I need to pass an XML page in the form of a string to a web service. My web service takes in 5 fields and one of those 5 fields is a string which is an xml page in the form of a string. I need to pass that string onto a COM object.Is it possible to pass XML in the form of a string to a web service or will that cause the web service to error?The web service is normally called from a PL/SQL stored procedure. If thats of any use.  Hi You can pass that XML string to the web method as a parameter.See...

Problem when calling web service and passing xml-like string as parameter
Hi,In asp.net application I'm consuming web services developed on another platform. I can communicate nicely with methods that require simple string as parameter. However there is one method that requires that I pass string which have xml tags, elements, attributes etc.I'm using something like this:        StringBuilder sb = new StringBuilder();        using (XmlWriter writer= XmlWriter.Create(sb))        {            // create some xml &nb...

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

create valid xml to send to web service based on the schema provided by web service
Problem: I have a web page which is being populated from a dataset containing multiple tables.  I now need to call a web service and send the majority of this data to be incorporate into a mainframe system.  I have been supplied with the schema that the web service will be using to validate the data.  I am new to web services and I am not sure how to take my existing dataset and transform it into an xml document that matches the schema I was provided with. There is a main schema with an element which is a custom complex type.  This custom type consists of an element whi...

Web service in .NET from Java Web Service
Hi there,I'm pretty new to .net (although i have years of experience with the old vb 6, access 2k, as well as java)... and need some with perhaps either some syntax or something.Here is the wsdl.<wsdl:definitions targetNamespace="http://www.dynix.com/schema/book">−<wsdl:types>−<schema targetNamespace="GetBookInfoByISBN">−<complexType name="BookInfoType">−<sequence><element maxOccurs="1" minOccurs="0" name="Title" nillable="true" type="xsd:string"/><element maxOccurs=&quo...

Sending an XML data as string with a web service as parameter
Hello, I'm trying to send data to a .net webservice with a webservice client on Delphi 2006. The service functions which i'm trying to use has two different versions. I'm using the second one because first one has a Dataset paramater.Second version has string pDataSetXmlContent parameter instead of the pdataset parameter of first one. (They say that second version for Delphi and Java as first one for C#) Versions of Service Functions: 1. int SendDepartmentGeneralInfo(string pUsername, string pPassword, string pIP, string pHospitalCode, *DataSet pDataSet* ) 2. int SendDe...

passing xml string into web service and getting response
Hi,I have to write a web service that handles an xml string e.g. <email>Joe.Bloggs@test.com</email><Firstname>Joe</Firstname>The web service needs to accept this string then strip out the values and insert into database and return an xml string with the element <complete>Y</complete>struggling with how to do this, any help would be great. First of all, that is not well-formed XML. It has more than one root element. Do you know how the callers will be creating this data? Do they not have the email and firstname separately?John Saunders | MVP – Connected ...

Reporting services: Querying a web service with report parameters (xml data extension)
 Hi all,I am using SQL Server Reporting Services 2005 and am attempting to query a web service that I have. If I query a webservice that doesn't take in any parameters, say service(), then I am able to get a flatten dataset. If I try with a web service that requires parameters, say service(string id, string procedure), I tried to pass in report parameters. However, on the web service side the report parameters do not exist and if I inspect the parameters, they are null. I added report parameters using the Data and Layout tabs via a Report Server Project. Does anyone k...

XML vs XML Web Services
I'm getting up to speed with XML and have the following questions: 1) Knowing XML means knowing how to design and create XML Web Services? 2) I found the amount of details on XML/XML Web services overwhelming, harder to digest than HTML or a new language. What's the best approach to learn and use it? Thanks.Please mark the post(s) that have helped you as "Answer" 1. No. They are different things 2. I'd start with a basic XML foundation (basic XML, XPath, and XSD), then review the basic WS things: soap, WSDL, and then from there on move to the WS-specs.Tomas Restrepo ...

XML Web service , Web form
hi i hope if u could help me in what i am making so i have a web form that does the collection of the information from the user when he hits the button this data must be sent to the xml web service but this service must deliver this data in xml then i read the information and insert it to the sql serevr Database could you help me becouse iam soo confused about where to start and what is the stuff to search in it iam new in the xml stuff help me pleaseeeeee“To be incredible you must produce great work”Visit My Bloghttp://www.dotnetjunkies.com/WebLog/hussein My first question is why are yo...

Urgent : Passing XML data as a web service' Parameter ?
hello friends, i need a genuine help and that is urgent need to solve it. my problem is how can i write a code that accepts Web Form's input values and that generate one xml tag file internally and after that whenever i consume it in to my web service it allows me to pass that whole XML file as a parameter in webservice's browser's textbox residing with "invoke" button. can u provide some URL that expplains me basic - pls give reference to specific code. please give me favour and help for that. thx. An entire XML document can be passed to a web service metho...

creating XML or XML Web Services?
Hi, I know XML is basically creating a file that allowed multiple applications to get data from the XML file ... and I am wondering .. why there is XML Web Services? What are the differences between these two? I am trying to create a Session that will keep update the value whenever it navigate to any page ... and get the Session value in multiple applications. In my guess, stores Session[] in XML file should work for what I am trying to do ... but what exactly is this XML Web Services? In what kind of situation we use XML or vice versa? All developers, even novices and hobbyists, must be a...

.NET web services Vs Java Web Services
Hello, does anyone know of a book or good source of information that compares .NET and Java Web Services? (I would like soemthing neutral if possible). I am thinking of approaching this subject for my dissertation? Many Thanks Rob Hi Rob, Last year I had to give a powepoint presentation on Web Services. I noticed some good books at barnes and noble that discussed the subject. These books were specific to Java and discussed Web Services in a very clear fashion. They gave some elementary examples that were easy to understand. I have not yet had the pleasure of creatin .NET Web Servi...

Web resources about - how to pass a xml text string as parameter to a web service? - asp.net.xml-web-services

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google Webmaster Tools Parameter Handling - Flickr - Photo Sharing!
You aren't signed in Sign In Help Home The Tour Sign Up Explore Explore Home Last 7 Days Interesting Popular Tags Calendar Most Recent Uploads ...

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 11/22/2015 5:06:28 AM