編集:いくつかの調査の後、問題に対する答えを見つけました(少なくとも、私の特定の状況では機能します)。下記の登録呼び出しの代わりに、次の呼び出しを使用しています。
$soap->register(
'MyFunction',
array('inputData' => 'xsd:string'),
array('outputData' => 'xsd:string'),
$namespace,
$namespace . "#MyFunction",
"rpc",
"literal",
"My description.");
「rpc」と「literal」の引数が成功の鍵だと思います。うまくいけば、これは同じ問題に直面している他のユーザーの助けになるでしょう.
Silverlight アプリケーションが NuSoap サービスからデータを要求する新しいプロジェクトに問題があります。この統合は私にとってかなり新しいものであり、残念ながら、このトピックに関する多くのリソースがインターネット上で見つからないため (少なくとも私の問題に対処するものはありません)、誰かが私を正しい方向に向けることができることを願っています.
NuSoap 部分は次のように実装されます。
<?php
require_once('../soap/nusoap/nusoap.php');
$namespace = "http://127.0.0.1/adminSoap";
$soap = new Soap_Server();
$soap->configureWSDL('MyService', $namespace);
$soap->wsdl->schemaTargetNameSpace = $namespace;
$soap->soap_defencoding = 'utf-8';
$soap->register(
'MyFunction',
array('inputData' => 'xsd:string'),
array('outputData' => 'xsd:string'),
$namespace
);
$soap->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
function MyFunction($inputData)
{
return "ok";
}
?>
次に、このサービスへの Web 参照を追加し、サービス、その ServicePortType、および "MyFunction" を選択できるダイアログを取得します。
ただし、参照を生成すると、自動的に生成された MyFunction の非同期メッセージ (つまり、MyFunctionAsync と MyFunctionCompleted.event) が見つかると想定します。これらは存在しません。
私は何が間違っているのでしょうか。クライアントを設定するコードは次のとおりです。
ServiceReference4.MyServicePortTypeClient client = new SilverlightTest1.ServiceReference4.MyServicePortTypeClient();
非同期メソッドが利用できない理由はありますか?
生成された WSDL は次のとおりです。参考になれば、ところで (ハイフンは IE からのコピー/貼り付けによるものです):
<definitions targetNamespace="http://127.0.0.1/adminSoap">
−
<types>
−
<xsd:schema targetNamespace="http://127.0.0.1/adminSoap">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:schema>
</types>
−
<message name="MyFunctionRequest">
<part name="affiliate" type="xsd:string"/>
</message>
−
<message name="MyFunctionResponse">
<part name="result" type="xsd:string"/>
</message>
−
<portType name="MyServicePortType">
−
<operation name="MyFunction">
<input message="tns:MyFunctionRequest"/>
<output message="tns:MyFunctionResponse"/>
</operation>
</portType>
−
<binding name="MyServiceBinding" type="tns:MyServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="MyFunction">
<soap:operation soapAction="http://127.0.0.1/magento/adminSoap/SoapStatsService.php/MyFunction" style="rpc"/>
−
<input>
<soap:body use="encoded" namespace="http://127.0.0.1/adminSoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body use="encoded" namespace="http://127.0.0.1/adminSoap" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
−
<service name="MyService">
−
<port name="MyServicePort" binding="tns:MyServiceBinding">
<soap:address location="http://127.0.0.1/magento/adminSoap/SoapStatsService.php"/>
</port>
</service>
</definitions>