Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web services Perl:无法将xml数据发布到web服务_Web Services_Perl_Soap - Fatal编程技术网

Web services Perl:无法将xml数据发布到web服务

Web services Perl:无法将xml数据发布到web服务,web-services,perl,soap,Web Services,Perl,Soap,web服务接受xml数据并再次以xml格式返回值。我试图将xml数据发布到web服务,但没有成功,我需要使用Perl来完成。以下是我尝试的代码: use SOAP::Lite ; my $URL = "http://webservice.com:7011/webServices/HealthService.jws?WSDL="; my $xml_data = '<Request>HealthCheck</Request>' ; my $result = SOAP::Lit

web服务接受xml数据并再次以xml格式返回值。我试图将xml数据发布到web服务,但没有成功,我需要使用Perl来完成。以下是我尝试的代码:

use SOAP::Lite ;
my $URL = "http://webservice.com:7011/webServices/HealthService.jws?WSDL=";
my $xml_data = '<Request>HealthCheck</Request>' ;
my $result = SOAP::Lite -> service($xml_data);
print $result ;
Web服务只提供一种方法
HealthRequest
。我不确定它为什么要在
SOAP:Lite
中查找class方法。对于这两种方法,我得到了相同的错误


有没有其他方法可以使用Perl实现同样的功能

试试这样的方法,我还没有测试过它,所以只要测试一下,看看会发生什么,你至少不会出现PM错误

 use strict;
 use SOAP::Lite;
 my $xml_data = '<Request>HealthCheck</Request>' ;
 my $soap = SOAP::Lite       
     ->uri("webServices/HealthService")
     ->proxy("http://webservice.com:7011/webServices/HealthService.jws?WSDL=");
     print $soap->service($xml_data),"\n";
使用严格;
使用SOAP::Lite;
我的$xml_数据='HealthCheck';
my$soap=soap::Lite
->uri(“Web服务/健康服务”)
->代理(“http://webservice.com:7011/webServices/HealthService.jws?WSDL=");
打印$soap->service($xml\u数据),“\n”;

如果您想自己创建XML,而不是将该任务委托给
SOAP::Lite
,则需要让
SOAP::Lite
知道您在做什么:

$soap = SOAP::Lite->ns( $URI )->proxy( $URL );
$soap->HealthCheck( SOAP::Data->type( xml => $xml_data ) );
不过,我怀疑这是否适用于您的XML

如果您的请求确实没有可变参数,这可能会起作用:

$soap = SOAP::Lite->ns( $URI )->proxy( $URL );
$soap->HealthCheck;
PS:您确定您的Web服务是SOAP服务吗

$soap = SOAP::Lite->ns( $URI )->proxy( $URL );
$soap->HealthCheck( SOAP::Data->type( xml => $xml_data ) );
$soap = SOAP::Lite->ns( $URI )->proxy( $URL );
$soap->HealthCheck;