note 104323 added to class.soapclient
| From: | qwertyuo at inbox dot lv | Date: | Thu, 09 Jun 2011 08:24:07 +0000 |
| Subject: | note 104323 added to class.soapclient | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180348@lists.php.net to get a copy of this message | ||
I can't undersand how to transfer arguments into web service created in Visual Studio 2010
using SoapClient.
Any way if test this web service by auto generated form (To test the operation using the HTTP POST
protocol, click the 'Invoke' button.) Web service correctly get arguments, otherwise if i
do this using SoapClient web service didn't get arguments.
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.IO;
namespace myws
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public int ADDBLJA(int a, int b)
{
int rez;
rez = a + b;
StreamWriter log;
if (!File.Exists("logfile.txt"))
{
log = new StreamWriter("logfile.txt");
}
else
{
log = File.AppendText("logfile.txt");
}
log.WriteLine(DateTime.Now);
log.WriteLine(rez);
log.WriteLine(a);
log.WriteLine(b);
log.WriteLine();
log.Close();
return rez+1;
}
}
}
If i use auto-generated method to test web service than in log file i got all variables, but if i
use SoapClient in log file in all places '0â
Here is client part on PHP:
$wsdl = "http://localhost:4466/Service1.asmx?WSDL";
$wsdlopt = array('trace' => 1,'exceptions' => true,'cache_wsdl'
=> WSDL_CACHE_NONE);
echo "<pre>";
$client = new SoapClient($wsdl, $wsdlopt);
print_r($client->__getFunctions());
echo "web service result: ".$client->ADDBLJA(3,4)->ADDBLJAResult;
Itâs result:
Array
(
[0] => ADDBLJAResponse ADDBLJA(ADDBLJA $parameters)
[1] => ADDBLJAResponse ADDBLJA(ADDBLJA $parameters)
)
web service result: 1
Why methodâs type is the same as methods name I declared this as INT.
----
Server IP: 212.93.96.97
Probable Submitter: 85.254.224.25
----
Manual Page -- http://www.php.net/manual/en/class.soapclient.php
Edit -- https://master.php.net/note/edit/104323
Del: integrated -- https://master.php.net/note/delete/104323/integrated
Del: useless -- https://master.php.net/note/delete/104323/useless
Del: bad code -- https://master.php.net/note/delete/104323/bad+code
Del: spam -- https://master.php.net/note/delete/104323/spam
Del: non-english -- https://master.php.net/note/delete/104323/non-english
Del: in docs -- https://master.php.net/note/delete/104323/in+docs
Del: other reasons-- https://master.php.net/note/delete/104323
Reject -- https://master.php.net/note/reject/104323
Search -- https://master.php.net/manage/user-notes.php