Page tree
Skip to end of metadata
Go to start of metadata

Русская версия

PHP client

Php sample
<?php
                ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
                ini_set("default_charset", "utf-8");     // русский текст для проверки UTF-8
                mb_internal_encoding("UTF-8");

                $client = new SoapClient("https://svc-api.p2e.ru/UI_Service.svc?singleWsdl", array( "cache_wsdl" => 0, "trace" => 1, "exceptions" => 0)); 

                /* Для функции SubmitRequest */
                $chk_query = new StdClass();
                $chk_query->accesskey = '8C0D2EFB-5A03-4B76-9CBD-0DC5C0401536';
                $chk_query->requestBody = '<?xml version="1.0" encoding="utf-8"?>
                                           <Request xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="HistoryRequest">
                                                    <Id>3</Id>
                                                    <DateFrom>2013-11-03T00:00:00+04:00</DateFrom>
                                                    <DateTo>2013-12-04T00:00:00+04:00</DateTo>
                                           </Request>';

                try{
                                $result = $client->SubmitRequest($chk_query);
                               print_r ($result);
                }              
                catch (SOAPFault $f){
                               echo $f;
                }
?>



.NET client

To access the API from .NET, you need to use the standard technology for accessing WCF services for .NET.
In Visual Studio, through the Add Service Reference, you connect to the WCF URL. In this case, proxy classes are automatically generated.
Next, use these classes.

C# sample
public string OrderStatusRequest()
{
    ServiceReference1.UI_ServiceClient srv = new ServiceReference1.UI_ServiceClient();
    Guid accesskey =  new Guid("here you need to specify the access key");
    string requestBody = File.ReadAllText("Requests\\OrderStatusRequest.xml", Encoding.UTF8);
    string res = srv.SubmitRequest(accesskey, requestBody);
    return res;
}



  • No labels