[Xml-compile] XML::Compile fails on rpc operation : namespace
required
Tapio.Niva at tieto.com
Tapio.Niva at tieto.com
Tue Aug 24 07:29:00 GMT 2010
Thanks for hints.
I did not patch the Operation.pm, but added the namespace to Vendor's WSDL as follows :
<soap:body use="literal" namespace="http://notification.sdk.nms.ov.hp.com/nms-sdk-notify"/>
I believe that the Vendor will add the namespace definition to their WSDL if we request it, so no need to patch XML::Compile.
Now my actual test went forward a bit, but still ended with problems :
Test results :
--------------
...
trace: cache parsed file soap-encoding.xsd-1281535998-18427
trace: parsing XML from file /usr/lib/perl5/site_perl/5.8.8/XML/Compile/SOAP11/xsd/soap-encoding.xsd
trace: cache parsed file soap-envelope.xsd-1281535998-6032
trace: parsing XML from file /usr/lib/perl5/site_perl/5.8.8/XML/Compile/SOAP11/xsd/soap-envelope.xsd
trace: cache parsed file soap-envelope-patch.xsd-1281535998-796
trace: parsing XML from file /usr/lib/perl5/site_perl/5.8.8/XML/Compile/SOAP11/xsd/soap-envelope-patch.xsd
trace: register prefix SOAP-ENV for 'http://schemas.xmlsoap.org/soap/envelope/'
trace: register prefix SOAP-ENC for 'http://schemas.xmlsoap.org/soap/encoding/'
trace: register prefix xsd for 'http://www.w3.org/2001/XMLSchema'
trace: schema compile WRITER for {http://schemas.xmlsoap.org/soap/envelope/}Fault
trace: schema compile WRITER for {http://schemas.xmlsoap.org/soap/envelope/}Fault
error: sending operation requires procedure name with RPC
at /usr/lib/perl5/site_perl/5.8.8/XML/Compile/SOAP.pm line 112
XML::Compile::SOAP::_sender(XML::Compile::SOAP11::Client=HASH(0x82d3460), "body", HASH(0x8334940), "kind", "notification-operation", "style", "rpc", "operation", [5 more]) at /usr/lib/perl5/site_perl/5.8.8/XML/Compile/SOAP11.pm line 148
XML::Compile::SOAP11::_sender(XML::Compile::SOAP11::Client=HASH(0x82d3460), "faults", HASH(0x7e170e0), "kind", "notification-operation", "style", "rpc", "server", [3 more]) at /usr/lib/perl5/site_perl/5.8.8/XML/Compile/SOAP11/Operation.pm line 260
XML::Compile::SOAP11::Operation::compileClient(XML::Compile::SOAP11::Operation=HASH(0x82d3500), "operation", "IncidentNotification", "server", "uc:pw at nnm_server") at /usr/lib/perl5/site_perl/5.8.8/XML/Compile/WSDL11.pm line 323
XML::Compile::WSDL11::compileClient(XML::Compile::WSDL11=HASH(0x808fdd0), "operation", "IncidentNotification", "server", " uc:pw at nnm_server ") at ./test_XML_compile.pl line 37
QUESTION :
I may have understood wrong, but on subscribe.WSDL used on test I can see that the operation name to be called is "IncidentNotification". Should there also be a definition of a "procedure name" ? Where should the "procedure name" be on WSDL ?
Here's the test script used:
----------------------------
#!/usr/bin/perl
use strict;
use warnings;
use XML::Compile::WSDL11;
use XML::Compile::SOAP11;
use XML::Compile::Transport::SOAPHTTP;
use XML::Compile::Schema;
use Log::Report mode => 'DEBUG';
use Data::Dumper;
# Tested with XML::Compile 1.16, XML::Compile::SOAP 2.16, XML::Compile::Cache 0.96, Log::Report 0.28
my $server = uc:pw at nnm_server';
my $subscribewsdl = "subscribe.wsdl";
my $notify_ns = 'http://notification.sdk.nms.ov.hp.com/nms-sdk-notify/';
my %xsi_type = ( 'f:filter' => [ 'f:condition', 'f:constraint', 'f:expression' ] );
my $subscribeAPI = XML::Compile::WSDL11->new( $subscribewsdl, prefixes => [f => $notify_ns], opts_rw => {xsi_type => \%xsi_type} );
# patch below suggested by Mark Overmeer
$subscribeAPI->importDefinitions(<<_PATCH);
<schema elementFormDefault="qualified"
targetNamespace="$notify_ns"
xmlns:tns="$notify_ns"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="incidentNotification" type="tns:incidentNotification"/>
</schema>
_PATCH
print "IMPORTED PATCH\n";
$subscribeAPI->importDefinitions('ws_eventing.wsdl');
print "IMPORTED : ws_eventing.wsdl\n";
$subscribeAPI->importDefinitions('ws-eventing.xsd');
print "IMPORTED : ws-eventing.xsd\n";
$subscribeAPI->importDefinitions('ws-addr.xsd');
print "IMPORTED : ws-addr.xsd\n";
my $receive_incidents = $subscribeAPI->compileClient( operation=>'IncidentNotification', server=>$server );
print "CompileClient succeeded\n";
my ($info, $trace) = $receive_incidents->();
Here's the subscribe.wsdl:
--------------------------
<wsdl:definitions targetNamespace="http://notification.sdk.nms.ov.hp.com/nms-sdk-notify" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://notification.sdk.nms.ov.hp.com/nms-sdk-notify" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!--
<wsdl:import location="http://192.49.164.44/nms-sdk-notify/subscribe?wsdl&resource=ws-eventing.wsdl" namespace="http://schemas.xmlsoap.org/ws/2004/08/eventing" />
-->
<wsdl:types>
<!--
<xs:schema targetNamespace="http://schemas.xmlsoap.org/ws/2004/08/eventing">
<xs:include schemaLocation="http://192.49.164.44/nms-sdk-notify/subscribe?wsdl&resource=ws-eventing.xsd" />
</xs:schema>
-->
<xs:schema blockDefault="#all" elementFormDefault="unqualified" targetNamespace="http://notification.sdk.nms.ov.hp.com/nms-sdk-notify">
<xs:complexType name="incidentNotification">
<xs:sequence>
<xs:element minOccurs="0" name="category" type="xs:string" />
<xs:element name="duplicateCount" type="xs:int" />
<xs:element minOccurs="0" name="family" type="xs:string" />
<xs:element minOccurs="0" name="firstOccurrenceTime" type="xs:dateTime" />
<xs:element minOccurs="0" name="id" type="xs:string" />
<xs:element minOccurs="0" name="lastOccurrenceTime" type="xs:dateTime" />
<xs:element minOccurs="0" name="name" type="xs:string" />
<xs:element minOccurs="0" name="nature" type="tns:nature" />
<xs:element minOccurs="0" name="origin" type="tns:origin" />
<xs:element minOccurs="0" name="originOccurrenceTime" type="xs:dateTime" />
<xs:element minOccurs="0" name="priority" type="xs:string" />
<xs:element name="rcaActive" type="xs:boolean" />
<xs:element minOccurs="0" name="formattedMessage" type="xs:string" />
<xs:element minOccurs="0" name="lifecycleState" type="xs:string" />
<xs:element minOccurs="0" name="severity" type="tns:severity" />
<xs:element minOccurs="0" name="sourceName" type="xs:string" />
<xs:element minOccurs="0" name="sourceNodeName" type="xs:string" />
<xs:element minOccurs="0" name="sourceNodeLongName" type="xs:string" />
<xs:element minOccurs="0" name="sourceNodeUuid" type="xs:string" />
<xs:element minOccurs="0" name="sourceUuid" type="xs:string" />
<xs:element minOccurs="0" name="uuid" type="xs:string" />
<xs:element name="incidentResent" type="xs:int" />
<xs:element minOccurs="0" name="created" type="xs:dateTime" />
<xs:element minOccurs="0" name="updateTime" type="xs:dateTime" />
<xs:element minOccurs="0" name="previousLifecycleState" type="xs:string" />
<xs:element minOccurs="0" name="previousRcaActive" type="xs:string" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="cias" nillable="true" type="tns:cia" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="incidentCorrelation">
<xs:sequence>
<xs:element minOccurs="0" name="name" type="xs:string" />
<xs:element minOccurs="0" name="type" type="tns:correlationType" />
<xs:element minOccurs="0" name="parent" type="xs:string" />
<xs:element minOccurs="0" name="firstOccurrenceTime" type="xs:dateTime" />
<xs:element name="correlationResent" type="xs:int" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="children" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="cia">
<xs:sequence>
<xs:element minOccurs="0" name="name" type="xs:string" />
<xs:element minOccurs="0" name="type" type="xs:string" />
<xs:element minOccurs="0" name="value" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="severity">
<xs:restriction base="xs:string">
<xs:enumeration value="CRITICAL" />
<xs:enumeration value="MAJOR" />
<xs:enumeration value="MINOR" />
<xs:enumeration value="WARNING" />
<xs:enumeration value="NORMAL" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nature">
<xs:restriction base="xs:string">
<xs:enumeration value="ROOTCAUSE" />
<xs:enumeration value="SECONDARYROOTCAUSE" />
<xs:enumeration value="SYMPTOM" />
<xs:enumeration value="SERVICEIMPACT" />
<xs:enumeration value="STREAMCORRELATION" />
<xs:enumeration value="NONE" />
<xs:enumeration value="INFO" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="origin">
<xs:restriction base="xs:string">
<xs:enumeration value="MANAGEMENTSOFTWARE" />
<xs:enumeration value="MANUALLYCREATED" />
<xs:enumeration value="REMOTELYGENERATED" />
<xs:enumeration value="SNMPTRAP" />
<xs:enumeration value="SYSLOG" />
<xs:enumeration value="OTHER" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="correlationType">
<xs:restriction base="xs:string">
<xs:enumeration value="APA" />
<xs:enumeration value="IMPACT" />
<xs:enumeration value="DEDUP" />
<xs:enumeration value="RATE" />
<xs:enumeration value="PAIRWISE" />
<xs:enumeration value="CUSTOM" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
</wsdl:types>
<wsdl:message name="IncidentNotificationMsg">
<wsdl:part name="arg0" type="tns:incidentNotification" />
</wsdl:message>
<wsdl:portType name="IncidentNotificationSource" wse:EventSource="true">
<wsdl:operation name="IncidentNotification">
<wsdl:output message="tns:IncidentNotificationMsg" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="IncidentNotificationSourceBinding" type="tns:IncidentNotificationSource">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="IncidentNotification">
<soap:operation soapAction="" />
<wsdl:output>
<soap:body use="literal" namespace="http://notification.sdk.nms.ov.hp.com/nms-sdk-notify"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
and imported ws_eventing.wsdl :
-------------------------------
</wsdl:definitions>
<wsdl:definitions targetNamespace="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- <
wsdl:types>
<xs:import namespace="http://schemas.xmlsoap.org/ws/2004/08/eventing" schemaLocation="http://schemas.xmlsoap.org/ws/2004/08/eventing/eventing.xsd" />
</wsdl:types>
-->
<wsdl:message name="GetStatusResponseMsg">
<wsdl:part element="wse:GetStatusResponse" name="body" />
</wsdl:message>
<wsdl:message name="GetStatusMsg">
<wsdl:part element="wse:GetStatus" name="body" />
</wsdl:message>
<wsdl:message name="RenewResponseMsg">
<wsdl:part element="wse:RenewResponse" name="body" />
</wsdl:message>
<wsdl:message name="SubscriptionEnd">
<wsdl:part element="wse:SubscriptionEnd" name="body" />
</wsdl:message>
<wsdl:message name="RenewMsg">
<wsdl:part element="wse:Renew" name="body" />
</wsdl:message>
<wsdl:message name="SubscribeMsg">
<wsdl:part element="wse:Subscribe" name="body" />
</wsdl:message>
<wsdl:message name="SubscribeResponseMsg">
<wsdl:part element="wse:SubscribeResponse" name="body" />
</wsdl:message>
<wsdl:message name="UnsubscribeMsg">
<wsdl:part element="wse:Unsubscribe" name="body" />
</wsdl:message>
<wsdl:message name="UnsubscribeResponseMsg" />
<wsdl:portType name="SubscriptionManager">
<wsdl:operation name="RenewOp">
<wsdl:input message="wse:RenewMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew" />
<wsdl:output message="wse:RenewResponseMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse" />
</wsdl:operation>
<wsdl:operation name="GetStatusOp">
<wsdl:input message="wse:GetStatusMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus" />
<wsdl:output message="wse:GetStatusResponseMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse" />
</wsdl:operation>
<wsdl:operation name="UnsubscribeOp">
<wsdl:input message="wse:UnsubscribeMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe" />
<wsdl:output message="wse:UnsubscribeResponseMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="EventSource">
<wsdl:operation name="SubscribeOp">
<wsdl:input message="wse:SubscribeMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe" />
<wsdl:output message="wse:SubscribeResponseMsg" wsa10:Action="http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse" />
</wsdl:operation>
<wsdl:operation name="SubscriptionEnd">
<wsdl:output message="wse:SubscriptionEnd" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SubscriptionManagerBinding" type="wse:SubscriptionManager">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetStatusOp">
<soap:operation soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RenewOp">
<soap:operation soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="UnsubscribeOp">
<soap:operation soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="EventSourceBinding" type="wse:EventSource">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="SubscribeOp">
<soap:operation soapAction="" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="SubscriptionEnd">
<soap:operation soapAction="" />
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="EventingService">
<wsdl:port binding="wse:SubscriptionManagerBinding" name="SubscriptionManagerPort">
<soap:address location="http://sheridan/nms-sdk-notify/manage" />
</wsdl:port>
<wsdl:port binding="wse:EventSourceBinding" name="EventSourcePort">
<soap:address location="http://sheridan/nms-sdk-notify/subscribe" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
---------
BR, Tapio
-----Original Message-----
From: Mark Overmeer [mailto:mark at overmeer.net]
Sent: 23. elokuuta 2010 22:33
To: Niva Tapio
Cc: XML-Compile
Subject: Re: [Xml-compile] XML::Compile fails on rpc operation : namespace required
* Tapio.Niva at tieto.com (Tapio.Niva at tieto.com) [100823 11:01]:
> trying to compile a vendor’s subscribe.wsdl with XML::Compile
> (test_XML_Compile.pl) gives following error (test_XML_Compile.log) for which
> I did not find a reason (I’m afraid my poor knowledge may be the main reason
> here…) :
First this:
trace: parsing XML from file ws-addr.xsd
Are you aware of XML::Compile::SOAP::WSA? It's a recent addition.
error: rpc operation
{http://notification.sdk.nms.ov.hp.com/nms-sdk-notify}IncidentNotificationMsg
requires namespace attribute
The error states what "I" think is wrong. The spec says that the rpc
operation definitions in the WSDL requires a namespace="..." attribute.
It complains in lib/XML/Compile/SOAP11/Operation.pm
if($style eq 'rpc')
{ exists $body->{namespace}
or error __x"rpc operation {name} requires namespace attribute"
, name => $msgname;
my $ns = $body->{namespace};
$procedure = pack_type $ns, $opname;
}
You could try to change this in
if($style eq 'rpc')
{ my $ns = $body->{namespace} || '';
$procedure = pack_type $ns, $opname;
}
and see wether the produces messages are accepted with your server...
When it works, it will be a difficult decission: it this a common problem
with the spec? In that case the change may be useful. Otherwise, I may
add an option or change it into a warning.
--
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