Loading ...
Sorry, an error occurred while loading the content.

Using SOAP::Lite from C++: some experience

Expand Messages
  • Andersson, Kimmo
    Hi ! I have asked for advice from this group and thought it would be appropriate to share my experience with You. Some might find it useful also. First some
    Message 1 of 1 , Jan 9, 2003
      Hi !

      I have asked for advice from this group and thought it would be appropriate
      to share my experience with You. Some might find it useful also.

      First some background. My task was to write a library which would handle
      sending SOAP messages and returning the response from them. The environment
      is HP-UX and the language is C++. So Perl has to be called from C++. Of
      course I had no previous experience in either SOAP or Perl...
      Also I was the first one who had to use Perl from C++. The decision to use
      SOAP::Lite as the toolkit was made by our customer.

      To make talking from C++ to SOAP::Lite more simple I decided to have my own
      Perl script or module between C++ and SOAP::Lite.
      Firstly I had an embedded Perl interpreter in the C++ code but I ran to
      memory consumption problem. Perl does not release memory to the operating
      system. It releases memory to it's own memory pool to be reused. But to my
      surprise this recycling did not happen. I send say 100 identical SOAP
      messages and all the time the memory used by my process was growing. Not
      dramatically but the processes which would use my library are constantly
      running so this was unacceptable.

      So back to the drawing board and I chose to run my Perl script with the
      system command. The inconvenience here was that I had to return the SOAP
      response via a file. The response items are read from a temporary file in my
      C++ code. Previously they could be read from the Perl stack.
      This was the reason why I originally chose to use an embedded Perl
      interpreter. But reading from a file is not an issue.

      I got rid of one inconvenience by giving up the embedded solution. In some
      of the Perl headers there are definitions which are in conflict with C++.
      So I had to use my own versions of those Perl header files and add
      "ifndef _cplusplus" directives to them. This would mean extra editing work
      every time the Perl version changes.

      Naturally there is certain performance penalty when now for each SOAP
      message a Perl interpreter is launched while running my script. Previously
      the Perl interpreter was started while sending the first SOAP message. After
      that is was quicker to send the further messages. Now each message is as
      slow as the first message in the embedded solution. Fortunately the SOAP
      part is a "side-plot" in our applications so the performance hasn't been an

      And one small tip. My SOAP responses can contain arrays of arrays, but just
      some. But it's easy to de-reference the response items in my intermediary
      Perl script. So the file containing the response items (read in C++) has
      only one simple response item per line.

      Even though there has been some difficult moments I have started to like
      Perl and SOAP::Lite. I wrote a SOAP test server using Perl and SOAP::Lite
      and it was really easy.

      Best regards

      Kimmo Andersson

      Yomi Solutions Ltd E-mail: Kimmo.Andersson@....O
      Box 354, Piippukatu 11 Mobile: +358 50 384 3734
      FIN-40101 JYVÄSKYLÄ Fax : +358 14 240 4709FINLAND
    Your message has been successfully submitted and would be delivered to recipients shortly.