大家好日子, 我想知道是否有办法从php客户端调用soap wcf服务的多个参数的功能?
我知道您可以将参数嵌入到数组中,然后调用函数。但遗憾的是我需要编写一个与现有php客户端兼容的服务。那些用单独的参数调用函数。 所以我需要回应这样的请求:
$soapClient = new SoapClient('http://myService?wsdl', $options);
$param1 = 1;
$param2 = 2;
$soapClient->doGoodThingsInTheNameOfTheMoon($param1, $param2);
但是我写的wcf服务只能响应
$soapClient = new SoapClient('http://myService?wsdl', $options);
$soapClient->doGoodThingsInTheNameOfTheMoon(array("param1"=>1,"param2"=> 2));
我的服务如下:
[ServiceContract]
public interface ImyserviceBinding
{
[OperationContract]
bool doGoodThingsInTheNameOfTheMoon(Param param1, Param param2);
}
由数据类型
设置[DataContract]
和[DataMember]
属性
所以我需要降级到特定的wcf版本?或者在* .config文件中指定一些行为?
的web.config:
<configuration>
<appSettings/>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyServiceTypeBehaviors" name="myService.myService">
<endpoint address="" binding="basicHttpBinding"
contract="ImyserviceBinding" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:60000/myService.svc" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="false"/>
</system.webServer>
</configuration>
感谢您的任何建议!