From Ian.Goodacre at xtra.co.nz Tue Oct 7 09:11:06 2014 From: Ian.Goodacre at xtra.co.nz (Ian Goodacre) Date: Tue, 07 Oct 2014 22:11:06 +1300 Subject: [Xml-compile] WSDL11 compile error Message-ID: <5433AE2A.2070805@xtra.co.nz> I am trying to implement a SOAP client using XML::Compile and receiving error: trace: misfit {http://schemas.xmlsoap.org/wsdl/}anyTopLevelOptionalElement (0..unbounded) no applicable choice for `{http://www.w3.org/ns/ws-policy}Policy' at wsdl:definitions/wsdl:anyTopLevelOptionalElement error: element `{http://www.w3.org/ns/ws-policy}Policy' not processed for wsdl:definitions at /wsdl:definitions/wsp:Policy at C:/Strawberry/perl/site/lib/XML/Compile/Translate/Reader.pm line 583 I see that the wsp:Policy element isn't allowed by wsdl:anyTopLevelOptionalElement, but I don't know how to resolve the problem. I was expecting that XML::Compile::SOAP::WSS would somehow allow the policy to be included in the WSDL but it seems not. I am using the following test script: use strict; use warnings; use Data::Dumper::Concise; use LWP; use Log::Report mode => 'DEBUG'; use XML::Compile::WSDL11; use XML::Compile::SOAP::WSS; use XML::Compile::SOAP11; use XML::Compile::Transport::SOAPHTTP; my $WSDL = 'https://test.decisionpoint3.com.au/veda2/ws/SilverChef/CompanyBusinessService?wsdl'; my $ua = LWP::UserAgent->new(); my $response = $ua->get($WSDL); my $wsdlXml = XML::LibXML->new->parse_string($response->content); my $wss = XML::Compile::SOAP::WSS->new; my $wsdl = XML::Compile::WSDL11->new($wsdlXml); Can anyone tell me what I am missing? Pointers to relevant documentation? From kaare at jasonic.dk Thu Oct 23 06:22:17 2014 From: kaare at jasonic.dk (Kaare Rasmussen) Date: Thu, 23 Oct 2014 08:22:17 +0200 Subject: [Xml-compile] Basic Authentication Message-ID: <54489E99.9020609@jasonic.dk> Hi Basic Authentication just doesn't seem to 'attach' to the calls. What am I doing wrong here? use XML::Compile::SOAP::WSS; use XML::Compile::WSDL11; use XML::Compile::SOAP11; use XML::Compile::Transport::SOAPHTTP; my $wsdlfn = '...'; my $xsdfn = '...; my $user = '...'; my $password = '...'; my $wss = XML::Compile::SOAP::WSS->new; # Should hook the WSDL parser my $wsdl = XML::Compile::WSDL11->new($wsdlfn); $wsdl->importDefinitions($xsdfn); my $auth = $wss->basicAuth( username => $user, password => $password, ); ... and then compileClient and call. The request headers look like this with $trace->printRequest: User-Agent: libwww-perl/6.07 Content-Length: 1043 Content-Type: text/xml; charset="utf-8" SOAPAction: "sendNotification" X-LWP-Version: 6.07 X-XML-Compile-Cache-Version: 1.02 X-XML-Compile-SOAP-Version: 3.05 X-XML-Compile-Version: 1.47 X-XML-LibXML-Version: 2.0116 So it fails with 401. Now, if I write a transport_hook myself, I get the correct authentication, and the call is successful. Obviously I'm missing something when trying to use XML::Compile::SOAP::WSS. But I can't see what (?) From C.DEIGNAN at rsd.com Mon Oct 27 10:59:13 2014 From: C.DEIGNAN at rsd.com (DEIGNAN Ciaran) Date: Mon, 27 Oct 2014 10:59:13 +0000 Subject: [Xml-compile] Basic Authentication In-Reply-To: <54489E99.9020609@jasonic.dk> References: <54489E99.9020609@jasonic.dk> Message-ID: <145f0eba01354517acf31fcdeff303cb@AM3PR01MB243.eurprd01.prod.exchangelabs.com> Hi Kaare, Marc must be on holiday, so let me try. I pass the WSS object in to the call(), like this ## Web Service Security my $security = $wss->wsseBasicAuth('user', 'passwd'); ($ret, $trace) = $ws->call('getImportDataSchema', wsse_Security => $security, parentFullQCode => $FQC, recordFormat => 'ERCD', nodeType => 'RECORD'); Hope this helps, Ciaran Deignan RSD Open Systems Support -----Original Message----- From: Kaare Rasmussen [mailto:kaare at jasonic.dk] Sent: jeudi 23 octobre 2014 08:22 To: xml-compile at lists.scsys.co.uk Subject: [Xml-compile] Basic Authentication Hi Basic Authentication just doesn't seem to 'attach' to the calls. What am I doing wrong here? use XML::Compile::SOAP::WSS; use XML::Compile::WSDL11; use XML::Compile::SOAP11; use XML::Compile::Transport::SOAPHTTP; my $wsdlfn = '...'; my $xsdfn = '...; my $user = '...'; my $password = '...'; my $wss = XML::Compile::SOAP::WSS->new; # Should hook the WSDL parser my $wsdl = XML::Compile::WSDL11->new($wsdlfn); $wsdl->importDefinitions($xsdfn); my $auth = $wss->basicAuth( username => $user, password => $password, ); ... and then compileClient and call. The request headers look like this with $trace->printRequest: User-Agent: libwww-perl/6.07 Content-Length: 1043 Content-Type: text/xml; charset="utf-8" SOAPAction: "sendNotification" X-LWP-Version: 6.07 X-XML-Compile-Cache-Version: 1.02 X-XML-Compile-SOAP-Version: 3.05 X-XML-Compile-Version: 1.47 X-XML-LibXML-Version: 2.0116 So it fails with 401. Now, if I write a transport_hook myself, I get the correct authentication, and the call is successful. Obviously I'm missing something when trying to use XML::Compile::SOAP::WSS. But I can't see what (?) _______________________________________________ Xml-compile mailing list Xml-compile at lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile From mark at overmeer.net Mon Oct 27 11:26:18 2014 From: mark at overmeer.net (Mark Overmeer) Date: Mon, 27 Oct 2014 12:26:18 +0100 Subject: [Xml-compile] Basic Authentication In-Reply-To: <145f0eba01354517acf31fcdeff303cb@AM3PR01MB243.eurprd01.prod.exchangelabs.com> References: <54489E99.9020609@jasonic.dk> <145f0eba01354517acf31fcdeff303cb@AM3PR01MB243.eurprd01.prod.exchangelabs.com> Message-ID: <20141027112618.GH2109@moon.overmeer.net> * DEIGNAN Ciaran (C.DEIGNAN at rsd.com) [141027 10:59]: > Marc must be on holiday, so let me try. > I pass the WSS object in to the call(), like this Ah, thank you for jumping in. It would be nice if more people contribute to the list ;-) That feels like a community ;-) In this case, I accidentally did not reply to the list, but only directly to Kaare. Your answer was correct! -- Thanks Ciaran! MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark at Overmeer.net solutions at overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net