شروع سریع

در این صفحه اولین درخواست خود به سرویس کد را می‌فرستید: از گرفتن شناسهٔ کاربری تا ارسال یک پیام SOAP موفق.

۱. پیش‌نیازها

۲. اطلاعات اتصال

Endpoint
http://ws.logito.ir/Cod.svc
متد HTTP
POST
Content-Type
text/xml; charset=utf-8
نسخه SOAP
SOAP 1.1

آدرس WSDL برای مشاهدهٔ کامل قرارداد سرویس: http://ws.logito.ir/Cod.svc?wsdl

۳. قالب کلی پیام

هر درخواست یک Envelope است. برخلاف بسیاری از سرویس‌ها، احراز هویت در Header نیست؛ نام کاربری و رمز در عنصر credential داخل Body قرار می‌گیرند و Header خالی می‌ماند.

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:tem="http://tempuri.org/"
            xmlns:cod="http://schemas.datacontract.org/2004/07/Cod.WebService.Models">
  <s:Header/>
  <s:Body>
    <tem:CreateOrder>
      <tem:credential>
        <cod:Username>your_username</cod:Username>
        <cod:Password>your_password</cod:Password>
      </tem:credential>
      <!-- سایر پارامترها ... -->
    </tem:CreateOrder>
  </s:Body>
</s:Envelope>

۴. هدرهای HTTP

هدرمقدار
Content-Typetext/xml; charset=utf-8
SOAPAction"http://tempuri.org/Cod/CreateOrder"

۵. اولین فراخوانی با PHP

<?php
$endpoint = 'http://ws.logito.ir/Cod.svc';
$username = 'your_username';
$password = 'your_password';

$xml = '<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:tem="http://tempuri.org/"
            xmlns:cod="http://schemas.datacontract.org/2004/07/Cod.WebService.Models">
  <s:Header/>
  <s:Body>
    <tem:CreateOrder>
      <tem:credential>
        <cod:Username>' . $username . '</cod:Username>
        <cod:Password>' . $password . '</cod:Password>
      </tem:credential>
    </tem:CreateOrder>
  </s:Body>
</s:Envelope>';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: text/xml; charset=utf-8',
    'SOAPAction: "http://tempuri.org/Cod/CreateOrder"',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
if (curl_errno($ch)) { echo 'cURL error: ' . curl_error($ch); exit; }
curl_close($ch);

echo $response;

۶. گام‌های بعدی