Hello People,
I created a WebService in .NET on my machine with following methode: - <WebMethod(Description:="test")> _
-
Public Function sayHello(ByVal myName As String, ByVal myID As Integer) As String
-
Return "Hello " & myName & " (" & myID & ")"
-
End Function
-
Web service works fine, I can access my function in .NET without problem.
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: - <?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>';
-
}
-
}
-
?>
-
6 20981
amine,
I believe that the problem is in the way you set your parameters, they need to be set as named values and wrapped in an outer "parameters" array for .Net. -
-
$client = new soapclient('http://localhost/myWS/myWS.asmx?wsdl', true, $proxyhost, $proxyport, $proxyusername, $proxypassword);
-
$err = $client->getError();
-
$params = array('parameters' => array ('name' => 'amine'));
-
$result = $client->call("sayHello", $params);
-
-
the parameter $$params = 'amine'; must be passed as an array not a string.
Hello People,
I created a WebService in .NET on my machine with following methode: - <WebMethod(Description:="test")> _
-
Public Function sayHello(ByVal myName As String, ByVal myID As Integer) As String
-
Return "Hello " & myName & " (" & myID & ")"
-
End Function
-
Web service works fine, I can access my function in .NET without problem.
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: - <?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>';
-
}
-
}
-
?>
-
use this. it worked for me
$params =array( 'parametername' => 'amine' );
$result = $client->call("sayHello", array('parameters' => $param));
Hello People,
I created a WebService in .NET on my machine with following methode: - <WebMethod(Description:="test")> _
-
Public Function sayHello(ByVal myName As String, ByVal myID As Integer) As String
-
Return "Hello " & myName & " (" & myID & ")"
-
End Function
-
Web service works fine, I can access my function in .NET without problem.
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: - <?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>';
-
}
-
}
-
?>
-
Hello
I did two web services manageSession.asmx and manageStaff.asmx
I consume them with nusoap, first start session, sencond try to get the staff list but it displays The session is not set, .net pages I have solved the problem but in php no.
All your help is wellcome
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Arne Holderbeke |
last post by:
I'm doing my final project in PHP with a Soap webservice
In the client script (PHP) 3 files are read into a string
these strings and the name of the 3 files need to be passed to the
webservice
(...
|
by: olafmol |
last post by:
Hello,
i have a problem using a .NET WSDL Webservice from PHP. Using both the
NuSOAP lib for PHP4, and the build-in SOAP lib for PHP5 it seems that the
SOAP client cannot pass a variable amount...
|
by: Carlos Lozano |
last post by:
Hi,
as a background I have an Windows application developed with VS 2003 (c#)
that needs to transfer securely data to a MySQL database located on a Linux
server.
I have created a PHP...
|
by: Nattydreadlock |
last post by:
Hi,
I've written an ASP.Net webservice which takes somes specific .net
objects.
Now I want to caal this service by PHP, which normally would be
possible, after all that's the main reason of...
|
by: Preben Zacho |
last post by:
Anyone that has a link or description that simply as possible shows how to
add a web reference to a class library in C# and consuming it?
TIA
PZ
|
by: Boni |
last post by:
I want consuming a webserivce trough a proxy. I use this code.
myService s = new myService ();
System.Net.WebProxy proxyObject = new
System.Net.WebProxy("http://proxyhost:8080");
s.Proxy =...
|
by: luftikus143 |
last post by:
Hi there,
we have successfully running a webservice wrapped with the NuSoap.php libs since quite a while. Now, a colleague of mine in another institution would like to use this webservice. But he...
|
by: luftikus143 |
last post by:
Hi there,
we have successfully running a webservice wrapped with the NuSoap.php libs since quite a while. Now, a colleague of mine in another institution would like to use this webservice. But he...
|
by: aswathip |
last post by:
I am doing a Webservice in PHP for the first time. I have a service named as testWebService.php and testclient.php that consumes the service. Below is my testclient.php
<?php
require_once...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |