简体   繁体   中英

Send soap xml data in php

Please how can I send the following xml to a remote webservice( * */quick.svc?wsdl) using soap in php

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:quic="http://services.interswitchng.com/quicktellerservice/">
   <soapenv:Header/>
   <soapenv:Body>
      <quic:SendBillPaymentAdvice>
         <!--Optional:-->
         <quic:xmlParams>
         <![CDATA[<BillPaymentAdvice>
    <Amount>10000</Amount>
    <PaymentCode>145536</PaymentCode>
    <CustomerMobile>0856534</CustomerMobile>
    <CustomerEmail>luvysols@gmail.com</CustomerEmail>
    <CustomerId>Trdfg001</CustomerId>
    <TerminalId>2323001</TerminalId>
    <RequestReference>123456789</RequestReference>
    </BillPaymentAdvice>]]>
         </quic:xmlParams>
      </quic:SendBillPaymentAdvice>
   </soapenv:Body>
</soapenv:Envelope>

The SoapClient class provides a client for SOAP 1.1 , SOAP 1.2 servers. It can be used in WSDL or non-WSDL mode.

$url         = "";
$client     = new SoapClient($url, array("trace" => 1, "exception" => 0)); 

Ref: http://php.net/manual/en/class.soapclient.php

First Include the nusoap.php and after it add this code.

$sen_code='XML CODE';
$client->debug($headers,$sen_code);
$client->decode_utf8 = FALSE;
$rel_lgoin = $client->call('method_for_call');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM