Skip to content

Instantly share code, notes, and snippets.

@barmintor
Created January 30, 2015 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 https://fedoraAdmin:fedoraAdmin@localhost:8080/fedora/services/management HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 565
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">demo:XML_TO_HTMLDOC</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>

@ruebot
Copy link

ruebot commented Jan 30, 2015

$ PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl bentest.pl 
SOAP::Transport::HTTP::Client::send_receive: POST https://USER:PASSWORD@HOST:8443/fedora/services/management HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 565
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">demo:XML_TO_HTMLDOC</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to HOST:8443 (Bad hostname)
Content-Type: text/plain
Client-Date: Fri, 30 Jan 2015 20:17:40 GMT
Client-Warning: Internal response

Can't connect to HOST:8443 (Bad hostname)

LWP::Protocol::https::Socket: Bad hostname 'HOST' at /usr/local/share/perl/5.14.2/LWP/Protocol/http.pm line 49.
500 Can't connect to HOST:8443 (Bad hostname) at bentest.pl line 20
root@islandora-berkshelf:~# vim bentest.pl 
root@islandora-berkshelf:~# PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl bentest.pl 
SOAP::Transport::HTTP::Client::send_receive: POST https://fedoraAdmin:fedoraAdmin@HOST:8443/fedora/services/management HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 565
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">demo:XML_TO_HTMLDOC</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to HOST:8443 (Bad hostname)
Content-Type: text/plain
Client-Date: Fri, 30 Jan 2015 20:18:11 GMT
Client-Warning: Internal response

Can't connect to HOST:8443 (Bad hostname)

LWP::Protocol::https::Socket: Bad hostname 'HOST' at /usr/local/share/perl/5.14.2/LWP/Protocol/http.pm line 49.
500 Can't connect to HOST:8443 (Bad hostname) at bentest.pl line 20
root@islandora-berkshelf:~# cat /usr/local/fedora/install/install.properties 
#Install Options
#Thu Jan 29 20:38:32 UTC 2015
keystore.file=included
ri.enabled=true
messaging.enabled=true
apia.auth.required=false
database.jdbcDriverClass=com.mysql.jdbc.Driver
upstream.auth.enabled=false
ssl.available=false
database.jdbcURL=jdbc\:mysql\://localhost/fedora3?useUnicode\=true&amp;characterEncoding\=utf8&amp;autoReconnect\=true
messaging.uri=vm\:(broker\:(tcp\://localhost\:61616))
database.password=fedoraAdmin
database.mysql.driver=included
database.username=fedoraAdmin
fesl.authz.enabled=false
deploy.local.services=false
xacml.enabled=true
database.mysql.jdbcDriverClass=com.mysql.jdbc.Driver
tomcat.http.port=8080
fedora.serverHost=islandora-berkshelf
database=mysql
database.driver=included
fedora.serverContext=fedora
llstore.type=akubra-fs
tomcat.home=/var/lib/tomcat7
fesl.authn.enabled=true
database.mysql.jdbcURL=jdbc\:mysql\://localhost/fedora3?useUnicode\=true&amp;characterEncoding\=utf8&amp;autoReconnect\=true
fedora.home=/usr/local/fedora
install.type=custom
servlet.engine=included
apim.ssl.required=false
fedora.admin.pass=fedoraAdmin
apia.ssl.required=false
root@islandora-berkshelf:~# PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl bentest.pl 
SOAP::Transport::HTTP::Client::send_receive: POST https://fedoraAdmin:fedoraAdmin@HOST:8443/fedora/services/management HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 565
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">demo:XML_TO_HTMLDOC</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to HOST:8443 (Bad hostname)
Content-Type: text/plain
Client-Date: Fri, 30 Jan 2015 20:18:31 GMT
Client-Warning: Internal response

Can't connect to HOST:8443 (Bad hostname)

LWP::Protocol::https::Socket: Bad hostname 'HOST' at /usr/local/share/perl/5.14.2/LWP/Protocol/http.pm line 49.
500 Can't connect to HOST:8443 (Bad hostname) at bentest.pl line 20
root@islandora-berkshelf:~# vim bentest.pl 
root@islandora-berkshelf:~# PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl bentest.pl 
SOAP::Transport::HTTP::Client::send_receive: POST https://fedoraAdmin:fedoraAdmin@HOST:8080/fedora/services/management HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 565
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">demo:XML_TO_HTMLDOC</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to HOST:8080 (Bad hostname)
Content-Type: text/plain
Client-Date: Fri, 30 Jan 2015 20:18:44 GMT
Client-Warning: Internal response

Can't connect to HOST:8080 (Bad hostname)

LWP::Protocol::https::Socket: Bad hostname 'HOST' at /usr/local/share/perl/5.14.2/LWP/Protocol/http.pm line 49.
500 Can't connect to HOST:8080 (Bad hostname) at bentest.pl line 20
root@islandora-berkshelf:~# vim bentest.pl 
root@islandora-berkshelf:~# PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl bentest.pl 
SOAP::Transport::HTTP::Client::send_receive: POST https://fedoraAdmin:fedoraAdmin@localhost:8080/fedora/services/management HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 565
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">demo:XML_TO_HTMLDOC</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to localhost:8080
Content-Type: text/plain
Client-Date: Fri, 30 Jan 2015 20:19:19 GMT
Client-Warning: Internal response

Can't connect to localhost:8080

LWP::Protocol::https::Socket: SSL connect attempt failed because of handshake problems at /usr/local/share/perl/5.14.2/LWP/Protocol/http.pm line 49.
500 Can't connect to localhost:8080 at bentest.pl line 20

@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: 565
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">demo:XML_TO_HTMLDOC</pid><dsID xsi:type="xsd:string">RELS-EXT</dsID></types:getDatastream></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Connection: close
Date: Fri, 30 Jan 2015 20:30:01 GMT
Server: Apache-Coyote/1.1
Content-Length: 265
Content-Type: text/xml;charset=UTF-8
Client-Date: Fri, 30 Jan 2015 20:30:01 GMT
Client-Peer: 127.0.0.1:8080
Client-Response-Num: 1
Set-Cookie: JSESSIONID=0960CCCA8D751BBCBB915E43037625DC; Path=/fedora

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring> Caused by: Object not found in low-level storage: demo:XML_TO_HTMLDOC</faultstring></soap:Fault></soap:Body></soap:Envelope>

@barmintor
Copy link
Author

Make sure the port and protocol make sense, and make sure the pid parameter is for an object in the repo

@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