web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Custom Web Service

(0) ShareShare
ReportReport
Posted on by 55

Hi All,

I have created a Web service on AX.  I created an operation 'createPurchaseOrder' and a method in the class.  I want to call this url from my browser.  Looks like the base url without any parameters works fine, but when I added the method name prefix with '?' i.e. http://<servername>:8101/DynamicsAx/Services/My_WebServices?createPurchaseOrder doesn't work.  Any insight into this issue?

Here is an update. I got WSDL from above. It is not an issue.  I am trying to consume the AX custom service in ASP .Net Web API. Here is the code, which gives an error 'Update has been cancelled'. There is no inner exception. Please share your thoughts on what could be an issue?

public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
try
{
NOR_WebServicesRef.NOR_WebServiceCreatePurchaseOrderClient poserviceclient = new NOR_WebServicesRef.NOR_WebServiceCreatePurchaseOrderClient();
poserviceclient.createPurchaseOrder(new NOR_WebServicesRef.CallContext());
return new string[] { "value1", "value2" };

}
catch(Exception ex)
{
return new string[] { "error", ex.Message };

}

}

*This post is locked for comments

I have the same question (0)
  • Norseman Profile Picture
    55 on at

    Please look at the updated post.

  • Verified answer
    Martin Dráb Profile Picture
    239,650 Most Valuable Professional on at

    "Update has been cancelled" comes from AX, therefore you should debug X++ code called from your web service.

    You can try to simply call your service class from a job and debug it as any X++ code, or you can debug the actual web service with VS debugger (see Debugging in Microsoft Dynamics AX 2012 > Services).

  • Norseman Profile Picture
    55 on at

    Thanks Martin.. That was helpful..I debugged..found that it is creating PO for some random company (not my default) so it is throwing 'Item not found' error.  How do I set the company in my code? It may be naive question though..

  • Norseman Profile Picture
    55 on at

    Never mind! I have to put my code with changeCompany'XX'{}.. It works fine.. Thanks

  • Martin Dráb Profile Picture
    239,650 Most Valuable Professional on at

    You can set a company in the CallContext object that you pass to createPurchaseOrder().

    By default, it uses the default company of the account under which the code is executed.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dserp Profile Picture

dserp 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans