| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | BEGIN{push @INC, "./../blib/lib/"} | ||
| 4 | |||
| 5 | use Biblio::ILL::ISO::Request; | ||
| 6 | |||
| 7 | # | ||
| 8 | # transaction-id | ||
| 9 | # | ||
| 10 | my $tid = new Biblio::ILL::ISO::TransactionId("PLS","001","", | ||
| 11 | new Biblio::ILL::ISO::SystemId("MWPL")); | ||
| 12 | |||
| 13 | # | ||
| 14 | # service-date-time | ||
| 15 | # | ||
| 16 | my $sdt = new Biblio::ILL::ISO::ServiceDateTime( new Biblio::ILL::ISO::DateTime("20030623","114400"), | ||
| 17 | new Biblio::ILL::ISO::DateTime("20030623","114015") | ||
| 18 | ); | ||
| 19 | |||
| 20 | # | ||
| 21 | # requester-id | ||
| 22 | # | ||
| 23 | my $reqid = new Biblio::ILL::ISO::SystemId(); | ||
| 24 | $reqid->set_person_name("David A. Christensen"); | ||
| 25 | |||
| 26 | # | ||
| 27 | # responder-id | ||
| 28 | # | ||
| 29 | my $resid = new Biblio::ILL::ISO::SystemId("MWPL"); | ||
| 30 | |||
| 31 | # | ||
| 32 | # transaction-type | ||
| 33 | # | ||
| 34 | my $tt = new Biblio::ILL::ISO::TransactionType("simple"); | ||
| 35 | |||
| 36 | # | ||
| 37 | # delivery-address | ||
| 38 | # | ||
| 39 | my $da = new Biblio::ILL::ISO::DeliveryAddress( new Biblio::ILL::ISO::SystemAddress("SMTP","DChristens\@gov.mb.ca"), | ||
| 40 | new Biblio::ILL::ISO::PostalAddress("Manitoba Public Library Services", | ||
| 41 | "", | ||
| 42 | "Unit 200", | ||
| 43 | "1525 First Street South", | ||
| 44 | "", | ||
| 45 | "Brandon", | ||
| 46 | "MB", | ||
| 47 | "CANADA", | ||
| 48 | "R7A 7A1" | ||
| 49 | ) | ||
| 50 | ); | ||
| 51 | |||
| 52 | # | ||
| 53 | # delivery-service | ||
| 54 | # | ||
| 55 | my $ds = new Biblio::ILL::ISO::DeliveryService( new Biblio::ILL::ISO::TransportationMode("Canada Post") ); | ||
| 56 | |||
| 57 | # | ||
| 58 | # iLL-service-type | ||
| 59 | # | ||
| 60 | my $ists = new Biblio::ILL::ISO::ILLServiceTypeSequence( new Biblio::ILL::ISO::ILLServiceType("loan"), | ||
| 61 | new Biblio::ILL::ISO::ILLServiceType("copy-non-returnable") | ||
| 62 | ); | ||
| 63 | $ists->add(new Biblio::ILL::ISO::ILLServiceType("locations")); #example of adding to a sequence_of | ||
| 64 | |||
| 65 | # | ||
| 66 | # requester-optional-messages | ||
| 67 | # | ||
| 68 | my $rom = new Biblio::ILL::ISO::RequesterOptionalMessageType(1,1,"desires","requires"); | ||
| 69 | |||
| 70 | # | ||
| 71 | # search-type | ||
| 72 | # | ||
| 73 | my $st = new Biblio::ILL::ISO::SearchType("need-Before-Date","1","20030720"); | ||
| 74 | |||
| 75 | # | ||
| 76 | # supply-medium-into-type | ||
| 77 | # | ||
| 78 | my $smit = new Biblio::ILL::ISO::SupplyMediumInfoType("photocopy","legal-size paper"); | ||
| 79 | my $smits = new Biblio::ILL::ISO::SupplyMediumInfoTypeSequence( $smit ); | ||
| 80 | |||
| 81 | # | ||
| 82 | # place-on-hold | ||
| 83 | # | ||
| 84 | my $poh = new Biblio::ILL::ISO::PlaceOnHoldType("no"); | ||
| 85 | |||
| 86 | # | ||
| 87 | # client-id | ||
| 88 | # | ||
| 89 | my $cid = new Biblio::ILL::ISO::ClientId("David Christensen","Most excellent","007"); | ||
| 90 | |||
| 91 | # | ||
| 92 | # item-id | ||
| 93 | # | ||
| 94 | my $iid = new Biblio::ILL::ISO::ItemId("My Book","David Christensen","CHR001.1"); | ||
| 95 | $iid->set_item_type("monograph"); | ||
| 96 | $iid->set_medium_type("printed"); | ||
| 97 | $iid->set_pagination("456"); | ||
| 98 | $iid->set_publication_date("2003"); | ||
| 99 | |||
| 100 | # | ||
| 101 | # cost-info-type | ||
| 102 | # | ||
| 103 | my $cit = new Biblio::ILL::ISO::CostInfoType("","","","PLS001","\$40.00"); | ||
| 104 | |||
| 105 | # | ||
| 106 | # third-party-info-type | ||
| 107 | # | ||
| 108 | my $stlts = new Biblio::ILL::ISO::SendToListTypeSequence( new Biblio::ILL::ISO::SendToListType( new Biblio::ILL::ISO::SystemId("MBOM") )); | ||
| 109 | $stlts->add(new Biblio::ILL::ISO::SendToListType( new Biblio::ILL::ISO::SystemId("MWPL"), | ||
| 110 | new Biblio::ILL::ISO::AccountNumber("PLS001"), | ||
| 111 | new Biblio::ILL::ISO::SystemAddress("SMTP","pls\@gov.mb.ca") | ||
| 112 | ) | ||
| 113 | ); | ||
| 114 | my $atlt = new Biblio::ILL::ISO::AlreadyTriedListType( new Biblio::ILL::ISO::SystemId("BVAS") ); | ||
| 115 | $obj = new Biblio::ILL::ISO::SystemId(); | ||
| 116 | $obj->set_institution_name("Winnipeg Public Library"); | ||
| 117 | $atlt->add($obj); | ||
| 118 | $obj = new Biblio::ILL::ISO::SystemId(); | ||
| 119 | $obj->set_person_name("Frank Emil Urwald"); | ||
| 120 | $atlt->add($obj); | ||
| 121 | $atlt->add( new Biblio::ILL::ISO::SystemId("MBOM")); | ||
| 122 | my $tpit = new Biblio::ILL::ISO::ThirdPartyInfoType(1,1,1,1,"ordered", | ||
| 123 | new Biblio::ILL::ISO::SystemAddress("SMTP","David_A_Christensen\@hotmail.com"), | ||
| 124 | $stlts, | ||
| 125 | $atlt | ||
| 126 | ); | ||
| 127 | |||
| 128 | |||
| 129 | #------------------------------------------------------------------------------------------- | ||
| 130 | |||
| 131 | my $msg = new Biblio::ILL::ISO::Request(); | ||
| 132 | |||
| 133 | # Minimum required: | ||
| 134 | $msg->set_protocol_version_num("version-2"); | ||
| 135 | $msg->set_transaction_id( $tid ); | ||
| 136 | $msg->set_service_date_time( $sdt ); | ||
| 137 | $msg->set_transaction_type( $tt ); | ||
| 138 | $msg->set_ILL_service_type_sequence( $ists ); | ||
| 139 | $msg->set_requester_optional_messages( $rom ); | ||
| 140 | $msg->set_place_on_hold( $poh ); | ||
| 141 | $msg->set_item_id( $iid ); | ||
| 142 | $msg->set_retry_flag("false"); | ||
| 143 | $msg->set_forward_flag("true"); | ||
| 144 | |||
| 145 | # Extra, useful info: | ||
| 146 | $msg->set_requester_id( $reqid ); | ||
| 147 | $msg->set_responder_id( $resid ); | ||
| 148 | $msg->set_delivery_address( $da ); | ||
| 149 | $msg->set_billing_address( $da ); | ||
| 150 | $msg->set_delivery_service( $ds ); | ||
| 151 | $msg->set_search_type( $st ); | ||
| 152 | $msg->set_supply_medium_info_type_sequence( $smits ); | ||
| 153 | $msg->set_client_id( $cid ); | ||
| 154 | |||
| 155 | $msg->set_cost_info_type( $cit ); | ||
| 156 | $msg->set_copyright_compliance("CanCopy"); | ||
| 157 | $msg->set_third_party_info_type( $tpit ); | ||
| 158 | $msg->set_requester_note("This is a requester note"); | ||
| 159 | $msg->set_forward_note("This is a forward note"); | ||
| 160 | |||
| 161 | # | ||
| 162 | #print $msg->as_pretty_string(); | ||
| 163 | # | ||
| 164 | #my $href = $msg->as_asn(); | ||
| 165 | #print $msg->debug($href); | ||
| 166 | # | ||
| 167 | #$msg->encode(); | ||
| 168 | # | ||
| 169 | |||
| 170 | $msg->write("msg_01.request.ber"); | ||
| 171 | |||
| 172 | #print "---end---\n"; | ||
| 173 |