编辑:经过一些研究,我找到了这个问题的答案(至少它对我的特殊情况有用)。我现在使用的不是下面记录的注册呼叫,而是使用以下调用:
$soap->register(
'MyFunction',
array('inputData' => 'xsd:string'),
array('outputData' => 'xsd:string'),
$namespace,
$namespace . "#MyFunction",
"rpc",
"literal",
"My description.");我想"rpc“和”文字“参数是成功的关键。希望这能帮助其他一些面临同样问题的用户。
我遇到了一个新项目的问题,其中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>发布于 2009-12-07 05:32:08
我正在处理一个类似的问题。我使用的是Zend_Soap (它只是封装PHP扩展),并使用Silverlight服务引用连接到它。似乎Silverlight服务实现不能使我们使用soap编码的操作。如果您看一下WSDL下面的每一个有一个和。在这些标签中,我们都有令人沮丧的特质。Use=“编码”和encodingStyle="blah,blah“属性。
我现在知道Zend_Soap只会使用soap编码进行绑定。我还不确定nuSoap的情况。
如果您可以更改PHP后端,您可能会查看午夜编码器WebORB for PHP和Silverlight。它包括服务器和客户端一起工作的解决方案。在某些情况下是免费的。由于许可证问题,我不能.我不能.
https://stackoverflow.com/questions/1812298
复制相似问题