Nav web service halt and become inaccesible on error

jfrubiojfrubio Member Posts: 9
edited 2015-01-05 in NAV Three Tier
Hi!

I have a web service to create sales order in NAV from Magento. All works fine but in some cases one of the items have no cross reference in NAV, then I get this error:
Fatal error: Uncaught SoapFault exception: [a:Microsoft.Dynamics.Nav.Types.Exceptions.NavNCLDialogException] There are no items with cross reference: SMARTSC in C:\wamp\www\soap\grid\pedanav.php:120 Stack trace: #0 C:\wamp\www\soap\grid\pedanav.php(120): SoapClient->__call('Update', Array) #1 C:\wamp\www\soap\grid\pedanav.php(120): NTLMSoapClient->Update(Object(stdClass)) #2 C:\wamp\www\soap\grid\crearpednav.php(112): crearpedidonav(Array, Array, 3, 'http://localhos...') #3 {main} thrown in C:\wamp\www\soap\grid\pedanav.php on line 120

I loose this new sales order in NAV, but this is not the problem, the real problem is that the nav web service become inaccesible. If I try to create another sales order (in this case with all cross references ok) I get the next error, like the service is blocked:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in 'http://localhost:7047/DynamicsNAV/WS/Page/Sales_Order' in C:\wamp\www\soap\grid\pedanav.php:34 Stack trace: #0 C:\wamp\www\soap\grid\pedanav.php(34): SoapClient->SoapClient('http://localhos...') #1 C:\wamp\www\soap\grid\crearpednav.php(112): crearpedidonav(Array, Array, 2, 'http://localhos...') #2 {main} thrown in C:\wamp\www\soap\grid\pedanav.php on line 34

If I use Internet Explorer to navigate to the web service URL 'http://localhost:7047/DynamicsNAV/WS/Page/Sales_Order' I can see the web service definition and all become working again. I can use the web service to ceate new sales order without problem.

The quetions is... Why the service become unavalilable afther an error?... How can I solve or restart the service with code in php?

Note: In windows service configuration and services tab I have configured the service to restart in case of errors.

Resume:

All right creating sales order --> Error with not found cross reference in one new sales order --> web service become inavailable --> Cant create new sales order --> Navigate with browser to web service url --> All work right again.

Comments

  • vasilis6669vasilis6669 Member Posts: 109
    Hi,

    I had similar experence with PHP. When I was making changes to page or codeunit, PHP was not getting the new changes and everytime i had to give the Service name in Web services a different name. Can you change the web service name and test if this solve your problem?

    Did you check windows event viewer for the actual message?

    Vasilis
  • jfrubiojfrubio Member Posts: 9
    Hi.

    Change the service name do not solve the problem.

    All the code works fine, I can create orders in navision from my php code, but If I try to insert in to the order one item that is not in navision item list, the php crahs (normally). The problem is now the service become inaccesible; it returns something like "can see service <definitions>"....

    If I want to run the service again, I have to navigate with internet explorer to the desciption service at (http://localhost:7053/DynamicsNAV/WS/Pa ... hase_Order)... and now I can use php to insert new order.

    I have the windows service configure to restart on failure, also on stop with errors.

    Thanks.
  • aniishaniish Member Posts: 27
    hi,
    i also got the same issue but my architecture was 3-tier setup in nav 2009 R2.
    i just create a spn without using port no for web-service, and now it is working fine :) .
  • rseniorsenio Member Posts: 4
    .
  • jfrubiojfrubio Member Posts: 9
    No resolution since 2014... Some one tell me to update nav2009 to R2. Pending to try.
  • prakash_nsmprakash_nsm Member Posts: 1
    Hi, share the resolution for this issue. i am also getting same issue. need permanent fix.
    If anyone knows/ applied the resolution kindly share that info.
  • jfrubiojfrubio Member Posts: 9
    We still are fighting with the problem, now our turn arround is check, previously, for the existence of the item, once checked we insert the item in the order. But we didn't find solution for the <definitions> error.
  • vaprogvaprog Member Posts: 1,116
    Looks to me like the fault is entirely on php's side.

    The first error in your initial post is a proper SOAP message, sent to you from the NAV service because of the NAV error "There are no items with cross reference: SMARTSC". The rest of that message is generated by PHP.

    I don't know what's the reason for the second error you get. The fact that you can retrieve the WSDL from a browser suggests, though, that NAV is working all right and PHP got too confused to recover.

    The configuration to restart the service on error does not relate to the kind of error you got. This refers to errors that render the middle tier service handling the web service calls inoperable (crash or non-responding).

    I don't know, why PHP processes the WSDL for a subsequent call. If it requests it from the server for each call, it is working very inefficiently indeed, otherwise, its local copy probably got corrupted.

    What I can't get my head around is the fact, that retrieving the WSDL from a browser seems to get PHP working again. Is there some very badly broken caching going on?

    You may want to try a repair of your middle tier installation.
  • jfrubiojfrubio Member Posts: 9
    Hi vaprog, thanks for your time.

    At first time, I also think that it could be a PHP error or trash in cache, but If I try to work from diferents computer I got the same error.

    In computer A I try to insert the SMARTSC cross reference that dont exist in NAV, then I get the "There are no items with cross reference: SMARTSC" error.

    If I try to run the PHP code again I get the error "Parsing WSDL: Couldn't find <definitions>", in all the computers.

    Now I create the cross reference SMARTSC in NAV.

    If I run the PHP code again I get the error "Parsing WSDL: Couldn't find <definitions>", in all the computers.

    Now I use the browser to navigate to Service Definition in Server, and I see all the service descriptions, all seems to be ok.

    If I try now to run the PHP code from any computer the code runs well and I could perform the order with the recently created cross refence SMARTSC with out any problem.

    It looks like the NAV web service turn to ERROR state with the "There are no items with cross reference: SMARTSC" error and become to be alive again when I browse to the service definition in the server... Like if some output buffer in web service turned
    obfuscated on error and get restarted again when I navigate to service definition.

    Maybe I could try to get webservice definition in PHP each time before run the code...
  • HannesHolstHannesHolst Member Posts: 119
    Hi,

    I would try to download the response and view it in an editor.
    I'm working also with Magento (but I use REST and NAV is the consumer).
    When the Magento-environment is in upgrade-process, I receive a response in HTML-format which my .NET JSON-parser can't handle.

    Good luck
  • vaprogvaprog Member Posts: 1,116
    Hi,

    it is definitely not normal for NAV to go into some persistent error state an a simple C/AL execution error.
    I second HannesHolst's suggestion to inspect the actual message exchange on an http-level.

    Did you search Microsoft's platform update change log for changes related to your problem?
Sign In or Register to comment.