I\'m used to writing PHP code, but do not often use Object-Oriented coding. I now need to interact with SOAP (as a client) and am not able to get the syntax right. I\'ve got
I tried to recreate the situation...
WebMethod called Function1 expecting the following params: Function1(Contact Contact, string description, int amount)
Where Contact is just a model that has getters and setters for id and name like in your case.
You can download the .NET sample WS at:
https://www.dropbox.com/s/6pz1w94a52o5xah/11593623.zip
This is what you need to do at PHP side:
(Tested and working)
id = $id;
$this->name = $name;
}
}
// Initialize WS with the WSDL
$client = new SoapClient("http://localhost:10139/Service1.asmx?wsdl");
// Create Contact obj
$contact = new Contact(100, "John");
// Set request params
$params = array(
"Contact" => $contact,
"description" => "Barrel of Oil",
"amount" => 500,
);
// Invoke WS method (Function1) with the request params
$response = $client->__soapCall("Function1", array($params));
// Print WS response
var_dump($response);
?>
print_r($params) you will see the following output, as your WS would expect:Array ( [Contact] => Contact Object ( [id] => 100 [name] => John ) [description] => Barrel of Oil [amount] => 500 )

(As you can see, Contact object is not null nor the other params. That means your request was successfully done from PHP side)
object(stdClass)[3] public 'Function1Result' => string 'Detailed information of your request! id: 100, name: John, description: Barrel of Oil, amount: 500' (length=98)
Happy Coding!