1

Below is soaporderapi.php created root folder.It is working fine getting order responce but i need to show responce as xml format

<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

require('vendor/zendframework/zend-server/src/Client.php');
require('vendor/zendframework/zend-soap/src/Client.php');
require('vendor/zendframework/zend-soap/src/Client/Common.php');

$wsdlurl = 'https://magento2.com/index.php/soap/default?wsdl&services=salesOrderRepositoryV1';

$token = 'vvqicf96h5hp3tv03s472jaidg16xapd';


$opts = ['http' => ['header' => "Authorization: Bearer ".$token]];
$context = stream_context_create($opts);

$serviceArgs = array('searchCriteria'=> 
    array('filterGroups' => 
        [ 
            array ('filters' => 
                [
                    array('field' =>'increment_id',
                          'value' => '000000055', 
                          'condition_type' => 'eq')
                ]
            )
        ]
    )
);
$soapClient = new \Zend\Soap\Client($wsdlurl);
$soapClient->setSoapVersion(SOAP_1_2);
$soapClient->setStreamContext($context);
$result = $soapClient->salesOrderRepositoryV1GetList($serviceArgs);//array('searchCriteria' => $serviceArgs));

echo "<pre>"; print_r($result); 

https://magento2.com/ordersoapapi.php I am excuting file like this getting array object format

  • and what's the question? – Marius Feb 28 at 11:20
  • @Marius Updated my question need to api responce as a xml format – Pawankumar Feb 28 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.