开发者社区 问答 正文

php调用wsdl有问?报错

<?php
    header("Content-type: text/html; charset=utf-8");
    $client = new SoapClient('http://183.63.194.18:2000/TTS/Services/CodeService.svc?wsdl',array('soap_version' => SOAP_1_2));
    $actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing','Action','http://tempuri.org/ICodeService/GetCodeBatches');
    $client->__setSoapHeaders($actionHeader);
    echo '<xmp>';echo "提供的方法\n";
    print_r( $client->__getFunctions ());
    echo "相关的数据结构\n";
    print_r($client->__getTypes () );
    echo '</xmp>';
    $parameters = array( "codeId" => "208x6XBJ140000080" );
    //$res = $client->__call('GetCodeBatches',array( 'codeId' => $parameters));
    $res = $client->__call('GetCodeBatches',array('parameters' => $parameters));
    //$res = $client->GetCodeBatches($parameters);
    print_r($res);
?>

报错如下:

Fatal error: Uncaught SoapFault exception: [s:Sender] The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.Check that the sender and receiver's EndpointAddresses agree in D:\wamp\www\test.php:20 Stack trace: #0 D:\wamp\www\test.php(20): SoapClient->__call('GetCodeBatches', Array) #1 {main} thrown in D:\wamp\www\test.php on line 20"

折腾了三天了,百度上全是粘贴复制的,谷歌上又全都是C#的解决办法,我大php木有...求高手解决



展开
收起
爱吃鱼的程序员 2020-06-20 16:50:03 600 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    你这SOAP调用写得可真挫!

    看看我写的例子吧。

    http://www.oschina.net/question/1539302_159239

    需要调用SOAP方法,最好用classmap的方式,尤其是在和.NET和Java等非PHP的面向对象的语言交互时。网上看到的例子大多数都是PHP调用PHP的webservice,这种就没什么意义了...

    引用来自“南湖船老大”的评论

    你这SOAP调用写得可真挫!

    看看我写的例子吧。

    http://www.oschina.net/question/1539302_159239

    需要调用SOAP方法,最好用classmap的方式,尤其是在和.NET和Java等非PHP的面向对象的语言交互时。网上看到的例子大多数都是PHP调用PHP的webservice,这种就没什么意义了...

    soapUI用起,抓包

    引用来自“南湖船老大”的评论

    soapUI用起,抓包无敌了
    2020-06-20 16:50:20
    赞同 展开评论
问答分类:
问答标签:
问答地址: