Android Question HttpJob Post Error only on mobile

svitol

Member
Hi, i normally call webservice api rest of Magento with php and pass into url Api Secret and token magento into Header.
Into post string i pass the json .
The HttpJob return Error with errorMessage empty.
I don't know where is the problem.
Thi is my php code:
PHP:
<?php  
$tokenMagento = "tokenMagentoSecret";
$tokenPartner = "mytokenSecret";

error_reporting(0);


$ch = curl_init("https://myurl...it/rest/V1/edico-partner-products/" . $tokenPartner);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:application/json", "Authorization: Bearer " . $tokenMagento));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
$dataToSend = [
"filters" => [
[
"field" => "sku",
"value" => "SCH00%",
"condition_type" => "like"
]
]
];

var_dump(json_encode($dataToSend));
echo "<br>";
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($dataToSend));

$result = json_decode(curl_exec($ch), true)[0];
var_dump($result);

$error = curl_error($ch);
var_dump($error);

if (!empty($error)) {
    echo "Errore: " . PHP_EOL;
    var_dump($error);
} else {
   
    echo "<pre>";
    print_r($result['items_count']);
    echo "</pre><br>";
   
    echo "<pre>";
    print_r($result['error_message']);
    echo "</pre><br>";
   
    echo "<pre>";
    print_r($result['products']);
    echo "</pre><br>";

    if (!empty($result['error_message'])) {
        echo "Messaggio di Errore: " . PHP_EOL;
        var_dump($result['error_message']);
    }
   
}

curl_close($ch);
?>



This is my B4A code:

B4X:
Dim j As HttpJob
        j.Initialize("",Me)
       
        Dim job As HttpJob
        Dim url As String = "https://myurl...it/rest/V1/edico-partner-products/tokenPartner/"
       

        Dim json1 As Map
        json1.Initialize
       
   
        Dim filters As List
        filters.Initialize
       
        Dim field As Map
        field.Initialize
        field.Put("field","sku")
        field.Put("condition_type","like")
        field.Put("value","SCH00%")
        filters.Add(field)
       
   
        json1.Put("filters",filters)
       
        Dim jgen As JSONGenerator
        jgen.Initialize(json1)
        Log(jgen.ToPrettyString(2))
        Log(jgen.ToString)
       
       
       
        j.PostString(url, jgen.ToString)
   
        j.GetRequest.SetHeader("Authorization", "Bearer " & token)
        j.GetRequest.SetContentType("application/json")
 

svitol

Member
B4X:
 ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-47 f=2472 sc=100 link=72 tx=76,2, 0,0, 0,0  rx=74,2 bcn=0 [on:0 tx:0 rx:0 period:3001] from screen [on:0 period:1838781906] gl hn u24 rssi=-42 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
 L2ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-47 f=2472 sc=100 link=72 tx=76,2, 0,0, 0,0  rx=74,2 bcn=0 [on:0 tx:0 rx:0 period:2] from screen [on:0 period:1838781908] gl hn u24 rssi=-42 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
fetchRssiLinkSpeedAndFrequencyNative rssi=-50 linkspeed=72 SSID="NETGEAR09"
calculateWifiScore freq=2472 speed=72 score=100 highRSSI  -> txbadrate=0,00 txgoodrate=38,61 txretriesrate=0,00 rxrate=37,08 userTriggerdPenalty0
 good link -> stuck count =0
 badRSSI count0 lowRSSI count0 --> score 60
 isHighRSSI       ---> score=65
 ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-50 f=2472 sc=100 link=72 tx=38,6, 0,0, 0,0  rx=37,1 bcn=0 [on:0 tx:0 rx:0 period:3004] from screen [on:0 period:1838784917] gl hn u24 rssi=-45 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
 L2ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-50 f=2472 sc=100 link=72 tx=38,6, 0,0, 0,0  rx=37,1 bcn=0 [on:0 tx:0 rx:0 period:2] from screen [on:0 period:1838784919] gl hn u24 rssi=-45 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
fetchRssiLinkSpeedAndFrequencyNative rssi=-49 linkspeed=72 SSID="NETGEAR09"
calculateWifiScore freq=2472 speed=72 score=100 highRSSI  -> txbadrate=0,00 txgoodrate=19,80 txretriesrate=0,00 rxrate=18,54 userTriggerdPenalty0
 good link -> stuck count =0
 badRSSI count0 lowRSSI count0 --> score 60
 isHighRSSI       ---> score=65
BgPowerManagerService:BgPowerManagerSerivce plugged =2 currentThreshold = 8 mRawLevel = 73mLastRawLevel73
BgPowerManagerService: mTimes = 30546 firstTime = 324244390 firstmBatteryCapacity =1643
 ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-49 f=2472 sc=100 link=72 tx=19,8, 0,0, 0,0  rx=18,5 bcn=0 [on:0 tx:0 rx:0 period:3000] from screen [on:0 period:1838787926] gl hn u24 rssi=-44 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
 L2ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-49 f=2472 sc=100 link=72 tx=19,8, 0,0, 0,0  rx=18,5 bcn=0 [on:0 tx:0 rx:0 period:2] from screen [on:0 period:1838787928] gl hn u24 rssi=-44 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
fetchRssiLinkSpeedAndFrequencyNative rssi=-48 linkspeed=72 SSID="NETGEAR09"
calculateWifiScore freq=2472 speed=72 score=100 highRSSI  -> txbadrate=0,00 txgoodrate=9,90 txretriesrate=0,00 rxrate=9,27 userTriggerdPenalty0
 good link -> stuck count =0
 badRSSI count0 lowRSSI count0 --> score 60
 isHighRSSI       ---> score=65
Error:
hw_status_bar_operators = true, setSystemUIVisibily(SHOW_OPERATOR = false)
*** Service (httputils2service) Create ***
Can not find class: Landroid/net/ssl/SSLSockets;
** Service (httputils2service) Start **
core_booster, getBoosterConfig = false
core_booster, getBoosterConfig = false
init failed when open zip file.
 ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-48 f=2472 sc=100 link=72 tx=9,9, 0,0, 0,0  rx=9,3 bcn=0 [on:0 tx:0 rx:0 period:3007] from screen [on:0 period:1838790939] gl hn u24 rssi=-43 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
 L2ConnectedState !CMD_RSSI_POLL 177 0 "NETGEAR09" 10:da:43:e6:f6:6c rssi=-48 f=2472 sc=100 link=72 tx=9,9, 0,0, 0,0  rx=9,3 bcn=0 [on:0 tx:0 rx:0 period:4] from screen [on:0 period:1838790943] gl hn u24 rssi=-43 ag=0 hr ticks 0,0,0 ls-=0 [56,56,60,60,65] brc=0 lrc=0
fetchRssiLinkSpeedAndFrequencyNative rssi=-49 linkspeed=72 SSID="NETGEAR09"
calculateWifiScore freq=2472 speed=72 score=100 highRSSI  -> txbadrate=0,00 txgoodrate=13,45 txretriesrate=0,00 rxrate=12,14 userTriggerdPenalty0
 good link -> stuck count =0
 badRSSI count0 lowRSSI count0 --> score 60
 isHighRSSI       ---> score=65
wlan0: HEART-BEAT-ACK: 6066
WifiMonitor:wlan0 cnt=11395 dispatchEvent: HEART-BEAT-ACK: 6066
 
Upvote 0
Top