Monday, 18 December 2017

call soap webservice from php or consume asmx service

I'm using a method using SoapClient class in a php page to call a web service in an asp.net site.

$myParams = array('intA' => 1, 'intB' => 2);

$client = new SoapClient("http://www.dneonline.com/calculator.asmx?WSDL");
$result = $client->Add($myParams);
var_dump($result);


The SoapClient class provides a client for » SOAP 1.1, » SOAP 1.2 servers. It can be used in WSDL or non-WSDL mode.
 SoapClient {
/* Methods */
public mixed __call ( string $function_name , string $arguments )
public SoapClient ( mixed $wsdl [, array $options ] )
public string __doRequest ( string $request , string $location , string $action , int $version [, int $one_way = 0 ] )
public array __getFunctions ( void )
public string __getLastRequest ( void )
public string __getLastRequestHeaders ( void )
public string __getLastResponse ( void )
public string __getLastResponseHeaders ( void )
public array __getTypes ( void )
public void __setCookie ( string $name [, string $value ] )
public string __setLocation ([ string $new_location ] )
public bool __setSoapHeaders ([ mixed $soapheaders ] )
public mixed __soapCall ( string $function_name , array $arguments [, array $options [, mixed $input_headers [, array &$output_headers ]]] )
public SoapClient ( mixed $wsdl [, array $options ] )
}

Wednesday, 25 October 2017

how to hide ajax requests from firebug console

we use an image attach to body tag
masoffer_order_info = {
  transaction_id: '',
  offer_id: '',
  transaction_time: , // 1447388224436
  signature: '',
  /*transaction_discount: 100000, */
  traffic_id: Cookies.get('mp_traffic_id'),
  
  products: [
   $value)
        {
            $i++;
            //if ($key == 'totalSanPham') continue;
            $product3 = $value;
     ?>
     {
        id: '',
        sku: '',
        url: 'http://myphamchonam.com',
        price: ,
        name: '',
        category: '',
        category_id : ,
        status_code: 0,
        quantity: 
    }
      
     
      
    
  ]
};

}


var MasOffer = {
    transaction: function (x) {
        var y = JSON.stringify(MasOffer.parseTransaction(x));
        var url = 'https://static.masoffer.net/img/oid/' + x.offer_id + '/?data=' + encodeURIComponent(y);

        var oImg = document.createElement("img");
        oImg.setAttribute('src', url);
        oImg.style.width = '1px';
        oImg.style.height = '1px';
        oImg.style.position = 'fixed';
        oImg.style.top = '0';

        document.body.appendChild(oImg);
    },
    parseTransaction: function (z) {
        var products = z.products;
        products.forEach(function(product, index){
            try {
                products[index] = MasOffer.parseProduct(product);
            }
            catch(err) {
                console.log(err.message);
            }

        });
        return z;
    },
    parseProduct: function (p) {
        if (p.category_id !== undefined) {
            p.category_id_raw = p.category_id;
            p.category_id = 1;
        }
        return p;
    }
};
var interval;
interval = setInterval(function(){
    if (typeof masoffer_order_info !== "undefined") {
        clearInterval(window.interval);
        MasOffer.transaction(masoffer_order_info)
    }
}, 2000);