data flow from website to AX and from AX to website

Dear friends,

I have a task in my hand we hve a company website where we have customer’s information(Name,age, address, etc…)

I want to make sure when we update the information in company website it should get updated and when we do in AX it should get updated i guess we need to use web service but dont know how to do, can any one thorw some light on it or provide some some steps to follow…

followed few links but didn’t helped me yet!!![:(]

Thanks…

I am using AX 2012

Dear Rohit,

Please try the below Sample code for creating a Web Service in .net:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Services;

using Microsoft.Dynamics.BusinessConnectorNet;

namespace AxItemOnHand

{

///

/// This web service will return OnHand information regarding a

/// given item

///

// Autogenerated code →

[WebService(Namespace = “http://tempuri.org/”)]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[System.ComponentModel.ToolboxItem(false)]

// To allow this Web Service to be called from script

// using ASP.NET AJAX, uncomment the following line.

// [System.Web.Script.Services.ScriptService]

// Autogenerated code ←

public class ItemOnHand : System.Web.Services.WebService

{

Axapta ax;

string output;

[WebMethod]

public string AvailableNow(string itemId)

{

AxaptaObject inventOnHand;

// Logon to AX

this.Logon();

// Create a new AxaptaObject of the InventOnHand class

// by executing the static method newItemId

inventOnHand =

(AxaptaObject)ax.CallStaticClassMethod(“InventOnHand”,

“newItemId”,

itemId);

// Call the method availPhysical to get the qty

// and convert it to a string

output = inventOnHand.Call(“availPhysical”).ToString();

// Release the object to the garbage collection

inventOnHand.Dispose();

This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December

Chapter 11

[ 277 ]

// Logoff to release the webuser session in AX

this.Logoff();

// Return the output

return output;

}

[WebMethod]

public string AvailableInclOrdered(string itemId)

{

AxaptaObject inventOnHand;

this.Logon();

inventOnHand =

(AxaptaObject)ax.CallStaticClassMethod(“InventOnHand”,

“newItemId”,

itemId);

output = inventOnHand.Call(“availOrdered”).ToString();

inventOnHand.Dispose();

this.Logoff();

return output;

}

private void Logon()

{

try

{

ax = new Axapta();

ax.Logon(“ceu”, “”, “”, “”);

}

catch(Exception e)

{

output = e.Message;

}

}

private void Logoff()

{

try

{

ax.Logoff();

}

catch (Exception e)

{

output = e.Message;

}

}

}

}

change the code according to your requirement.