Jump to content

SOAP -- Bad Request Issue


dragunu

Recommended Posts

Greeting,

 

I am trying to create a SOAP server , using PHP 5.0.4.

 

I am using the following code for the server:

 

<?php //server.php
function soaputils_autoFindSoapRequest()    {
    global $HTTP_RAW_POST_DATA;

    if($HTTP_RAW_POST_DATA)
        return $HTTP_RAW_POST_DATA;

    $f = file("php://input");
    return implode(" ", $f);
}

function getItemCount($upc){
$items = array('12345'=>5,'19283'=>100,'23489'=>234);
return $items[$upc];
}

ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("inventory.wsdl",array('location' => "http://localhost/test2/server.php"));
$server->addFunction("getItemCount");
$server->handle(soaputils_autoFindSoapRequest());
?>

 

At first I used to have the Bad Request. Can't find HTTP_RAW_POST_DATA, but then , this was fixed by adding the soaputils function. However, when I try to run the server now,

I am getting a SOAP-ENV:Bad Request.

 

Can anyone suggest a workaround please?

 

Regards,

drg

 

 

Link to comment
https://forums.phpfreaks.com/topic/106596-soap-bad-request-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.