脚本宝典收集整理的这篇文章主要介绍了.net – 使用PHP客户端的WCF服务 – 复杂类型作为参数不起作用,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
示例自定义类型:
_
公共类MyClass
PRivate _proPErtyA As Double <Datamember()> _ Public Property PropertyA() As Double Get Return _propertyA End Get Set(ByVal value As Double) _propertyA = value End Set End Property Private _propertyB As Double <DataMember()> _ Public Property PropertyB() As Double Get Return _propertyB End Get Set(ByVal value As Double) _propertyB = value End Set End Property Private _propertyC As Date <DataMember()> _ Public Property PropertyC() As Date Get Return _propertyC End Get Set(ByVal value As Date) _propertyC = value End Set End Property
结束班
方法:
公共函数Add(ByVal param As MyClass)As Boolean Implements IService1.Add
‘…
结束功能
$客户端 – >添加(阵列( ‘PARAM’=>阵列(
‘PropertyA’=> 1,
‘PropertyB’=> 2,
‘PropertyC’=> “2009-01-01”
)));
WCF服务适用于.Net客户端,但我是PHP的新手,无法使其工作.
任何帮助,将不胜感激.
注意:我使用的是PHP 5(适用于Windows的XAMPP 1.7.0).
谢谢
马特
PHP:
$wsdl = "https://....../ServiceName.svc?wsdl"; $endpoint = "https://...../ServiceName.svc/endpointName"; $client = new SoapClient($wsdl,array('location'=>$endpoint)); $container = new stdClass(); $container->request->PropertyA = 'test 1'; $container->request->PropertyB = 'Test 2'; $container->request->PropertyC = '05/10/2010'; $response = $client->ServiceMethodA($container);
request是Web服务所需参数的名称.
如果您具有引用其他自定义类型的自定义类型,则可以按如下方式设置这些属性:
$container->request->OtherCustomType->Property1 = 'Test';
希望有所帮助.
以上是脚本宝典为你收集整理的.net – 使用PHP客户端的WCF服务 – 复杂类型作为参数不起作用全部内容,希望文章能够帮你解决.net – 使用PHP客户端的WCF服务 – 复杂类型作为参数不起作用所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。