Yii2 测试 yii2-soap 的问题

weixin_38063619 2019-09-11 03:32:43
wsdl <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="https://store.fdimall.com/v1/apis/index?ws=1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="api.modules.v1.controllers.ApiController" targetNamespace="https://store.fdimall.com/v1/apis/index?ws=1"> <types> <xsd:schema targetNamespace="https://store.fdimall.com/v1/apis/index?ws=1"> <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> </xsd:schema> </types> <portType name="api.modules.v1.controllers.ApiControllerPort"> <operation name="actionHello"> <input message="tns:actionHelloIn"/> <output message="tns:actionHelloOut"/> </operation> </portType> <binding name="api.modules.v1.controllers.ApiControllerBinding" type="tns:api.modules.v1.controllers.ApiControllerPort"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="actionHello"> <soap:operation soapAction="https://store.fdimall.com/v1/apis/index?ws=1#actionHello"/> <input> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://store.fdimall.com/v1/apis/index?ws=1"/> </input> <output> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="https://store.fdimall.com/v1/apis/index?ws=1"/> </output> </operation> </binding> <service name="api.modules.v1.controllers.ApiControllerService"> <port name="api.modules.v1.controllers.ApiControllerPort" binding="tns:api.modules.v1.controllers.ApiControllerBinding"> <soap:address location="https://store.fdimall.com/v1/apis/index?ws=1"/> </port> </service> <message name="actionHelloIn"/> <message name="actionHelloOut"> <part name="return" type="xsd:string"/> </message> </definitions> 调用 public function actionHello(){ ini_set("soap.wsdl_cache_enabled", "0"); $client = new \SoapClient('https://store.fdimall.com/v1/apis/index'); return $client->hello('Alex'); } 报错提示 { "name": "Exception", "message": "Function (\"hello\") is not a valid method for this service", "code": 0, "type": "SoapFault", "file": "/www/wwwroot/munx/api/modules/v1/controllers/GroupController.php", "line": 48, "stack-trace": [ "#0 /www/wwwroot/munx/api/modules/v1/controllers/GroupController.php(48): SoapClient->__call('hello', Array)", "#1 [internal function]: api\\modules\\v1\\controllers\\GroupController->actionHello()", "#2 /www/wwwroot/munx/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)", "#3 /www/wwwroot/munx/vendor/yiisoft/yii2/base/Controller.php(157): yii\\base\\InlineAction->runWithParams(Array)", "#4 /www/wwwroot/munx/vendor/yiisoft/yii2/base/Module.php(528): yii\\base\\Controller->runAction('hello', Array)", "#5 /www/wwwroot/munx/vendor/yiisoft/yii2/web/Application.php(103): yii\\base\\Module->runAction('v1/group/hello', Array)", "#6 /www/wwwroot/munx/vendor/yiisoft/yii2/base/Application.php(386): yii\\web\\Application->handleRequest(Object(yii\\web\\Request))", "#7 /www/wwwroot/munx/api/web/index.php(17): yii\\base\\Application->run()", "#8 {main}" ] }
...全文
53 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38067822 2019-09-11
  • 打赏
  • 举报
回复
代码应该 没什么问题,很大的可能是 你的链接返回的 wsdl内容 格式不正确https://store.fdimall.com/v1/apis/index 这个地址 不知道是不是你的 真实地址,现在是一个 报错页面,望 尽快解决

476

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧