.net - How to remove XML declaration from web request -
we're trying talk web server (possibly jboss) choking on request generated .net. if manually create soap, works, not want -- have every method in wsdl. real difference presence of xml declaration. trouble is, cannot figure out how rid of that. i'm not able modify request stream. can offer advice?
public partial class customclient : generatedclient { protected override webrequest getwebrequest(uri uri) { var webrequest = base.getwebrequest(uri); webrequest.method = "post"; var requeststream = webrequest.getrequeststream(); // next line cannot execute -- stream not readable. var soapenvelope = new streamreader(requeststream).readtoend();
good request (manually created):
post https://remotewebserver.org/productname/service http/1.1 authorization: basic biglongbase64 soapaction: "" content-type: text/xml; charset=utf-8 host: remotewebserver.org content-length: 378 expect: 100-continue connection: keep-alive <soapenv:envelope> <soapenv:body> <con:querylimitrequest> <username>email@address.com</username> <password>pa$$w0rd</password> <organization>our company name</organization> <con:requesttype>querylimit</con:requesttype> <con:processingtype>testing</con:processingtype> </con:querylimitrequest> </soapenv:body> </soapenv:envelope>
bad request (automatically generated):
post https://remotewebserver.org/productname/service http/1.1 authorization: basic biglongbase64 soapaction: "" content-type: text/xml; charset=utf-8 host: remotewebserver.org content-length: 532 expect: 100-continue connection: keep-alive <?xml version="1.0" encoding="utf-8"?> <!-- xml declaration want remove --> <soap:envelope> <soap:body> <querylimitrequest xmlns="http://namespace.remotewebserver.org"> <username>email@address.com</username> <password>pa$$w0rd</password> <organization>our company name</organization> <requesttype>querylimit</requesttype> <processingtype>testing</processingtype> </querylimitrequest> </soap:body> </soap:envelope>
Comments
Post a Comment