c# - Can't find XML in httprequest -


i have existing asp page largely can't/won't change calls service, sending xml document.

private function queryxyz(byval strstreet1 string, _                         byval strstreet2 string, _                         byval strcity string, _                         byval strstate string, _                         byval strzipmain string, _                         byref objdomdoc domdocument, _                         byref blnstreetmatch) boolean  on error goto errorhandler  dim intcount integer dim lngerrnum long dim objresult ixmldomnode dim objresultset ixmldomnodelist dim objxmlhttp new serverxmlhttp dim strerrdesc string dim strfault string dim strmessage string dim strresults string dim strsoap string  'co 11784 - start 'build soap xml request strsoap = _ "<soap:envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/xmlschema-instance/' xmlns:xsd='http://www.w3.org/2001/xmlschema/'>" & _     "<soap:body>" & _         "<matchaddress xmlns='http://(address/'>" & _                     "<matchparms>" & _                         "<firm />" & _                         "<street1>" & strstreet1 & "</street1>" & _                     "</matchparms>" & _         "</matchaddress>" & _     "</soap:body>" & _ "</soap:envelope>" 'co 11784 - end 'load request xml document objdomdoc.async = false objdomdoc.loadxml (strsoap)  'check syntax errors in request if objdomdoc.parseerror.errorcode <> 0     err.raise 10620, "query", "error parsing generated xml query: [" & objdomdoc.parseerror.reason & _         "]" & "[" & objdomdoc.parseerror.srctext & "]" end if  'send request objxmlhttp.open "post", mstrgisurl, false objxmlhttp.setrequestheader "soapaction", "http://sampleaddress.com/matchaddress" objxmlhttp.send objdomdoc  'load response strresults = replace(objxmlhttp.responsetext, "&quot;", """") strresults = replace(strresults, "&gt;", ">") strresults = replace(strresults, "&lt;", "<") strresults = replace(strresults, "&apos;", "'") objdomdoc.loadxml (strresults) 

i want set talk new (non-wcf) service i'm writing.

public xmldocument matchaddress(string addressinxml) 

(i know parameter call wrong, it's set way test using service.asmx form)

the problem is, can't find xml located in request. i've checked , input stream test function:

    system.io.streamreader sr = new system.io.streamreader(httpcontext.current.request.inputstream);     string requestcontents = sr.readtoend();     sr.close();       streamwriter sw = system.io.file.createtext( @"c:\temp\testfile.txt");     (int = 0; < httpcontext.current.request.headers.allkeys.length; i++)     {         sw.writeline (httpcontext.current.request.headers.allkeys[i] + environment.newline);         //if (httpcontext.current.request.headers.allkeys[i] == "soapaction")         //{         string soaphd = httpcontext.current.request.headers.allkeys[i];         string soaptxt = system.web.httpcontext.current.request.headers[soaphd];         sw.writeline(soaptxt + environment.newline);         //}     }     sw.close(); 

and can't find it.

i doing wrong. i'm not sure if there's change needs making classic asp code, no matter how hard do. can't tell if need find location , change input parameter (or remove entirely) or if need know right parameter first, , data magically appear.

i don't know "soapaction" header - need match address of new service, or can generic (or plain incorrect) other address? same question

<matchaddress xmlns='http://(address/'>" 

line in xml - bollixing not being matching address?

i don't see xml when try run in soapui, whether means or not dunno.

more details can provided requested.

turns out close using stream reader, reading wrong kind of object. gives me access entire xml :

xmldocument xdoc = new xmldocument(); using (stream receivestream = httpcontext.current.request.inputstream)      {          // move begining of input stream , read          receivestream.position = 0;          using (streamreader readstream = new streamreader(receivestream, encoding.utf8))          {              // load xml document              xdoc.load(readstream);          }      }  

dumping resulting xml string allowed me @ wanted, way care to. no need worry parameters in function definition @ all.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

mysql - FireDac error 314 - but DLLs are in program directory -