I created a WebService in .NET on my machine with following methode:
Expand|Select|Wrap|Line Numbers
- <WebMethod(Description:="test")> _
- Public Function sayHello(ByVal myName As String, ByVal myID As Integer) As String
- Return "Hello " & myName & " (" & myID & ")"
- End Function
I can also access the function using PHP and NuSOAP however I CANNOT pass the parameters, so the result of my php page is only:
"Hello ()"
hereby is some php code I'm using:
What am I doing false:
Expand|Select|Wrap|Line Numbers
- <?php
- /*NuSOAP*/
- require_once('NuSOAP/nusoap.php');
- $proxyhost = isset( $POST['proxyhost']) ? $POST['proxyhost'] : '';
- $proxyport = isset( $POST['proxyport']) ? $POST['proxyport'] : '';
- $proxyusername = isset( $POST['proxyusername']) ? $POST['proxyusername'] : '';
- $proxypassword = isset( $POST['proxypassword']) ? $POST['proxypassword'] : '';
- $client = new soapclient('http://localhost/myWS/myWS.asmx?wsdl', true, $proxyhost, $proxyport, $proxyusername, $proxypassword);
- $err = $client->getError();
- if ($err) {
- echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
- }
- $params = 'amine';
- $result = $client->call("sayHello", $params);
- // Check for a fault
- if ($client->fault) {
- echo '<h2>Fault</h2><pre>';
- print_r($result);
- echo '</pre>';
- } else {
- // Check for errors
- $err = $client->getError();
- if ($err) {
- // Display the error
- echo '<h2>Error</h2><pre>' . $err . '</pre>';
- } else {
- // Display the result
- echo '<h2>Result</h2><pre>';
- print_r($result);
- echo '</pre>';
- }
- }
- ?>