Problem sending XMLas a string inside a SOAP request to a web service...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Amit_N
Posted On:   Friday, November 15, 2002 09:04 AM

Hello there, I need your kind help...!! I have a web service method which accepts XML string as input,reads the XML string using XMlDocument and returns the no. occurence(s) of a particular element... here is my Web method code for ur kind ref.... Public Function HowManyAttachments (ByVal LegalXML As String) As Integer Dim objDOM As New XmlDocument() Dim j As Integer Dim iAttachments As Integer Dim mystr As Object objDOM.LoadXml(LegalXML) Dim objLSt As Object objLSt = objDOM.GetElementsByTagName("*   More>>

Hello there,

I need your kind help...!!

I have a web service method which accepts XML string as

input,reads the XML string using XMlDocument and returns

the no. occurence(s) of a particular element...







here is my Web method code for ur kind ref....



Public Function HowManyAttachments

(ByVal LegalXML As String) As Integer


Dim objDOM As New XmlDocument()


Dim j As Integer


Dim iAttachments As Integer



Dim mystr As Object


objDOM.LoadXml(LegalXML)



Dim objLSt As Object


objLSt = objDOM.GetElementsByTagName("*")



For j = 0 To objLSt.count - 1


If objLSt(j).NAME = "DocumentContent" Then


iAttachments = iAttachments + 1


End If


Next


HowManyAttachments = iAttachments


objLSt = Nothing


objDOM = Nothing




I tried sending an XML string as a parameter inside a SOAP request to this web service method thru' an asp page using XMLHTTP object...

here is my SOAP request XML....

<?xml version="1.0" encoding="utf-8"?>




xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


xmlns:xsd="http://www.w3.org/2001/XMLSchema"


xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">











My XML as a string goes here......














I got the SOAP response but the result returned is as follows meaning that the web method is not able to extract the parameter value from the XML string sent to it thru' an SOAP request....


<?xml version="1.0"?>

xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">



soap:Server

System.Web.Services.Protocols.SoapException: Server was unable to process request. --->

System.ArgumentNullException: Value cannot be null.

Parameter name: s at System.IO.StringReader..ctor(String s) at System.Xml.XmlDocument.LoadXml(String xml) at

FirstWebService.EFWebService.HowManyAttachments(String LegalXML) in

c:inetpubwwwrootFirstWebServiceEFWebService.asmx.vb:line 49 --- End of inner exception stack trace ---





I would like if it is really possible to send an XML as a string inside a SOAP request...??
if yes,then how do i get rid of the above problem...???


Thanks in advance...!!

Amit

   <<Less
About | Sitemap | Contact