use Object::Tiny qw{xmldoc config namespace ils};
our $VERSION = '0.01';
-our $nsURI = 'http://www.niso.org/2008/ncip';
+our $strict_validation = 0; # move to config file
=head1 NAME
my $self = {};
my $config = NCIP::Configuration->new($config_dir);
$self->{config} = $config;
- $self->{namespace} = $nsURI;
+ $self->{namespace} = $config->('NCIP.namespace.value');
# load the ILS dependent module
my $module = 'NCIP::ILS::' . $config->('NCIP.ils.value');
# We have invalid xml, or we can't figure out what kind of request this is
# Handle error here
+ warn "We can't find request type";
return;
#bail out for now
warn "Invalid xml, caught error: $_";
};
if ($dom) {
-
# should check validity with validate at this point
- if ( $self->validate($dom) ) {
- my $request_type = $self->parse_request($dom);
-
- # do whatever we should do to initiate, then hand back request_type
- if ($request_type) {
- $self->{xmldoc} = $dom;
- return $request_type;
- }
- }
- else {
- warn "Not valid xml";
+ if ( $strict_validation && !$self->validate($dom) ) {
+
+ # we want strict validation, bail out if dom doesnt validate
+ warn " Not valid xml";
- # not valid throw error
+ # throw/log error
return;
}
+ my $request_type = $self->parse_request($dom);
+
+ # do whatever we should do to initiate, then hand back request_type
+ if ($request_type) {
+ $self->{xmldoc} = $dom;
+ return $request_type;
+ }
}
else {
+ warn "We have no DOM";
+
return;
}
}
sub parse_request {
my $self = shift;
my $dom = shift;
- my $nodes = $dom->getElementsByTagNameNS( $nsURI, 'NCIPMessage' );
+ my $nodes = $dom->getElementsByTagNameNS( $self->namespace(), 'NCIPMessage' );
if ($nodes) {
my @childnodes = $nodes->[0]->childNodes();
if ( $childnodes[1] ) {
</version>
<ils value='Koha' />
-
+ <namespace value= '' />
</acsconfig>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?><!DOCTYPE NCIPMessage PUBLIC "-//NISO//NCIP DTD Version 1//EN" "http://www.niso.org/ncip/v1_0/imp1/dtd/ncip_v1_0.dtd">
-<NCIPMessage version="http://www.niso.org/ncip/v1_0/imp1/dtd/ncip_v1_0.dtd">
- <LookupUser>
- <InitiationHeader>
- <FromAgencyId>
- <UniqueAgencyId>
- <Scheme>http://www.auto-graphics.com/ncip/schemes/uniqueagencyid/agencynames.scm</Scheme>
- <Value>CPomAG:massvc:FLO-WENTWORTH</Value>
- </UniqueAgencyId>
- </FromAgencyId>
- <ToAgencyId>
- <UniqueAgencyId>
- <Scheme>HTTP://schema.flo.org/ncip/ag</Scheme>
- <Value>FLO-WENTWORTH</Value>
- </UniqueAgencyId>
- </ToAgencyId>
- </InitiationHeader>
- <UniqueUserId>
- <UniqueAgencyId>
- <Scheme>HTTP://schema.flo.org/ncip/ag</Scheme>
- <Value>FLO-WENTWORTH</Value>
- </UniqueAgencyId>
- <UserIdentifierValue>FLO-WHEELOCK</UserIdentifierValue>
- </UniqueUserId>
- <UserElementType>
- <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
- <Value>Name Information</Value>
- </UserElementType>
- <UserElementType>
- <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
- <Value>User Address Information</Value>
- </UserElementType>
- <UserElementType>
- <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
- <Value>User Privilege</Value>
- </UserElementType>
- <UserElementType>
- <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
- <Value>Block Or Trap</Value>
- </UserElementType>
- </LookupUser>
-</NCIPMessage>
-
-
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-\r
-<ns1:NCIPMessage xmlns:ns1="http://www.niso.org/2008/ncip" ns1:version="http://www.niso.org/schemas/ncip/v2_01/ncip_v2_01.xsd">\r
- <ns1:LookupUser>\r
-\r
- <ns1:UserId>\r
- <ns1:UserIdentifierValue>381</ns1:UserIdentifierValue>\r
- </ns1:UserId>\r
- \r
- <ns1:LoanedItemsDesired/>\r
- <ns1:RequestedItemsDesired/>\r
- <ns1:UserFiscalAccountDesired/>\r
-\r
- </ns1:LookupUser>\r
-</ns1:NCIPMessage>\r
-\r
+<?xml version="1.0" encoding="utf-8"?><!DOCTYPE NCIPMessage PUBLIC "-//NISO//NCIP DTD Version 1//EN" "http://www.niso.org/ncip/v1_0/imp1/dtd/ncip_v1_0.dtd">
+<NCIPMessage version="http://www.niso.org/ncip/v1_0/imp1/dtd/ncip_v1_0.dtd">
+ <LookupUser>
+ <InitiationHeader>
+ <FromAgencyId>
+ <UniqueAgencyId>
+ <Scheme>http://www.auto-graphics.com/ncip/schemes/uniqueagencyid/agencynames.scm</Scheme>
+ <Value>CPomAG:massvc:FLO-WENTWORTH</Value>
+ </UniqueAgencyId>
+ </FromAgencyId>
+ <ToAgencyId>
+ <UniqueAgencyId>
+ <Scheme>HTTP://schema.flo.org/ncip/ag</Scheme>
+ <Value>FLO-WENTWORTH</Value>
+ </UniqueAgencyId>
+ </ToAgencyId>
+ </InitiationHeader>
+ <UniqueUserId>
+ <UniqueAgencyId>
+ <Scheme>HTTP://schema.flo.org/ncip/ag</Scheme>
+ <Value>FLO-WENTWORTH</Value>
+ </UniqueAgencyId>
+ <UserIdentifierValue>FLO-WHEELOCK</UserIdentifierValue>
+ </UniqueUserId>
+ <UserElementType>
+ <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
+ <Value>Name Information</Value>
+ </UserElementType>
+ <UserElementType>
+ <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
+ <Value>User Address Information</Value>
+ </UserElementType>
+ <UserElementType>
+ <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
+ <Value>User Privilege</Value>
+ </UserElementType>
+ <UserElementType>
+ <Scheme>http://www.niso.org/ncip/v1_0/schemes/userelementtype/userelementtype.scm</Scheme>
+ <Value>Block Or Trap</Value>
+ </UserElementType>
+ </LookupUser>
+</NCIPMessage>
+
+