Debug is a nice feature, but what I'd like is to be able to return the "readable" raw xml from either the request or the response with a method. This way I can print them out in a note
in my test framework. Can anyone tell me how I might do this?
调试是一个很好的功能,但我想要的是能够从请求或响应方法返回“可读”的原始xml。这样我就可以在我的测试框架中的一个注释中打印出来。谁能告诉我怎么做到这一点?
2 个解决方案
#1
0
Is the outputxml
flag what you're after?
outputxml标志是你追求的吗?
From the documentation:
从文档:
outputxml()
Lets you specify the kind of output from all method calls. If true, all methods will return unprocessed, raw XML code. You can parse it with XML::Parser, SOAP::Deserializer or any other appropriate module.
允许您指定所有方法调用的输出类型。如果为true,则所有方法都将返回未处理的原始XML代码。您可以使用XML :: Parser,SOAP :: Deserializer或任何其他适当的模块对其进行解析。
#2
0
A little late (hah!), but I was looking for the same and in the version of the library we're using I was able to do the following:
有点晚了(哈!),但我正在寻找相同的,在我们使用的库的版本中,我能够做到以下几点:
my $soap = SOAP::Lite->new()
# ->uri(...)->proxy(...)->autotype(0)
;
my $header = SOAP::Header->name(...);
my $som = $soap->call('method' => $args, $header);
my $serializer = SOAP::Serializer->new;
my $xml = $serializer->serialize($som->dataof('//')); # includes a lot of attributes...
# or
my $xml = $serializer->serialize($som->valueof('//'));
This is not exactly the same, but might be complete enough for most uses.
这不完全相同,但对于大多数用途可能足够完整。
#1
0
Is the outputxml
flag what you're after?
outputxml标志是你追求的吗?
From the documentation:
从文档:
outputxml()
Lets you specify the kind of output from all method calls. If true, all methods will return unprocessed, raw XML code. You can parse it with XML::Parser, SOAP::Deserializer or any other appropriate module.
允许您指定所有方法调用的输出类型。如果为true,则所有方法都将返回未处理的原始XML代码。您可以使用XML :: Parser,SOAP :: Deserializer或任何其他适当的模块对其进行解析。
#2
0
A little late (hah!), but I was looking for the same and in the version of the library we're using I was able to do the following:
有点晚了(哈!),但我正在寻找相同的,在我们使用的库的版本中,我能够做到以下几点:
my $soap = SOAP::Lite->new()
# ->uri(...)->proxy(...)->autotype(0)
;
my $header = SOAP::Header->name(...);
my $som = $soap->call('method' => $args, $header);
my $serializer = SOAP::Serializer->new;
my $xml = $serializer->serialize($som->dataof('//')); # includes a lot of attributes...
# or
my $xml = $serializer->serialize($som->valueof('//'));
This is not exactly the same, but might be complete enough for most uses.
这不完全相同,但对于大多数用途可能足够完整。