[英]How to add an arbitrary field with XML::Compile::WSDL11 (mistake: tag `param' not used at…)
I'm trying to use the module XML::Compile::WSDL11
to create a SOAP message in base of a wsdl file. 我正在尝试使用模块XML::Compile::WSDL11
在wsdl文件的基础上创建SOAP消息。 In the xsd definitions there is a parameter called UserArea
that is supposed to hold arbitrary fields (extensions): 在xsd定义中有一个名为UserArea
的参数,它应该包含任意字段(扩展):
<xsd:element name="UserArea" type="UserAreaType"/>
<xsd:complexType name="UserAreaType">
<xsd:sequence>
<xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
So I can create manually a valid xml like: 所以我可以手动创建一个有效的xml,如:
<ProcessAssessmentOrder>
...
<DataArea>
...
<AssessmentOrder>
...
<UserArea xmlns:xxx="http://example.com">
<xxx:someURL>http://someurl.example.com</xxx:someURL>
</UserArea>
</AssessmentOrder>
</DataArea>
</ProcessAssessmentOrder>
That works and validates. 这有效并且有效。 However trying to use XML::Compile::WSDL11
I got the error: 但是,尝试使用XML::Compile::WSDL11
我得到了错误:
mistake: tag `xxx:SomeURL' not used at {http://www.hr-xml.org/3}ProcessAssessmentOrder/DataArea/AssessmentOrder/CustomerParty/PartyReportingIDs/UserArea
And the parameter is not in the generated xml. 并且参数不在生成的xml中。
So far this is my Perl code: 到目前为止,这是我的Perl代码:
use strict;
use warnings;
use DateTime;
use XML::Compile::Transport::SOAPHTTP;
use XML::Compile::SOAP11;
use XML::Compile::WSDL11;
my %args = (
releaseID => '3.3',
ApplicationArea => {
CreationDateTime => DateTime->now,
},
DataArea => {
Process => {},
AssessmentOrder => {
UserArea => {
'xxx:SomeURL' => 'www.example.com',
},
},
},
);
my $wsdl_path = '/home/david/HR-XML-3_3/Assessments/org_hr-xml/3_3/WebServices/WSDL/AssessmentOrder.wsdl';
my $wsdl = XML::Compile::WSDL11->new($wsdl_path);
import_definitions($wsdl, '/home/david/HR-XML-3_3/Assessments/');
$wsdl->compileCalls(
port => 'AssessmentOrder_Port',
endpoint => 'http://127.0.0.1/xxx',
);
my($response, $trace) = $wsdl->call('ProcessAssessmentOrder', %args);
sub import_definitions {
my($wsdl, $path) = @_;
opendir (my $dh, $path);
while (my $file = readdir($dh)) {
next if ($file eq '.' || $file eq '..');
if (-d "$path/$file") {
import_definitions($wsdl, "$path/$file");
}
elsif ($file =~ m#\.xsd$#) {
$wsdl->importDefinitions("$path/$file");
}
}
closedir($dh);
};
How to make it work to get the xml having the line 如何使xml具有该行
<xxx:someURL>http://someurl.example.com</xxx:someURL>
¿·_·? ¿·_·?
Yo can try adding this: 哟可以尝试添加这个:
my $myns = 'http://example.com';
$wsdl->prefixes => { $myns => [ uri => $myns, prefix => 'xxx' ] };
If I read things right at http://lists.scsys.co.uk/pipermail/xml-compile/2009-July/000250.html , I think XML::Compile doesn't support the xsd:any element. 如果我在http://lists.scsys.co.uk/pipermail/xml-compile/2009-July/000250.html上读到了正确的内容,我认为XML :: Compile不支持xsd:any元素。 Further than that, I can't say, as I'm wresting with a similar issue myself. 除此之外,我不能说,因为我自己也在尝试类似的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.