Skip to content

Instantly share code, notes, and snippets.

@barmintor
Created January 30, 2015 20:02
Show Gist options
  • Save barmintor/6e0a65e0bf3ab4c8cbb9 to your computer and use it in GitHub Desktop.
Save barmintor/6e0a65e0bf3ab4c8cbb9 to your computer and use it in GitHub Desktop.
perl soap fedora whatever
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use SOAP::Lite (+trace => [qw (debug)], maptype => {});
use constant ENDPOINT => 'https://USER:PASSWORD@HOST:8443/fedora/services/management';
use constant NAMESPACE => 'http://www.fedora.info/definitions/1/0/types/';
my @args;
push @args, SOAP::Data->new( name => 'pid', value => 'demo:XML_TO_HTMLDOC');
push @args, SOAP::Data->new( name => 'dsID', value => 'RELS-EXT');
# there is no action in the WSDL operations, so SOAPAction header should be empty
SOAP::Lite->new->proxy( ENDPOINT )
->ns( NAMESPACE,'types')
->on_action( sub{ '' })
->getDatastream( @args );
@ruebot
Copy link

ruebot commented Jan 30, 2015

$ PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl bentest.pl 
SOAP::Transport::HTTP::Client::send_receive: POST http://fedoraAdmin:fedoraAdmin@localhost:8080/fedora/services/management HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 557
Content-Type: text/xml; charset=utf-8
SOAPAction: 

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:types="http://www.fedora.info/definitions/1/0/types/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><types:getDatastream><pid xsi:type="xsd:string">islandora:1</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Connection: close
Date: Fri, 30 Jan 2015 20:35:03 GMT
Server: Apache-Coyote/1.1
Content-Length: 757
Content-Type: text/xml;charset=UTF-8
Client-Date: Fri, 30 Jan 2015 20:35:03 GMT
Client-Peer: 127.0.0.1:8080
Client-Response-Num: 1
Set-Cookie: JSESSIONID=21C1AD63688DDB60DBFD054B6BDCEDC1; Path=/fedora

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:getDatastreamResponse xmlns:ns2="http://www.fedora.info/definitions/1/0/types/"><datastream><controlGroup>X</controlGroup><ID>RELS-EXT</ID><versionID>RELS-EXT.0</versionID><altIDs/><label>Fedora Object to Object Relationship Metadata.</label><versionable>true</versionable><MIMEType>application/rdf+xml</MIMEType><formatURI>info:fedora/fedora-system:FedoraRELSExt-1.0</formatURI><createDate>2015-01-29T21:25:06.895Z</createDate><size>565</size><state>A</state><location xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><checksumType>DISABLED</checksumType><checksum>none</checksum></datastream></ns2:getDatastreamResponse></soap:Body></soap:Envelope>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment