Jump to content

kernelpanik

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by kernelpanik

  1. Hey,thanks for the info and help. The script is working in the sense that with my own XML, all is good and I can post back results via sockets. However, as soon as I try to change to php://input, it doesnt work.I am assuming that the xml is being posted correctly to me, as the company I deal with do this daily. So, it means that I'm doing something wrong.I just switch between these :
     //$fileContents = "<my xml assigned to variable>";$fileContents = file_get_contents("php://input");

    I need to add logging now so that I can check what the story is, and then I need to start posting the information to my script myself, so that I can verify.It never ends :-)kp.

    Ok, all is working now - the xml format was slightly different to what was expected.Once I organise the code a little better, I will post here for others.kp.
  2. Did you know you can check the request type too?The following code returns the request type (GET, PUT, POST, HEAD...)
    $HTTP_SERVER_VARS['REQUEST_METHOD']

    After getting your code to work on the xml like you want, you may want to have the output change depending on the request type. ex: if method is POST, return SOAP message. if method is GET show html that says the page doesn't support that method (unless you want to support get....), or check if the variable for get is "wsdl" and show your wsdl file...Just figured it is worth mentioning....

    Hey,thanks for the info and help. The script is working in the sense that with my own XML, all is good and I can post back results via sockets. However, as soon as I try to change to php://input, it doesnt work.I am assuming that the xml is being posted correctly to me, as the company I deal with do this daily. So, it means that I'm doing something wrong.I just switch between these :
     //$fileContents = "<my xml assigned to variable>";$fileContents = file_get_contents("php://input");

    I need to add logging now so that I can check what the story is, and then I need to start posting the information to my script myself, so that I can verify.It never ends :-)kp.

  3. Maybe the post above is unclear....if you have a file named "soap.xml" that you want to parse..."soap.xml" is the location of the file you want to look at...in the same way, "php://input" is the location of the "raw POST data". Note that it is the location of the data. You don't need to worry about skipping the HTTP Header info, because it isn't there - only the data is.anyway... I don't know how you plan to work with the soap message, but the point is, its location will be "php://input"read more here (not much more though... actually... maybe it's less....)I would recommend you hard code the soap message to an xml file on the server for development. if you want just store the file name in a variable
    $file_name = "soap.xml"

    This will make testing/debugging much, much easier! You can print debug info to the browser and see where things are going wrong...Once your code works like you want, go ahead and change the value of $file_name to "php://input", remove echo statements that were used for debug and your done. You can then start calling your php script from your soap client, instead of just the browser

    Hi,thanks very much for that. I appreciate it. Gonna give it a go now, after ages of not knowing what to do :-)kp.
  4. Hi all,there are two scripts involved in my problem. The first constructs xml and posts it using HTTP Request to my PHP script.Kinda like this I guess :

    POST /InStock HTTP/1.1Host: www.example.orgContent-Type: application/soap+xml; charset=utf-8Content-Length: nnn<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">  <soap:Body xmlns:m="http://www.example.org/stock">    <m:GetStockPrice>      <m:StockName>IBM</m:StockName>    </m:GetStockPrice>  </soap:Body></soap:Envelope>

    My script will then take the xml, fiddle with it, and send it back via the same way.What I dont get is how my PHP script retrieves the xml from the request in the first place.Can anyone clarify this for me?Thanks,kp.

×
×
  • Create New...