Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site.http://forums.asp.net/t/1624859.aspx/1?Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Sun, 28 Nov 2010 17:48:19 -050016248594175166http://forums.asp.net/p/1624859/4175166.aspx/1?Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Helllo;</p> <p>I have been strugleing with this for&nbsp;more than a week, and have not been able to get any further ahead. I need to create a Webservice that can recive an HTTP Post with an XML document as the body or payload. It will be comeing from a PHP site, and I need to access it in ASP.Net.</p> <p>I can create a webservice and test it out correctly with no real hitch, but when testing with my&nbsp; third partys test page I am not getting the&nbsp;proper responce. The third party company can not provide me with much help since they do not know ASP.</p> <p>The following is&nbsp;a sample code peice that can open a string of XML passed, and I have a form that can post to this test page.</p> <p>public XmlDocument ProcessXML(String SourceXML)<br> {<br> XmlDocument NewSourceXML = new XmlDocument();<br> NewSourceXML.LoadXml(SourceXML);</p> <p>.....</p> <p>}</p> <p>I knoiw that once I can read the posted XML I can break it down and do what I need to do with it, but I am having issues reciving the XML at this point.</p> <p>My third party provided me with a basic excert from a PHP file.</p> <p>/*<br> &nbsp;* &nbsp;Get the HTTP request (body) and parse into an XML document <br> */<br> &#36;data = file_get_contents(&quot;php://input&quot;);<br> &#36;xmlstr = trim( stripslashes( &#36;data ) );<br> &#36;xml = new SimpleXMLElement(&#36;xmlstr);<br> <br> But this is of no help to me. I need to solve this so I can start reciving XML transmissions from this company.</p> <p>Thanks for any help you can give.</p> <p><font color="#0000ff" size="2"><font color="#0000ff" size="2">&nbsp;</p> <p>&nbsp;</p> </font></font> 2010-11-18T22:53:58-05:004176153http://forums.asp.net/p/1624859/4176153.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p></p> <blockquote><span class="icon-blockquote"></span> <h4>JRatcliff</h4> public XmlDocument ProcessXML(String SourceXML)</blockquote> <p></p> <p>so the XML document is being passed as a string parameter. Correct?</p> <p>Are they able to hit the URL for web service from their box? If yes, then ask them to provide details of errors they are getting.</p> 2010-11-19T13:32:25-05:004176414http://forums.asp.net/p/1624859/4176414.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>The XML data is being posted to the&nbsp;WebService I can only think it is being passed as an XML file structure. I have for the time being setup&nbsp;my procedure to receive a String, and have not had any luck setting it up to recieve a XML&nbsp;data&nbsp;transmission. The excert&nbsp;of the PHP code is what they use to recieve the XML, I have not found anything that&nbsp;is&nbsp;simular in ASP with C# Script.</p> <p>The Third party is performing a&nbsp;HTTP Post, the test page is doing it from a form with a couple of jscripts. If you would like to see the test page you can see it at the following URL.</p> <p><a href="https://lab.jumptxt.com/smsxml-test-suite/DeliverRequest.action" target="_blank">https://lab.jumptxt.com/smsxml-test-suite/DeliverRequest.action</a><br> </p> <p>I have had to use FireFox to use the page, IE&nbsp;presents the ability to save a file so I have not been able to use IE on this test site.&nbsp;My WebService is located at the following URL.</p> <p><a href="http://smsnetca.w03.winhost.com/Service/wsTest1.asmx/ProcessXML" target="_blank">http://smsnetca.w03.winhost.com/Service/wsTest1.asmx/ProcessXML</a><br> </p> <p>The error I am getting is the following.</p> <p>com.impact.exception.FatalException: Server returned status 500: Internal Server Error</p> <p>Any help you can provide would be helpfull.</p> <p>Thanks&nbsp;</p> 2010-11-19T16:37:38-05:004176715http://forums.asp.net/p/1624859/4176715.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Hi, well first, to solve this problem you need to take a more stepped approach.</p> <p>&nbsp;</p> <p>First, make sure you can get the&nbsp;webservice to work for you, completely, and then worry about the third party with the PHP page.&nbsp; You'd&nbsp;be surprised how many PHP have no idea how to interact with webservices, so you may be against a technical challenge there even if your webservice was the best thing since sliced bread.&nbsp;</p> <p>Due to technical limitations of your client, you may want to consider possibly building an httphandler instead, and then having them hit that instead passing request parameters as appropriate....lots of time PHP people are a bit better with that sort of basic tech.</p> <p>None the less you need to make sure your enviroment works perfectly fine before you involve your client. In this case you should build a seperate website perhaps that consumes the service you built, and pass your own tests to it.&nbsp; If you do this all in one solution you should be able to easily step through the code to see how things are going.</p> <p>&nbsp;</p> <p>Also, if you expect XML from someone else, you may want to learn how to build an xml validator that way you can validate the xml your receiving.&nbsp; You can never assume the client is going to pass you something appropriate...users always do what you don't expect.</p> 2010-11-19T20:42:03-05:004176720http://forums.asp.net/p/1624859/4176720.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p></p> <blockquote><span class="icon-blockquote"></span> <h4>JRatcliff</h4> <p>public XmlDocument ProcessXML(String SourceXML)<br> {<br> XmlDocument NewSourceXML = new XmlDocument();<br> NewSourceXML.LoadXml(SourceXML);</p> <p>.....</p> <p>}<font color="#0000ff" size="2"><font color="#0000ff" size="2">&nbsp;</p> </font></font> <p></p> </blockquote> &nbsp; <p></p> <p>Additionally, what version of .Net are you using?&nbsp; if your using 3.5 or higher, you may want to move the the Linq to XML structure, personally I find it a lot easier to work with.</p> <p>In this case your code would be </p> <p>XDocument sourceXml = XDocument.Parse(SourceXML);</p> <p>Then you can query against, it, but definately need to validate the xml...who knows what kinda garbly goop they could send you.</p> <p></p> 2010-11-19T20:45:07-05:004177513http://forums.asp.net/p/1624859/4177513.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Thanks for your ideas Blast2hell, I have already got a WebService that validates the XML based on the type of transmission my third party is to send. It even sends an XML transmission back confirming and replying to the transwmission.</p> <p>The problem seams to be with the variable that&nbsp;is meant to recieve the XML transmission from the PHP form.&nbsp;When I use a String variable, the testing&nbsp;service works fine when I hit the page directly&nbsp;with IE and invoke the rotine, but from the PHP test page using the HTTP Post I get an error reported of &quot;Server returned status 500: Internal Server Error&quot;. I am guessing that the&nbsp;post is not passing&nbsp;a string through the post.</p> <p>A sample of the test XML is as follows:</p> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br> &lt;!DOCTYPE xiamSMS SYSTEM &quot;xiamSMSMessage.dtd&quot;&gt;</p> <p>&lt;xiamSMS&gt;<br> &nbsp; &lt;deliverRequest id=&quot;1&quot;&gt;<br> &nbsp;&nbsp;&nbsp; &lt;from&gt;&#43;14165551234&lt;/from&gt;<br> &nbsp;&nbsp;&nbsp; &lt;to&gt;&#43;467228&lt;/to&gt;<br> &nbsp;&nbsp;&nbsp; &lt;content type=&quot;text&quot;&gt;HELP&lt;/content&gt;<br> &nbsp;&nbsp;&nbsp; &lt;receivedOnGroup value=&quot;NONE&quot; /&gt;<br> &nbsp;&nbsp;&nbsp; &lt;xirMessageID value=&quot;1&quot; /&gt;<br> &nbsp; &lt;/deliverRequest&gt;<br> &lt;/xiamSMS&gt;</p> <p>I just have to be able to recive this XML through a post once I have it I know I can break it down, store it, and return a validation in XML. There of course are a lot of other alterations to this XML and it will be posible for this to have multiple deliverRequest cells in the live one. This is just a test XML to be used to confirm the ability to recive from my third party.</p> 2010-11-20T16:11:44-05:004177520http://forums.asp.net/p/1624859/4177520.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Also, I have tried using an XmlDocument variable, but the service responds with &quot;The test form is only available for requests from the local machine.&quot; and can not be invoked through IE, and of course the test form responds with &quot;Server returned status 500: Internal Server Error.&quot;</p> <p>So the question still stands, How do I setup a WebService to accept a XML data transmission from a PHP form using an HTTP Post with the XML as the body of the post? This third party is not willing to use SOAP to transmitte the XML whitch would be the proper way for ASP.</p> <p>Any help that you can provide would be greatly accepted.</p> <p>Thanks</p> <p>JRatcliff<font color="#2b91af" size="2"><font color="#2b91af" size="2"></p> <p>&nbsp;</p> </font></font> 2010-11-20T16:19:46-05:004177828http://forums.asp.net/p/1624859/4177828.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Right now it looks like your ProcessXML method is looking for a parameter to be passed to it of the type System.Xml.XmlNode.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I think the php people may have trouble making the xmlnode type.</p> <p>&nbsp;</p> <p>Also the php people will most likely need to download a tool or something to assist them with connection to a webservice. Like wsdl2php or NuSoap.&nbsp;</p> <p>&nbsp;</p> <p>Did I understand you correctly that you've created your own test application, and invoked your webservice and everything worked? </p> <p>&nbsp;</p> <p>I'm still of the mind that you probably need to do a webhandler instead.&nbsp; </p> <p>&nbsp;</p> <p>&nbsp;</p> 2010-11-21T03:59:59-05:004178127http://forums.asp.net/p/1624859/4178127.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>An interesting idea, but I have never created a webhandler before. I need to have something that can&nbsp;accept an XML file through a post and after parsing the XML I will need to&nbsp;return back an XML responce confirming the transmission. I have no problem parsing the XML, and I have no issues returning an XML responce. I felt the&nbsp;WebService process was the best way to approach it.</p> <p>This WebHandler you have mentioned, how would I go about setting up this to recive the HTTP Post from PHP with an XML in the body of the post?</p> <p>Thanks</p> <p>JRatcliff&nbsp;</p> 2010-11-21T15:09:49-05:004178262http://forums.asp.net/p/1624859/4178262.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>well keep in mind I'm not saying your webservice won't work, I'm just saying it may be technically to much for your php people. I could also be a bit bias against PHP people hehe.</p> <p>&nbsp;</p> <p>Anyways. to answer your question. You would&nbsp;open an existing web application, or create a new one, based on your scenaior. And&nbsp;right click the project and choose &quot;Add new&nbsp;item&quot;.&nbsp; And then Choose Generic Handler.&nbsp; The file type for these is .ashx.&nbsp; Rename it to something appopriate...like XmlReciver.ashx.</p> <p>Handlers&nbsp;can be used to input and output all sorts of things....you can treat it like a normal web page, and access Request parameters...the site can then post the xml string as a url parameter...for instance</p> <p>http://mywebsite.com/XmlReciever.ashx?xmlString=&lt;node&gt;&lt;val&gt;stuff&lt;/val&gt;&lt;/node&gt;</p> <p>&nbsp;</p> <p>And then you can output the response appropriately.&nbsp; You'd most likely be able to take whatever code you had for your webservice already and put it in the handler, or even just have your handler call your webservice.&nbsp;&nbsp;</p> <p>&nbsp;</p> <p>Brian&nbsp;</p> 2010-11-21T19:56:41-05:004180236http://forums.asp.net/p/1624859/4180236.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Thanks Brian.</p> <p>I did some searching on the help forms and found alot out about the Handler and started playing with a test file. It took me a couple of hours, but I managed to get one of my test forms to post an XML file to the handler. </p> <p>It got me pumped when I got that to happen, I&nbsp;got me alot closer to having a solution. I will be testing my test handler online from the live site tomorrow. If all gose well then I have managed to&nbsp;get the solution, I will let you know latter how it is going.&nbsp;</p> <p>&nbsp;</p> <p>Thanks</p> <p>JRatcliff</p> 2010-11-23T02:36:56-05:004180241http://forums.asp.net/p/1624859/4180241.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>cool, let me know if you hit any snags&nbsp;</p> 2010-11-23T02:42:17-05:004183511http://forums.asp.net/p/1624859/4183511.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>OK now this is getting me really upset. The following is a sample of the Handler I have created, slitely modifyed.</p> <p>public class hndTest1 : IHttpHandler {</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private Boolean m_success = true;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void ProcessRequest(HttpContext xmlText)</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlTextReader tstReader = new XmlTextReader(xmlText.Request.InputStream0;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlValidatingReader reader = new XmlValidatingReader(tstReader);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.ValidationEventHandler &#43;= new ValidationEventHandler(ValidationCallBack);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Read();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (reader.Read())<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Extra code to parse the elements and check for trigers<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlDocument tstXmlDoc = new XmlDocument();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlDeclaration tstDeclaration = tstXmlDoc.CreateXmlDeclaration(&quot;1.0&quot;, &quot;utf-8&quot;, null);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlElement rootNode = tstXmlDoc.CreateElement(&quot;xiamSMS&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tstXmlDoc.InsertBefore(xmlDeclaration, tstXmlDoc.DocumentElement);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tstXmlDoc.AppendChild(rootNode);</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlElement parentNode = tstXmlDoc.CreateElement(&quot;deliverResponse&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parentNode.SetAttribute(&quot;id&quot;, &quot;123456&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tstXmlDoc.DocumentElement.PrependChild(parentNode);</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlElement resultNode = tstXmlDoc.CreateElement(&quot;result&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resultNode.SetAttribute(&quot;status&quot;, &quot;OK&quot;);</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XmlText resultText = tstXmlDoc.CreateTextNode(&quot;&#43;1234567890&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parentNode.AppendChild(resultNode);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resultNode.AppendChild(resultText);</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlText.Response.ContentType = &quot;text/xml&quot;;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlText.Response.Write(tstXmlDoc);</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public bool IsReusable {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void ValidationCallBack(object sender, ValidationEventArgs args)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_success = false;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p> <p>}</p> <p>&nbsp;</p> <p>Now what I have to recieve is the following XML or something similare.</p> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br> &lt;!DOCTYPE xiamSMS SYSTEM &quot;xiamSMSMessage.dtd&quot;&gt;</p> <p>&lt;xiamSMS&gt;<br> &nbsp; &lt;deliverRequest id=&quot;1&quot;&gt;<br> &nbsp;&nbsp;&nbsp; &lt;from&gt;&#43;14165551234&lt;/from&gt;<br> &nbsp;&nbsp;&nbsp; &lt;to&gt;&#43;467228&lt;/to&gt;<br> &nbsp;&nbsp;&nbsp; &lt;content type=&quot;text&quot;&gt;HELP&lt;/content&gt;<br> &nbsp;&nbsp;&nbsp; &lt;receivedOnGroup value=&quot;NONE&quot; /&gt;<br> &nbsp;&nbsp;&nbsp; &lt;xirMessageID value=&quot;1&quot; /&gt;<br> &nbsp; &lt;/deliverRequest&gt;<br> &lt;/xiamSMS&gt;</p> <p>The problem is that the validation file xiamSMSMessage.dtd creates a couple of issues. I had the third party company send me a copy of this file, since I did not have it. Now how do I handle the validation for this file in my code so that it will not generate any errors from the PHP posting form all the while allowing me to parse the XML data passed and return back an XML document confirming the recieving of the data?</p> <p>Any thoughts on how to accomplish this would be greatly accepted, I am under a time constraint.</p> <p>Thanks</p> <p>JRatcliff</p> 2010-11-24T19:47:07-05:004185188http://forums.asp.net/p/1624859/4185188.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>I have made some progress in a test file. I have confirmed that I can receive an XML file and as long as I send back a string version of&nbsp;my responce XML I am find. The new test file works and works with no errors.</p> <p>Now my issue is opening up the XML file I am sent and&nbsp;getting around the validation file line, (&lt;!DOCTYPE xiamSMS SYSTEM &quot;xiamSMSMessage.dtd&quot;&gt;).</p> <p>I am opening the file&nbsp;with an XmlTextReader object, the advantage is that it allows me to read down the XML file and take out the different parts. Based on these parts I can build a responce XML and insert parts of the reading filoe into the responce. But I get tripped up on the DOCTYPE line, the minute my file reads that it has issues.</p> <p>Is there a way to step past that line and not even load it into memory, so as to bypass it?</p> <p>Or what code do I need to add that will allow my system to work with the Doctype and this DTD file?</p> <p>Help please, if I can solve this I can get the site up and running.</p> <p>&nbsp;</p> <p>Thanks</p> <p>JRatcliff</p> 2010-11-25T22:09:56-05:004185221http://forums.asp.net/p/1624859/4185221.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Sorry, I'll take a look at your stuff in detail tommorrow...being turkey day and&nbsp;all I'm a bit distracted.&nbsp; Also I have to go back in time to&nbsp;use the old XMlDocument stuff.... I'm an xml to linq guy these days and dont' use the old namespaces your dealing with.&nbsp; I'll take some time to look at it.&nbsp;&nbsp; Out the gate I think your probably required to use proper DTD when using the xmlvalidating stuff....but I could be wrong, like I said I need to research.&nbsp; I should have some time tommorrow to try to help ya figure it out though.&nbsp;</p> 2010-11-25T23:29:26-05:004185450http://forums.asp.net/p/1624859/4185450.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p><span style="font-family:Verdana; color:black; font-size:9pt">Thanks Brian I will wait and see what you can come up with, so far you have been a great help with your suggestion to use&nbsp;a Handler file. </span></p> <p><span style="font-family:Verdana; color:black; font-size:9pt">Thanks</span></p> <p><span style="font-family:Verdana; color:black; font-size:9pt">JRatcliff</span></p> <p><span style="font-family:Verdana; color:black; font-size:9pt"></span>&nbsp;</p> 2010-11-26T04:07:10-05:004187561http://forums.asp.net/p/1624859/4187561.aspx/1?Re+Creating+a+Web+Service+to+Recive+a+HTTP+POST+with+an+XML+document+as+the+body+or+payload+from+a+PHP+site+Re: Creating a Web Service to Recive a HTTP POST with an XML document as the body or payload from a PHP site. <p>Thanks Brian you helped to solve my&nbsp;first problem so I am marking this one solved. I am creating another for the XML reading issue I am encountering. I will use the title &quot;Problem reading an XML file with a DTD attached&quot; if you are interested in helping out.</p> <p>For those looking for the answer to my first problem. When designing a web service to recieve a&nbsp;HTTP Post of an XML from a PHP page, use a Generic Handler file to&nbsp;accept the HTTP Post and open the HttpContext variable and access the XML information by&nbsp;opening up the var.Request.InputStream. I found this solution to work better than using a&nbsp;Web Service and allowed&nbsp;me to&nbsp;accept the post.</p> <p>Ultimately the use of SOAP is better for&nbsp;passing&nbsp;XML but when you have very little choice this could work.&nbsp;&nbsp;&nbsp;</p> <p><font color="#2b91af" size="2"><font color="#2b91af" size="2"></p> <p></font></font><font size="2">&nbsp;</p> <p></p> <p>&nbsp;</p> </font> 2010-11-28T17:48:19-05:00