[web service] Only Update in the first time

bo17agebo17age Member Posts: 2
edited 2013-10-11 in NAV Three Tier
Hello Expert,
My web server only update Sales header in the first time. From the second time, it said:
Fatal error: Uncaught SoapFault exception: [a:Microsoft.Dynamics.Nav.Service.WebServices.ServiceBrokerException] Other user has modified "Sales_Order" "Document Type=CONST(Order),No.=CONST(SO1105-7599)"

and i am very confuse :cry:
Please help me at this!

Thank you!

Comments

  • kinekine Member Posts: 12,562
    It is hard to help without details about the code. In general: you are modifying something what is not longer valid. You need to read the record again from the database, and do not forget to lock it to prevent parallel modifications.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • jfrubiojfrubio Member Posts: 9
    Hello bo17age.

    Did you fix the error? I have the same problem when I try to add more than one item line order. I get this error:
    Fatal error: Uncaught SoapFault exception: [a:Microsoft.Dynamics.Nav.Service.WebServices.ServiceBrokerException] Other user has modified "Sales_Order" "Document Type=CONST(Order),No.=CONST(PV091/0040453)" in C:\wamp\www\soap\navcreaped.php:227 Stack trace: #0 C:\wamp\www\soap\navcreaped.php(227): SoapClient->__call('Update', Array) #1 C:\wamp\www\soap\navcreaped.php(227): NTLMSoapClient->Update(Object(stdClass)) #2 {main} thrown in C:\wamp\www\soap\navcreaped.php on line 227
    

    My code:
    $pageURL = $baseURL.'Page/Sales_Order';
    
    // Initialize Page Soap Client
    
    $service = new NTLMSoapClient($pageURL);
    
    // Create object
           $create = new stdClass();
           $sq = new stdClass();        
    
           // Add Sales Quote to Create
           $create->Sales_Order = $sq;
           $result = $service->create($create);
    
           // Retrieve record key to use in update request
           $key = $result->Sales_Order->Key;
    	   echo $key;
    
           $update = new stdClass();
    
           $sq->Key = $key;
           $sq->Sell_to_Customer_No = '000851';
    	   $sq->Pedido_web = 1;
    	   $sq->Pedido_web_de = 'Asociado';
    
           // Add sales lines
    
           $salesLineList = new stdClass();
           $salesLine = new stdClass();
           $salesLine->No = 'VIWE1102218';
           $salesLine->Type = 'Item';
           //$salesLine->Quantity = 1;
           //$salesLine->Unit_Price = 101;
           //$salesLine->Variant_Code = 'LOOLJOEH';
    
           // Add SalesQuoteLine to SalesLineList
    		$salesLineList->Sales_Order_Line = $salesLine;
    	   
           // Add SalesLineList to SalesQuote
           $sq->SalesLines = $salesLineList;
    	   
    	   $update->Sales_Order = $sq;
    	   
    	   $result = $service->Update($update);
    	   
    	   
    	   $salesLineList = new stdClass();
           $salesLine = new stdClass();
           $salesLine->No = 'VIWE1102219';
           $salesLine->Type = 'Item';
    	   
    	   // Add SalesQuoteLine to SalesLineList
           $salesLineList->Sales_Order_Line = $salesLine;
    
           // Add SalesLineList to SalesQuote
           $sq->SalesLines = $salesLineList;
    	   
           $update->Sales_Order = $sq;
    
           $result = $service->Update($update);
    
    

    PLEASE HELP, I'M GETTING CRAZY!!!!

    Thanks
Sign In or Register to comment.