views:

31

answers:

0

The Short Version
I have a mod_perl handler in Apache that uses generated code (from wsdl2perl) to make SOAP calls to a web service. One of the methods from the WSDL is failing to create valid SOAP XML unless I "touch" the generated perl module after Apache has been started. Other methods from the WSDL are fine. A standalone perl script has no trouble with any of the methods.

The Very Long Version

The Part Where I Explain the Basic Environment
I'm writing mod_perl running in Apache that communicates with a WebService running inside our corporate network. I'm using wsdl2perl to generate the Perl classes to represent the WSDL interface.

The interface code is built like this:

wsdl2perl.pl -b $(OBJDIR) \
    --user foo \
    --password bar \
    -t WebService::Types \
    -e WebService::Elements \
    -i WebService::Interfaces \
    -m WebService::Typemaps \
    file:$(CURDIR)/WSDL/WebService.wsdl;

Application Versions (yeah, I know it's not the latest stuff):

perl: 5.8.6
mod_perl: 1.29
apache: 1.3.33

The Part Where I Describe the Problem
For one, and only one, of the methods in the interface, the generated code creates an invalid SOAP message. Specifically, the element representing the name of the method is empty. The rest of the message is correct, including the SOAPAction.

To be exact:

SOAPAction: "http://www.url.com/methodName"
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <SOAP-ENV:Body>
    < xmlns="http://www.url.com/"&gt;
      <requestContext>
        <username>user</username>
        <transactionNumber>12345</transactionNumber>
      </requestContext>
    </>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The Part Where I Explain What I've Tried and Learned
I've written a standalone Perl test script that validates each method from the WSDL, so it appears that the generated code is correct and working fine. However, it doesn't work when I call the exact same code from inside a mod_perl adapter in Apache.

I've carefully analyzed the WSDL file itself and there are no hidden characters, no typos, it's well formed, etc. And there is nothing particularly special about the method that fails. It's identical to another function that works fine with the exception of having one fewer input parameters.

Furthermore, I've discovered that if I deploy the code, start Apache and then "touch" the generated file, everything suddenly works fine. The SOAP message is now valid and correct, and it stays valid and correct continuously. Until I restart Apache, that is. Once I do that, the original problem manifests itself again until the file is touched.

Specifically, I must do this:

touch <path>/WebService/Elements/methodName.pm

I'm entirely stumped as to why touching the file makes any difference to Apache. The usual deployment process is to shut down Apache entirely (by killing the parent process), deploy the code, then start Apache from scratch. So I don't see how there could be any caching issues.

The Part Where I Ask the Questions
Why does touching the file make it work? I.e., why would the access and/or modification timestamp make any difference?
Why does the code work in a standalone Perl script but not in Apache?
Why do all the other methods in the WSDL work fine?