Wednesday 30 October 2013

NAV and Magento Integration for sendig Multiple Records

Magento, its  a powerfull E-Commerce application now a days.

Actually when we want to integrate Magento with NAV through API  we should consider several things.
There are several versions of API's available but which one is suitable for our requirement is main thing.

 Supported  API types in Magento

1. XML-RPC

• Remote Procedure Call protocol
• Use XML to encode its call
• Operates over HTTP
• Magento XML-RPC entry point

 
2.SOAP

  • Simple Object Access Protocol
  • Accessible through WSDL
  • More advanced than XML-RPC
  • Magento SOAP

  • Default Protocol
  • Entry point to interact
TWO Version of SOAP: v1 and v2
 Methods
V1 use methods call and multiCall
  Example:
    $result = $client->call($sessionId, 'sales_order.list', $params);
V2 use separate methods for each action
   Example:
   $result = $client->salesOrderList($sessionId, $params);
 
Customizing API:
• V1 won’t involve changing WSDL
• V2 involve changing to WSDL via wsdl.xml
• WS-I compliance
• Supported in V2
• Easily auto generate clients classes in JAVA or .NET
 

3.REST

 • Representational State Transfer
• Operates over HTTP utilizing PUT, GET, POST and DELETE operators
• Data exchange in XML or JSON
• Magento REST API

      • RESTful API
      • Better Performance
      • Use 3 legged OAuth 1.0a protocol

           • REF number 5849
          • OAuth use token mechanism and users do not need to reveal their credentials

-----------------------------------------------------------------------------------------------------------------

 So by above features depend on our requirement  we can select.
In my recent project  we used SOAP V2, But we faced one problem actually Magento for security reason in V2 it takes only one record for one session, so for sending bulk record using single session is my requirement. It is not possible in V2 so we used V1 for this reason. We can use both versions in single project just if we change the web service url  that's enough
For sample soap request for multicall syntax i searched in so many blogs i did not get anywhere, but finally i a find solution for that, now i am giving as example

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:multiCall>
<sessionId xsi:type="xsd:string">55444333222111c5eccf0bc5e3aea54d8</sessionId>
<calls SOAP-ENC:arrayType="xsd:ur-type[4]" xsi:type="ns1:FixedArray">
  <item SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="xsd:string">catalog_product.info</item>
    <item xsi:type="xsd:string">51</item>
  </item>
  <item SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="xsd:string">catalog_product.info</item>
    <item xsi:type="xsd:string">52</item>
  </item>
  <item SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="xsd:string">catalog_product.info</item>
    <item xsi:type="xsd:string">53</item>
  </item>
  <item SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="xsd:string">catalog_product.info</item>
    <item xsi:type="xsd:string">54</item>
  </item>
</calls>
<options xsi:nil="true"/>
</ns1:multiCall>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


This thing may be helpful  to you

IMPNOTE: some times SOAP Request may change when using webserver like Apache (xmlns:ns2="http://xml.apache.org/xml-soap" ) for Security at that time the request may contain simple changes like follows
 creating Array
<args xsi:type="SOAP-ENC:Array">
                        <item xsi:type="SOAP-ENC:Array">
                            <item xsi:type="ns2:Map">
                                <item>
                                    <key>type</key>
                                    <value>simple</value>
                                </item>
 
 Here values are passing based on Key and its value.
item tag must and the key--> field name
                                Value-> its value



Tuesday 29 October 2013

The Reservation Entry Does Not Exist

The Reservation Entry Does Not Exist

The Reservation Entry Does Not Exist 

Reservation Entries can cause a lot of issues in NAV (all version). Sometimes the Reservation Entry table can have duplicate reservations against a single item (same Source ID - Doc No.) and as a result can cause issues due to these conflicts. The most common of these is the error 'The Reservation Entry does not Exist'. Most of the time this can be easily fixed.

Typical error:



1. Open the Microsoft Navision Classic Client (with SQL if applicable).
2. Log into the Database >> Open the relevant company.
3. Ensure you are logged in as a user with adequate permissions - ie. Super.
4. Tools >> Object Designer
5. Select the Table - 'Reservation Entry' (Typically 337).
6. Run the 'Reservation Entry' table and search for the 'Document No.' in the 'Source ID' column.
Note: You should know the Document No. as this will be the document where you are getting the error. Eg. order, invoice etc. 

7. At this point the issue may differ but most of the time you are looking for duplicates. For example - if you know you have only 1 reservation against this document (with 1 item on the document) - but two are sitting in the reservation entry table, the duplicate could be causing issues. Typically I would delete all the reservations relating to this Item / Document No and re-reserve the Item.

Please do not do this unless you are confident with filtering/running tables. This is only a general guide and is meant to help you try to find the issue yourself. Deleting entries from Tables directly is EXTREMELY Dangerous and may cause irreparable damage/loss of data. - Any doubts, don't do it!