Merhaba arkadaşlar. Aras kargonun http://customerws.araskargo.com.tr/arascargoservice.asmx?WSDL servisini kullanarak kargo kaydı oluşturmak istiyorum. Soap ile yapılıyormuş ve benim bu konuda hiç bir bilgim yok. Kaç gündür bununla ilgili bilgi veya örnek dosya aramaktayım herhangi bir bilgiye neredeyse ulaşamadım. Aras kargonun paylaştığı setorder işlemleri için https://customerws.araskargo.com.tr/arascargoservice.asmx?op=SetOrder bilgiler mevcut ama bunu nasıl kullanacağım hakkında bir bilgim yok. Araştırdığım kadarıyla bir kaç satır oluşturdum ama işe yaramadı. <?php /** Aras Kargo **/ $siparisno = 12356; $alici = "Alıcı adı"; $siparisno = "1111111"; $adres = "ADRES"; $il = "Sipariş ili"; $ilce = "Sipatiş ilçe"; $tel = 0000000000; $agirlik =2; $koli = 1; $user_name = 'neodyum'; $user_pass = 'nd2580'; $service_url = 'http://customerservicestest.araskargo.com.tr/arascargoservice/arascargoservice.asmx?WSDL'; $order = array( "UserName" => $user_name, "Password" => $user_pass, "TradingWaybillNumber" => $siparisno, "InvoiceNumber" => $siparisno, "IntegrationCode" => $siparisno, "ReceiverName" => $alici, "ReceiverAddress" => $adres, "ReceiverCityName" => $il, "ReceiverTownName" => $ilce, "ReceiverPhone1" => $tel, "PayorTypeCode" => 1, "IsCod" => 0, //'Tahsilatlı (0=Hayır, 1=Evet) "PieceCount" => $koli, "CodCollectionType" => 0, //0-Nakit,1-Kredi Kartı "CodAmount" => $agirlik, "IsWorldWide" => 0,// (0=Yurtiçi, 1=Yurtdışı) ); error_reporting(1); @ini_set("soap.wsdl_cache_enabled", "0"); $send['orderInfo']['Order'] = array($order); $send['userName'] = $user_name; $send['password'] = $user_pass; $response = getSOAP($service_url, 'setOrder', $send ); if(isset($response['SetOrderResult']) ) { if(isset($response['SetOrderResult']['OrderResultInfo'])){ if($response['SetOrderResult']['OrderResultInfo']['ResultCode']==0){ $this->result['status'] = 1; echo' Kargo Kaydı Açıldı';
} else{ $this->result['status'] = 0; echo $response['SetOrderResult']['OrderResultInfo']['ResultMessage'];
}
} else{ echo 0; echo '102'; }
$response['ShippingOrderResultVO']['jobId']; } else { echo 0; echo '102'; } $service_method = "setOrder"; function getSOAP($service_url, $service_method, $send ){ if (!extension_loaded('soap')) { throw new Exception('SOAP requests is unavailable'); } try{ if($_GET['siparisno']){ echo "<br>Servis Endpoint: $service_url<br>\r\n<pre>"; echo "<br>Request data:<br>\r\n<pre>"; print_r($send); } $client = new SoapClient($service_url, array('trace' => 1, 'exceptions' => 1)); $response = $client->$service_method( $send ); if($_GET['siparisno']){ echo "<br>Response data:<br>\r\n<pre>"; print_r($response); } return json_decode(json_encode($response),1); } catch(Exception $e) { if($_GET['siparisno']){ echo "<br>Exception data:<br>\r\n"; print_r($e->getMessage()); } echo 'Kargo Servislerine Bağlanılamadı. Lütfen tekrar deneyiniz. <br>'.$e->getMessage(); }
} ?> |
Aras Kargo Entegrasyon işlemleri hakkında yardım
-
-
Merhaba arkadaşlar uzun uğraşlar sonucu belli bir aşamada ilerleyebildim. çok basit bir hata yüzünden aylardır uğraşıyorum.
url satırında http:// yerine https:// yapınca kısmen de olsa çalıştı ve ilk paylaştığım kodlarda çıkan hataları da düzeltince
sistem çalıştı. Çalşmasına çalıştı ama veriler kargo sisteminde görünmüyor. Neyse yarın tekrar kontrol edeceğim.
Çalışan kodları paylaşıyorum belki işine yarayan arkadaşlar olur.
Gerçek ortam için aşağıdaki "serviceurl, UserName ve Password "alanlarını değiştirmeyi unutmayın.
$serviceurl = "https://customerws.araskargo.com.tr/arascargoservice.asmx?WSDL";
$UserName = "Aras Kargodan aldığınız Setorder kullanıcı adınız";
$Password = "Aras kargodan aldığınız Setorder şifreniz";
```
<?php
$UserName = "neodyum";
$Password = "nd2580";
$cargoid= 1000000000000+51;
$order = array(
"UserName" => $UserName,
"Password" => $Password,
"TradingWaybillNumber" => $cargoid,
"InvoiceNumber" => $cargoid,
"ReceiverName" => 'Müşteri Adı',
"ReceiverAddress" => 'Müşteri Adres',
"ReceiverPhone1" => '00000000000',
"ReceiverCityName" => 'İl',
"ReceiverTownName" => 'İlçe',
"IntegrationCode" => $cargoid,//$order_info['shipping_city'],
"PayorTypeCode" => "1", //Gönderinin ödemesini kimin yapacağını belirler. (1=Gönderici Öder, 2=Alıcı Öder)
"IsCod" => 0, //'Tahsilatlı Kargo gönderisi (0=Hayır, 1=Evet)
"PieceCount" => 1,
"PieceDetails" => array( array("VolumetricWeight"=>"1",
"Weight"=>"1",
"BarcodeNumber"=>$cargoid,
"ProductNumber"=>$cargoid,
"Description"=>'Online Satış' )
),
"IsWorldWide" => 0,// Yurtdışı gönderisi mi (0=Yurtiçi, 1=Yurtdışı)
);
try{
$serviceurl = "https://customerservicestest.araskargo.com.tr/arascargoservice/arascargoservice.asmx?wsdl";
$client = new SoapClient($serviceurl, array('trace' => 1, 'exceptions' => 0));
$send['orderInfo']['Order'] = array($order);
$send['userName'] = $UserName;
$send['password'] = $Password;
$response = $client->SetOrder( $send );
print_r($response);
if( property_exists($response, 'SetOrderResult')){
if($response->SetOrderResult->OrderResultInfo->ResultCode==0)
{
echo' Kargo Kaydı Açıldı';
return 1;
} else {
return $response->SetOrderResult->OrderResultInfo->ResultMessage;;
echo "Bağlanamadı";
}
}
} catch(Exception $e) {
return 'ARAS Kargo Servislerine Bağlanılamadı. Lütfen tekrar deneyiniz';
}
?>
```
< Bu mesaj bu kişi tarafından değiştirildi Adroit47 -- 13 Kasım 2022; 23:56:57 >
Bu mesaj IP'si ile atılan mesajları ara Bu kullanıcının son IP'si ile atılan mesajları ara Bu mesaj IP'si ile kullanıcı ara Bu kullanıcının son IP'si ile kullanıcı ara
KAPAT X