从PHP客户端向asp.net webservice发布一个int总是0

Hi I seem have created a SOAP webservice using asp.net , and tested it using an PHP client to get data.And it seems for getting data the service works.

THe problem appears when I try to post the data.It seems that the server always recieve the value 0.Here is my asp.net web service code:

public void DeleteBook(int categoryId)
    {
        using (var conn = new OdbcConnection(connectionString))
        {
            conn.Open();
            using (var command = new OdbcCommand())
            {
                command.Parameters.Add(new OdbcParameter("@CategoryId", categoryId));
                command.CommandText = "DELETE FROM Books WHERE CategoryId = @CategoryId";
                command.ExecuteNonQuery();
            }
        }
    }

And here is my PHP Soap client code:

  $client = new SoapClient($url);
  if(isset($_POST["id"])){
            $id = $_POST["id"];
            echo $id;
            $client->DeleteBook($id);
   }

I debugged the service and it seems the DeleteBook method get's hit but the problem is that the categoryId is 0.

What am I doing wrong?

Hi I managed to solve this problem by actualy sending the parameter as an array.This is what I have done and it worked:

if(isset($_POST["id"])){
        $id = $_POST["id"];
        $obj = array("categoryId" => $id);
        $client->DeleteBook($obj);
}

You will need to convert the string to an integer. You can do this either on the client or server side.

Try writing (int) $id in your PHP code, does this do the trick?

 $client = new SoapClient($url);
  if(isset($_POST["id"])){
        $id = (int) $_POST["id"];
        echo $id;
        $client->DeleteBook($id);
  }

I think that anything that can't be parsed to a integer will be 0.