开发者

Passing Variables from php to a WCF Web service, variables are blank

开发者 https://www.devze.com 2023-02-28 06:17 出处:网络
I have a WCF Service, the interfaces work fine when connecting with a c# application but when I connect using a PHP application all variables passed to the service are null.

I have a WCF Service, the interfaces work fine when connecting with a c# application but when I connect using a PHP application all variables passed to the service are null.

This is the PHP code used to connect to the service and send the data.

$SelectedFolder = $_REQUEST['folder'];
var_dump($SelectedFolder);

try 
{
    $client = new SoapClient('http://localhost:8663/Service.svc?wsdl');
    $Files = $client->GetAllLatestVersionsString($SelectedFolder);
}

The var dump displays the following

string 'Pictures/Sam开发者_JAVA技巧ple/' (length=16)

This is the service code

    [OperationContract]
    List<VersionedFileDataModel> GetAllLatestVersionsString(string partUri);

I've tried passing a static value instead of a variable and both times the value received by the service is null.

Thanks in Advance for any help,

Matt


Fixed it, I was required to pass the variables through using an array of params, for the example I posted I had to change the code to this.

try
{
    $client = new SoapClient('http://localhost:8663/Service.svc?wsdl');

    $params->partUri = $SelectedFolder;

    $Files = $client->GetAllLatestVersionsString($params);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消