开发者

vb.Net code to use AX 2009 ReturnOrderInService web service

Need to use the create method of the AX 2009 ReturnOrderInService web service in a vb.NET aspx page to create an RMA in AX.

The code I've written below creates the RMA in AX, but doesn't show the line details in the AX RMA form, even though the records are in SalesTable and SalesLine.

Is a record needed in InventTrans or is there a missing InventRefId value somewhere?


    Dim rmaClient As ReturnOrderInServiceClient = New ReturnOrderInServiceClient("WSHttpBinding_ReturnOrderInService1")
开发者_JAVA技巧    Dim roi As AxdReturnOrderIn = New AxdReturnOrderIn

    Dim st As AxdEntity_SalesTable = New AxdEntity_SalesTable
    st.CustAccount = "123"
    st.ReturnReasonCodeId = "RRC1"
    st.DlvMode = "01"
    st.SalesType = 4  'return item
    st.ReturnDeadline = DateAdd(DateInterval.Day, 15, Now())

    Dim sl As AxdEntity_SalesLine = New AxdEntity_SalesLine
    sl.ItemId = "ITEM 123"        
    sl.ExpectedRetQty = -2
    sl.LineAmount = 0           
    sl.InventTransIdReturn = "" 

    st.SalesLine = New AxdEntity_SalesLine() {sl}
    roi.SalesTable = New AxdEntity_SalesTable() {st}

    txtFeedback.Text = ""

    Try
        Dim returnedSalesOrderEntityKey As EntityKey() = rmaClient.create(roi)
        Dim returnedSalesOrder As EntityKey = CType(returnedSalesOrderEntityKey.GetValue(0), EntityKey)            
        txtFeedback.Text = GetRMANo(returnedSalesOrder.KeyData(0).Value)
    Catch ex As Exception
        txtFeedback.Text = ex.Message
    End Try

    rmaClient.Close()


Did you generate the proxy classes as stated in http://msdn.microsoft.com/en-us/library/cc652581(v=ax.50).aspx? This should create the AxdEntity classes needed.

First I would try to translate the example to VB. I cannot help you with the specific syntax, but there is nothing fancy here, so it should be rather simple.

Regarding the use of web services in AX, see also:

  • http://www.axaptapedia.com/Webservice
  • http://blogs.msdn.com/b/aif/archive/2011/06/15/microsoft-dynamics-ax-2012-services-and-aif-white-papers.aspx
  • http://blogs.msdn.com/b/aif/archive/2007/11/28/consuming-the-customer-service-from-a-c-client.aspx (last part)
  • http://channel9.msdn.com/blogs/sanjayjain/microsoft-dynamics-ax-2009-aif-web-services-screencast
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜