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 20982
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: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
| |