Strange Exception on Consuming Simple Webservice

sharadsharad Member Posts: 112
edited 2014-01-25 in NAV Three Tier
Hello Friends,

I have made a CU with a single function to insert some data to a table and publish this CU. When I consume this Service It gives the 1st time exception - "Object of type Page with id 50087 could not be found.". I don't have this page. 2nd time Exception - Metadata for object of type Page with id 50087 is in a failed state. This is caused by a previous exception: Object of type Page with id 50087 could not be found.. For this I follow steps provide in this link http://saurav-nav.blogspot.in/2012/02/metadata-for-object-of-type-table-with.html . Multiple time Restarted Services of NAV and Sql but not done. Then I made a page of the same table after doing this a new Exception generate - "Client callback (such as showing Pages) is not supported when executing custom Web services.".

I have a very simple CodeUnit as given Below

OnRun()

CreatePullOutReq(TransactionID : Text[200];RequestBy : Code[20];VehicleID : Code[20];RequestID : Code[20];Reason : Text[30])
IF GUIALLOWED THEN BEGIN
EntryNo:=0;
RecWebAppTransactions.RESET;
IF RecWebAppTransactions.FINDLAST THEN
EntryNo:= RecWebAppTransactions."Entry No."
ELSE
EntryNo:=0;
RecWebAppTransactions.INIT;
RecWebAppTransactions."Entry No." := EntryNo+1;
RecWebAppTransactions.Type := RecWebAppTransactions.Type::"4";
RecWebAppTransactions."Document No." := RequestID;
RecWebAppTransactions."Vehicle Id" :=VehicleID;
RecWebAppTransactions."Document Date" := TODAY;
RecWebAppTransactions."Confirmation Date" := TODAY;
RecWebAppTransactions.Remarks := Reason;
RecWebAppTransactions.INSERT;
END;

and Asp.Net Code

protected void Button1_Click(object sender, EventArgs e)
{

NetworkCredential nc1 = new NetworkCredential("Administrator", "abc", "1.1.1.1");
ws3.Credentials = nc1;
ws3.CreatePullOutReq("CDEF7890-ABCD-0123-1234-567890BABDBF", "Web", "FA000001", "REQ-00001", "Break Fail");

}
I waste much time on this but can't understand why this exception occur.

Please Help me on this.




Thanks in Advance.
Sharad Gupta
Navision Technical Consultant & .Net Developer

Comments

  • postsauravpostsaurav Member Posts: 708
    Hi sharad,

    On which version you are trying this?

    I think the error is from the dotnet part of the application not from the Navision. I will try to replicate it in NAV 2013 R2 and will update you.

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • sharadsharad Member Posts: 112
    Hi Saurav,

    I am using NAV2009 R2.
    Sharad Gupta
    Navision Technical Consultant & .Net Developer
  • ReinhardReinhard Member Posts: 249
    Not much help, but I would try making the web service even simpler. "Hello World" or "Capitalize" This might help identify where the problem is.
  • mdPartnerNLmdPartnerNL Member Posts: 802
    Client callback errors are there to warn your code is showing a confirm or message. Try it out in classic.
  • sharadsharad Member Posts: 112
    Hi Friends

    There is no confirmation dialog or message i return. simple insertion process is there in codeunit. I can't understand why this problem occur. Please Help.
    Sharad Gupta
    Navision Technical Consultant & .Net Developer
  • postsauravpostsaurav Member Posts: 708
    Hi sharad,

    I tried to replicate the issue in NAV 2013 R2 and was able to find it. I hope the changes suggested below should resolve your issue -

    1) Created a table as per your design (Hope so).
    2) Created a codeunit as per your code. (Modified code - Why GUIALLOWED?)



    3) Created a DotNet Application and the code is as shown below (Why Code for authentication is so tough?)



    4) I run the code and here is the output in my table.



    Let me know if I missed anything. I hope you will be able to resolve the problem that you are facing.

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
Sign In or Register to comment.