Options

XMLPort in NAV web service imports only first record

Hi,

I've exposed a NAV 2009 web service like that:
WriteItem(Item : XMLport "Artikel Import Webservice2") result : Text[30]
Item.IMPORT;

The XMLPort has a few lines of code to handle empty date fields, nothing else. Its properties:
8851xlig2e1x.jpg

Properties of the root element:
0m609c44nsy2.jpg

I can't upload the XML here, but it looks fine and can be validated.

It works fine for a single item, but when the incoming XML contains more than one item, only the first one is imported. It doesn't even raise an error, the additional items are just skipped. Only if there are more than exactly 194 items, a 400 Bad Request is raised.
I know this could be handled with pages as well, but I'd like to use XMLPorts, if possible. Any hints?

Answers

  • Options
    AKAK Member Posts: 226
    Can someone clarify wether or not this should work in principle?
  • Options
    vaprogvaprog Member Posts: 1,118
    Yes, this should work.

    I have never done it with real tables, but with temporary ones it worked just fine. I therefore suggest, you test your XMLPort from a Codeunit or even running it directly from the development environment. I had it behave slightly different when run there (regarding name spaces, if i remember correctly), but generally it should work and it is easier to monitor just exactly what is fed to it.

    Are you sure you don't have any SKIP or BREAK statements? Those are tricky.
    Also make sure AutoSave, AutoUpdate, and AutoReplace properties are set properly.
  • Options
    AKAK Member Posts: 226
    Thanks, that's helpful.
  • Options
    gvolkovgvolkov Member Posts: 196
    did you get it working? if not, please post a sample XML
    Microsoft Certified Technology Specialist
    Microsoft Certified Business Management Solutions Professional
    Microsoft Certified Business Management Solutions Specialist

    http://www.navisiontech.com
  • Options
    AKAK Member Posts: 226
    Well, kind of. Turned out it was indeed an error in the XML structure. I got that fixed, but now I run into stability problems of the web service. If the request XML is around 400 KB, the web service often, but not always responds with
    <?xml version="1.0"?>
    -<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
      -<s:Body>
       -<s:Fault>
         <faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Types.Exceptions.NavCSideException</faultcode>
         <faultstring xml:lang="de-DE">There is not enough memory available on the Microsoft Dynamics NAV Server computer to peform the current activity.</faultstring>
        -<detail>
           <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">There is not enough memory available on the Microsoft Dynamics NAV Server computer to peform the current activity.</string>
         </detail>
        </s:Fault>
       </s:Body>
    </s:Envelope>
    

    If the request xml gets larger, I always get this error. If I break down the request into smaller chunks, the web service works fine. I tried the hotfix 2991641 for web service memory leak, but that didn't change much.

  • Options
    JuhlJuhl Member Posts: 724
    Check memory consumption on the service. 2009 was not the most stable version, and only 32-bit.
    Maybe there is a memory leak, missing clearing of variables etc.
    Follow me on my blog juhl.blog
Sign In or Register to comment.