[Xml-compile] Problem with XML::Compile::WSDL11
Mark Overmeer
mark at overmeer.net
Thu Apr 1 09:39:46 GMT 2010
* Tapio.Niva at tieto.com (Tapio.Niva at tieto.com) [100401 06:17]:
> Please have a look at the following slice of the attached incidentBean.wsdl :
> <xs:complexType name="condition">
> <xs:complexContent>
> <xs:extension base="tns:filter">
> <xs:sequence>
> <xs:element minOccurs="0" name="name" type="xs:string" />
> <xs:element minOccurs="0" name="operator" type="tns:operator" />
> <xs:element minOccurs="0" name="value" type="xs:string" />
> </xs:sequence>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
Well, this is actually halve of the story. The "tns:filter" base-class
actually does define a "condition" element, and that is the one you are
producting. However, your server aparently does not support it.
> However, the service vendor uses the following format to get the
> correct response :
> <ns1:getIncidents xmlns:ns1='http://incident.sdk.nms.ov.hp.com/'>
> <arg0 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns3="http://filter.sdk.nms.ov.hp.com/" xsi:type="ns3:condition">
> <name>severity</name>
> <operator>EQ</operator>
> <value>CRITICAL</value>
> </arg0>
> </ns1:getIncidents>
Now, you stack horror on horror: SOAP-RPC with xsi:type! These are
ancient concepts.
Xsi:type support is quite new to XML::Compile. While hunting for a
solutions, I discovered some lacking components.
Your script should look like this:
my $server = 'uc:pw at ourhost';
my $filter_ns = 'http://filter.sdk.nms.ov.hp.com/';
# See wsdl->new, where 'f' is your prefix for $filter_ns
# Xsi:type only works when you provide the options explicitly, for
# reasons of performance.
my %xsi_type =
( 'f:filter' => [ 'f:condition', 'f:constraint', 'f:expression' ]
);
my $incidentAPI = XML::Compile::WSDL11->new
( "IncidentBean.wsdl"
, prefixes => [f => $filter_ns]
, opts_rw => {xsi_type => \%xsi_type}
);
my $getIncidents = $incidentAPI->compileClient
( operation => 'getIncidents'
, server => $server
);
# Your payload
my %i = (name=>'severity',operator=>'EQ',value=>'CRITICAL');
# The "new" structure, apparently not supported by your server
# does not use xsi:type
my ($info1, $trace1) = $getIncidents->(condition => \%i);
warn $trace1->printRequest;
# The "old" structure, with xsi:type
my ($info2, $trace2) = $getIncidents->
( XSI_TYPE => "{$filter_ns}condition"
, %i
);
warn $trace2->printRequest;
BUT!!! to make this work, you will have to upgrade XML::Compile::Cache to
version 0.95. I have just uploaded this to CPAN a minute ago.
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark at Overmeer.net solutions at overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net
More information about the Xml-compile
mailing list