Last active
December 4, 2015 17:23
-
-
Save Dyrcona/57495a6e2bcf325da345 to your computer and use it in GitHub Desktop.
POST a file to a web URL. Intended to be used to test the NCIPServer NCIP responder for Evergreen/Koha.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<NCIPMessage version="http://www.niso.org/schemas/ncip/v2_02/ncip_v2_02.xsd" xmlns="http://www.niso.org/2008/ncip"> | |
<AcceptItem> | |
<InitiationHeader> | |
<FromAgencyId> | |
<AgencyId></AgencyId> | |
</FromAgencyId> | |
<ToAgencyId> | |
<AgencyId></AgencyId> | |
</ToAgencyId> | |
</InitiationHeader> | |
<RequestId> | |
<AgencyId></AgencyId> | |
<RequestIdentifierValue></RequestIdentifierValue> | |
</RequestId> | |
<RequestedActionType>Hold For Pickup</RequestedActionType> | |
<UserId> | |
<AgencyId></AgencyId> | |
<UserIdentifierType>Barcode Id</UserIdentifierType> | |
<UserIdentifierValue></UserIdentifierValue> | |
</UserId> | |
<ItemId> | |
<AgencyId></AgencyId> | |
<ItemIdentifierType>Barcode Id</ItemIdentifierType> | |
<ItemIdentifierValue></ItemIdentifierValue> | |
</ItemId> | |
<ItemOptionalFields> | |
<BibliographicDescription> | |
<Author></Author> | |
<PublicationDate></PublicationDate> | |
<Publisher></Publisher> | |
<Title></Title> | |
<MediumType>Book</MediumType> | |
</BibliographicDescription> | |
<ItemDescription> | |
<CallNumber></CallNumber> | |
</ItemDescription> | |
</ItemOptionalFields> | |
<PickupLocation></PickupLocation> | |
</AcceptItem> | |
</NCIPMessage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<NCIPMessage version="http://www.niso.org/schemas/ncip/v2_02/ncip_v2_02.xsd" xmlns="http://www.niso.org/2008/ncip"> | |
<CancelRequestItem> | |
<InitiationHeader> | |
<FromAgencyId> | |
<AgencyId></AgencyId> | |
</FromAgencyId> | |
<ToAgencyId> | |
<AgencyId></AgencyId> | |
</ToAgencyId> | |
</InitiationHeader> | |
<UserId> | |
<UserIdentifierType>Barcode Id</UserIdentifierType> | |
<UserIdentifierValue></UserIdentifierValue> | |
</UserId> | |
<RequestId> | |
<AgencyId></AgencyId> | |
<RequestIdentifierValue>$requestid</RequestIdentifierValue> | |
</RequestId> | |
<RequestType>Loan</RequestType> | |
</CancelRequestItem> | |
</NCIPMessage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<NCIPMessage version="http://www.niso.org/schemas/ncip/v2_02/ncip_v2_02.xsd" xmlns="http://www.niso.org/2008/ncip"> | |
<CheckInItem> | |
<InitiationHeader> | |
<FromAgencyId> | |
<AgencyId></AgencyId> | |
</FromAgencyId> | |
<ToAgencyId> | |
<AgencyId></AgencyId> | |
</ToAgencyId> | |
</InitiationHeader> | |
<MandatedAction> | |
<DateEventOccurred></DateEventOccurred> | |
</MandatedAction> | |
<AuthenticationInput> | |
<AuthenticationInputData></AuthenticationInputData> | |
<AuthenticationInputDataFormat>text</AuthenticationInputDataFormat> | |
<AuthenticationInputType>Barcode Id</AuthenticationInputType> | |
</AuthenticationInput> | |
<ItemId> | |
<ItemIdentifierType>Barcode Id</ItemIdentifierType> | |
<ItemIdentifierValue></ItemIdentifierValue> | |
</ItemId> | |
</CheckInItem> | |
</NCIPMessage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<NCIPMessage version="http://www.niso.org/schemas/ncip/v2_02/ncip_v2_02.xsd" xmlns="http://www.niso.org/2008/ncip"> | |
<CheckOutItem> | |
<InitiationHeader> | |
<FromAgencyId> | |
<AgencyId></AgencyId> | |
</FromAgencyId> | |
<ToAgencyId> | |
<AgencyId></AgencyId> | |
</ToAgencyId> | |
</InitiationHeader> | |
<MandatedAction> | |
<DateEventOccurred></DateEventOccurred> | |
</MandatedAction> | |
<AuthenticationInput> | |
<AuthenticationInputData></AuthenticationInputData> | |
<AuthenticationInputDataFormat>text</AuthenticationInputDataFormat> | |
<AuthenticationInputType>Barcode Id</AuthenticationInputType> | |
</AuthenticationInput> | |
<ItemId> | |
<ItemIdentifierType>Barcode Id</ItemIdentifierType> | |
<ItemIdentifierValue></ItemIdentifierValue> | |
</ItemId> | |
</CheckOutItem> | |
</NCIPMessage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<NCIPMessage version="http://www.niso.org/schemas/ncip/v2_02/ncip_v2_02.xsd" xmlns="http://www.niso.org/2008/ncip"> | |
<LookupUser> | |
<InitiationHeader> | |
<FromAgencyId><AgencyId></AgencyId></FromAgencyId> | |
<ToAgencyId><AgencyId></AgencyId></ToAgencyId> | |
</InitiationHeader> | |
<UserId> | |
<UserIdentifierValue></UserIdentifierValue> | |
<UserIdentifierType>Barcode</UserIdentifierType> | |
</UserId> | |
<UserElementType>User Address Information</UserElementType> | |
<UserElementType>Block Or Trap</UserElementType> | |
<UserElementType>Name Information</UserElementType> | |
<UserElementType>User Privilege</UserElementType> | |
</LookupUser> | |
</NCIPMessage> | |
<!-- You need to fill in values for the empty tags: FromAgencyId/AgencyId, ToAgencyId/AgencyId, and UserId/UserIdentifierValue. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# --------------------------------------------------------------- | |
# Copyright © 2015 Merrimack Valley Library Consortium | |
# Jason Stephenson <jstephenson@mvlc.org> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# --------------------------------------------------------------- | |
use Modern::Perl; | |
use LWP::UserAgent; | |
use Getopt::Long; | |
my ($url, $debug, $messageFile); | |
GetOptions("url=s" => \$url, "message=s" => \$messageFile) | |
or die("Error in command line arguments"); | |
open(my $fh, "<:encoding(utf8)", $messageFile) || die ("Can't open $messageFile"); | |
my $message = ""; | |
while (<$fh>) { | |
$message .= $_; | |
} | |
my $ua = LWP::UserAgent->new; | |
my $req = HTTP::Request->new(POST => $url); | |
$req->content($message); | |
my $res = $ua->request($req); | |
if ($res) { | |
print $res->status_line . "\n"; | |
print $res->content; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0' encoding='UTF-8'?> | |
<NCIPMessage version="http://www.niso.org/schemas/ncip/v2_02/ncip_v2_02.xsd" xmlns="http://www.niso.org/2008/ncip"> | |
<RequestItem> | |
<InitiationHeader> | |
<FromAgencyId> | |
<AgencyId></AgencyId> | |
</FromAgencyId> | |
<ToAgencyId> | |
<AgencyId></AgencyId> | |
</ToAgencyId> | |
</InitiationHeader> | |
<UserId> | |
<UserIdentifierType>Barcode Id</UserIdentifierType> | |
<UserIdentifierValue></UserIdentifierValue> | |
</UserId> | |
<BibliographicId> | |
<BibliographicRecordId> | |
<BibliographicRecordIdentifier></BibliographicRecordIdentifier> | |
<BibliographicRecordIdentifierCode>SYSNUMBER</BibliographicRecordIdentifierCode> | |
</BibliographicRecordId> | |
</BibliographicId> | |
<RequestId> | |
<AgencyId></AgencyId> | |
<RequestIdentifierValue></RequestIdentifierValue> | |
</RequestId> | |
<RequestType>Hold</RequestType> | |
<RequestScopeType>Bibliographic Item</RequestScopeType> | |
<ItemElementType>Bibliographic Description</ItemElementType> | |
<ItemElementType>Circulation Status</ItemElementType> | |
</RequestItem> | |
</NCIPMessage> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nciprequest.pl is the script. The XML files are sample messages. You will need to fill in appropriate values for the empty fields. Note that dates are to be entered in ISO 8601 format and are assumed to be UTC, that means you need to adjust them for your time zone offset from UTC.