duanduanxi9441 2015-10-08 10:08
浏览 68

使用Soapclient设置标头肥皂请求

I need some help making a soap header with soapclient. The header for the request is as follows:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/IToken/...</a:Action>
<a:MessageID>urn:uuid:...</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">http://...</a:To>
</s:Header>

I´ve tried to make the same request with curl and it is working, but now I need to make it with SoapClient and I can´t understand why I can´t do it with SoapClient. The error i get is always this Uncaught SoapFault exception: [s:Sender] The SOAP action specified on the message, '', does not match the HTTP SOAP Action or Bad request. I´ve tried a lot of things and I´m on this for two days. Any help would be much appreciated.

  • 写回答

1条回答 默认 最新

  • dqb78642 2016-01-20 22:24
    关注

    You can extend the SoapClient into your own class. Then override __doRequest like below:

    public function __doRequest($request , $location , $action , $version, $one_way = 0 )
    {
        $request = <mix your header into the $request somehow>;
        return parent::__doRequest($request, $location, $action , $version, $one_way);
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算