1
PHPクライアントからWCFサービスを無駄に消費しようとしています。 パラメータとして「DataContract」オブジェクトを持つサービスメソッドを使用することができません。 "のCompositeType" 契約は以下PHPのパラメータとしてdataContractを使用してWCFサービスを使用する
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
:以下
[DataContract]
public class CompositeType
{
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
public bool BoolValue
{
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
public string StringValue
{
get { return stringValue; }
set { stringValue = value; }
}
}
は私が
$obj = new stdClass();
$obj->BoolValue = true;
$obj->StringValue ="Sandeep";
$parameter= array("CompositeType"=>$obj);
echo "\n";
$client = new SoapClient('http://localhost:2051/Service1.svc?wsdl');
$obj1 = $client->GetDataUsingDataContract($parameter);
print_r($obj1);
私は上記を使用
を作成したPHPクライアントされ、DataContarctがある は、ここに私のコードですNullとしてWCFに渡されました。解決策は何ですか。複合体中の
? .net 3.5、または4.0? asp.net web.configからノードを投稿してください。 –
クライアントとサーバーの両方の設定ビットを共有してください。 –