dragon321723 2017-01-12 10:21
浏览 31
已采纳

too long

I want send xml like this through the soup client:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:hot="http://TekTravel/HotelBookingApi">
   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
      <hot:Credentials UserName="test" Password="test@123"/>
      <wsa:Action>http://test/HotelBookingApi/CountryListRequest</wsa:Action>
      <wsa:To>http://api.test.in/HotelAPI_V7/HotelService.svc</wsa:To>
   </soap:Header>

   <soap:Body>
      <hot:CountryListRequest/>
   </soap:Body>
</soap:Envelope>

But it send xml like this:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://TekTravel/HotelBookingApi">
    <env:Header>
        <ns1:Credentials UserName="test" Password="test@123"/>
        <ns1:Action>http://test/HotelBookingApi/HotelSearch</ns1:Action>
        <ns1:To>http://api.test.in/HotelAPI_V7/HotelService.svc</ns1:To>
    </env:Header>
    <env:Body>
        <ns1:CountryListRequest/>
    </env:Body>
</env:Envelope>

api need exact same xml like the first one.I use Laravel 5.2 and this is my code:

<?php

namespace App\Model\Hotel;

use Illuminate\Database\Eloquent\Model;

use SoapClient;
use SoapHeader;
use SoapVar;

class HotelTBO extends Model
{

    //Credentials
    var $Credentials = ['UserName' => 'test', 'Password' => 'test@123'];

    //WSDL
    var $wsdl = 'http://api.tbotechnology.in/HotelAPI_V7/HotelService.svc?wsdl';

    //Actions
    var $ActionHotelSearch = "http://TekTravel/HotelBookingApi/HotelSearch";

    //NS
    var $NS = "http://TekTravel/HotelBookingApi";

    //TO
    var $ToHotelSearch = "http://api.tbotechnology.in/HotelAPI_V7/HotelService.svc";

    public function testSearch()
    {

        $client = new SoapClient(public_path('\assets\file\TBO.wsdl'), array('soap_version' => SOAP_1_2, 'trace' => 1, "exceptions" => 0));


        $HeaderVar = new SoapVar($this->HeaderXML, XSD_ANYXML, null, null, null);

        $Headers[] = new SoapHeader($this->NS, "Credentials", $this->Credentials,false);
        $Headers[] = new SoapHeader($this->NS, "Action", $this->ActionHotelSearch);
        $Headers[] = new SoapHeader($this->NS, "To", $this->ToHotelSearch);

        $client->__setSoapHeaders($Headers);
        $result = $client->__soapCall('CountryList', []);


    }

There's a package called https://github.com/BeSimple/BeSimpleSoap but there are no any documentation for that. many thanks for the help

  • 写回答

2条回答 默认 最新

  • doufen1890 2018-06-24 13:12
    关注

    This is not possible to achieve only using php soap client.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制