开发者

Perl::WSDL. Generated methods in different directory than script

I am trying to write a script for using with op5/nagios. What it tries to do is to connect to database an get a value there, and then send a request to a webservice and match the response from the webservice with the value from the database.

Now writing the script wasn't the problem. The problem arrises when trying to run it from OP5.

When including the interface to script I use the following syntax

use MyInterfaces::PortalServicesImplService::PortalServicesImplPort;

This works just fine when I execute the script located on the same level as "MyInterfaces".

The problem is that the script itself is located in the folder /opt/plugins/custom/SOAP where both the script and the folders generated by wsdl2perl.pl is located. However when OP5 executes the script is does so from the folder /opt/monitor.

So I tried to include the "PortalServicesImplPort" using this syntax

use lib "/opt/plugins/custom/SOAP/MyInterfaces/PortalservicesImplServices/PortalServicesImplPort

The code compiles but when trying to run it I get an error message saying Can't locate object method "new" via package "MyInterfaces::PortalServicesImplService::PortalServicesImplPort" (perhaps you forgot to load "MyInterfaces::Port开发者_开发知识库alServicesImplService::PortalServicesImplPort"?)

Am I doing something wrong when importing methods from another location or doesn't SOAP::WSDL support placing the auto generated files in a different directory from where you are executing the script?


Seems I managed to solve this myself by adding use lib "/opt/plugins/custom/SOAP

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜