No announcement yet.

Problem with XMLImportFromStream

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with XMLImportFromStream

    I'm trying to use XMLImportFromStream function to modify email settings and I've found it never returns.
    What I do is nearly the same what is done in email sample. The only difference are parameters being changed - in my case they are "from", "reply-to", "local port", "server port" and "overriding domain".
    I'm using Evolution XPortAR SDK.

    XMLImportFromStream is called from dynamic HTTP callback and after 1 minute timeout browser considers the request as failed and HTTP callback seems to stop working.

    I imagine xml could be malformed or something could go wrong, but why can't this function just return false instead of blocking forever?
    Last edited by emymrin; 12-16-2009, 02:28 PM.

  • #2
    Debugging XMLImportFromStream

    Here are some ideas:

    1) Using the CLI from either Telnet or a serial port, try task state...yes. From here you can see what tasks are running and how they are blocked.

    2) Try importing the same XML settings via the Web Manager or by pasting them into the CLI. Look for error messages.

    3) Implement the "writeMessageLine" function so you can see your error messages.


    • #3

      Thank you. Indeed there was an error in XML - I was trying to set default local and server port values and I used "-1" value for this purpose which was not the right thing to do. Figured empty value should be used instead.

      But invalid values in XML were not the real reason of the lock up. Performing XMLImportFromStream in a different thread solved the problem.

      On another note. I've noticed MAILSend may take very long time to execute, up two 2 minutes. I guess this happens when email client settings are incorrect and it takes long time before MAILSend realizes it can't send an email. Documentaion doesn't say anything on this matter. Do you recommend calling MAILSend from another thread, too, to avoid blocking of HTTP callback?


      • #4
        Calling MAILSend

        You are right, MAILSend waits and blocks while it attempts to send the message. Since this is not appropriate for the HTTP callback, you would want to run it from another thread. This further implies that you will need to create some kind of message queue and protect it via mutex when this new thread picks up a message and when the HTTP callback thread queues it. This will probably require MALLOC'ed memory, making this a significant implementation.

        Sorry this is not easier to use. It is on our list of APIs to improve, but so far has remained low priority.


        • #5
          MAILSend queue

          Well, yes, I already have queue for outgoing emails. Blocking MAILSend's are only noticeable when a user of my web app invokes sending of test mail message from web page (in this case they aren't put to queue but sent immediately instead). Strange thing is I never noticed the same problem with earlier ( and older) SDK versions. Probably that's because MAILSend implementation was different.
          Thank you for your help.
          Last edited by emymrin; 12-17-2009, 08:11 AM.