Calling ASMX web service from PHP when Operations

2019-06-10 04:04发布

问题:

I have a .Net web service that has a method that accepts an Interface that I have written as a parameter. Let's call this interface ICustomer.

How would you call this method from PHP?

The method definition is

    [WebMethod]
    public string RegisterCustomer(ICustomer customer)
    {
     ...
    }

回答1:

you can create a StdClass on PHP with same attributes that in .NET.

ex:

<?php
$object = new stdClass();
$object->Name = "Test";
$object->LastName = "More tests";
$object->AnotherAttribute = "Abc";
...

$client = new SoapClient($url);
$client->__soapCall("MethodName", array('parameters' => array('customer' => $object));
...
?>

If I understand your question, is this.



回答2:

SOAP?

$client = new SoapClient($url);
$result = $client->ICustomer($param);