cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP API: can't access the data from the field "VAT number".

SOLVED

SOAP API: can't access the data from the field "VAT number".

Dear Customer Service,
 
We are build  a synchronization software for magento trough SOAP.
Here is the WSDL link to the test server: http://dev.mormota.ro/api/v2_soap/?wsdl
 
Our problem is that we can't access the data from the field "VAT number". 
The "VAT number" is located in the admin interface here:
  "Customer Information"/ "Addresses" / "VAT number".
 
We tried to get all the information from the registered customer:
customerCustomerEntity <-SOAP.customerAddressInfo
customerAddressEntityItem <- SOAP.customerCustomerInfo
 
but none of this fields contain the "VAT number".
 
I suppose the data need to be in field "customerCustomerEntity.taxvat".
 
Best Regards,
1 ACCEPTED SOLUTION

Accepted Solutions

Re: SOAP API: can't access the data from the field &quot;VAT number&quot;.

Hi @lorigergely,

 

I've made a test with a vanilla installation.

Customer without TaxVatCustomer without TaxVatAs you can see my customer doesn't have the TaxVat.

I've made a SOAP request and this was the response.

 

SOAP API response without taxvatSOAP API response without taxvat

 Customer without TaxVat.

Then I've edited my customer and I've added some TaxVat value.

 

Customer with TaxVatCustomer with TaxVat

 

The new response was:

 

SOAP API response with taxvatSOAP API response with taxvat

Then I've checked addresses.

For example, the default billing address of that customer.

 

Address without TaxVatAddress without TaxVat

 

As you can see, the response came without taxvat (and that was right).

 

SOAP API response without taxvatSOAP API response without taxvat

Then I've edited the  address and I've added some value on the TaxVat attribute.

 

Address with TaxVatAddress with TaxVat

 

And the new api response was correct.

 

SOAP API response with taxvatSOAP API response with taxvat

 

Finally, this is my current Customer configuration. Is default.

 

Customer configurationCustomer configuration

 

 

And the code was:

 

<?php
ini_set('max_execution_time','1000');
set_time_limit(0);

$client = new SoapClient("http://www.yourdomain.com/index.php/api/?wsdl");
try {
    
    //Login
    $session = $client->login("username", "password");

    //Listado de países
    //1 is the customer address ID
    $result = $client->call($session, 'customer_address.info', '1');
    
    echo "<pre>";
    print_r($result);
    echo "</pre>";
    
} catch (SoapFault $exception) {
    
    echo "There were an error on your request\n\n";
    echo "Code: " . $exception->faultcode . "\n";
    echo "Message: " . $exception->faultstring . "\n";
    
}

//Logout
$client->endSession($session);

(Of course, this is dummy code just for test)

View solution in original post

4 REPLIES 4

Re: SOAP API: can't access the data from the field &quot;VAT number&quot;.

Hi @lorigergely,

 

Maybe you don't have the taxvat enabled?

(And why SOAP instead of REST?)

Re: SOAP API: can't access the data from the field &quot;VAT number&quot;.

Thank you for your reply. 

 

How we can check if the taxvat field is enabled? or how we can enable?

 

Here's a screenshot about the field we can't find.

magento.jpg

Re: SOAP API: can't access the data from the field &quot;VAT number&quot;.

Hi @lorigergely,

 

I've made a test with a vanilla installation.

Customer without TaxVatCustomer without TaxVatAs you can see my customer doesn't have the TaxVat.

I've made a SOAP request and this was the response.

 

SOAP API response without taxvatSOAP API response without taxvat

 Customer without TaxVat.

Then I've edited my customer and I've added some TaxVat value.

 

Customer with TaxVatCustomer with TaxVat

 

The new response was:

 

SOAP API response with taxvatSOAP API response with taxvat

Then I've checked addresses.

For example, the default billing address of that customer.

 

Address without TaxVatAddress without TaxVat

 

As you can see, the response came without taxvat (and that was right).

 

SOAP API response without taxvatSOAP API response without taxvat

Then I've edited the  address and I've added some value on the TaxVat attribute.

 

Address with TaxVatAddress with TaxVat

 

And the new api response was correct.

 

SOAP API response with taxvatSOAP API response with taxvat

 

Finally, this is my current Customer configuration. Is default.

 

Customer configurationCustomer configuration

 

 

And the code was:

 

<?php
ini_set('max_execution_time','1000');
set_time_limit(0);

$client = new SoapClient("http://www.yourdomain.com/index.php/api/?wsdl");
try {
    
    //Login
    $session = $client->login("username", "password");

    //Listado de países
    //1 is the customer address ID
    $result = $client->call($session, 'customer_address.info', '1');
    
    echo "<pre>";
    print_r($result);
    echo "</pre>";
    
} catch (SoapFault $exception) {
    
    echo "There were an error on your request\n\n";
    echo "Code: " . $exception->faultcode . "\n";
    echo "Message: " . $exception->faultstring . "\n";
    
}

//Logout
$client->endSession($session);

(Of course, this is dummy code just for test)

Re: SOAP API: can't access the data from the field &quot;VAT number&quot;.

Thank you very much for your reply! It helped a lot.