Originally I wrote the code in Perl, but I had to change it to Python.

def http_post(url, username, password, content):
                user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) 
Gecko/20100101 Firefox/25.0'
                base64string = base64.standard_b64encode('%s:%s' % (username, 
password))
                headers = { 'User-Agent' : user_agent , 'Content-Type' : 
'text/xml', 'Authorization' : 'Basic %s' % base64string }
                request = urllib2.Request(url, content, headers)
                try:
                                result = urllib2.urlopen(request)
                                print result.read()
                except urllib2.URLError as e:
                                if hasattr(e, 'reason'):
                                                print 'We failed to reach a 
server.'
                                                print 'Reason: ', e.reason
                                elif hasattr(e, 'code'):
                                                print 'The server couldn\'t 
fulfill the request.'
                                                print 'Error code: ', e.code

username = sys.argv[1];
password = sys.argv[2];
data = sys.argv[3];
fqhn = sys.argv[4];

url = 'https://' + fqhn + ':7502/GeoServer/rest/workspaces/'
content = '<workspace><name>CADRG</name>'
http_post(url, username, password, content)

url = 'https://' + fqhn + 
':7502/GeoServer/rest/workspaces/CADRG/coveragestores?configure=all'
content = 
'<coverageStore><workspace>CADRG</workspace><name>JNC</name><enabled>true</enabled><type>ImagePyramid</type><url>'
 + data + '/CADRG/JNC</url></coverageStore>'
http_post(url, username, password, content)

url = 'https://' + fqhn + 
':7502/GeoServer/rest/workspaces/CADRG/coveragestores/JNC/coverages'
content = 
'<coverage><name>JNC</name><title>JNC</title><nativeCRS>GEOGCS[&quot;WGS 
84&quot;,DATUM[&quot;World Geodetic System 1984&quot;,SPHEROID[&quot;WGS 
84&quot;,6378137.0, 298.257223563, 
AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],PRIMEM[&quot;Greenwich&quot;,
 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]],UNIT[&quot;degree&quot;, 
0.017453292519943295],AXIS[&quot;Geodetic longitude&quot;, 
EAST],AXIS[&quot;Geodetic latitude&quot;, 
NORTH],AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</nativeCRS><srs>EPSG:4326</srs>
  
<latLonBoundingBox><minx>-180</minx><maxx>198.95057449425533</maxx><miny>-83.07692315384841</miny><maxy>83.076923</maxy><crs>EPSG:4326</crs></latLonBoundingBox></coverage>'
http_post(url, username, password, content)

From: Ballance, Melody (IS)
Sent: Wednesday, October 23, 2013 1:03 PM
To: Mauro Bartolomeoli
Cc: [email protected]; Laratta, David (IS)
Subject: RE: EXT :Re: [Geoserver-users] GeoServer 2.3.4 imagepyramid plugin and 
SSL and J2EE login

Mauro,
                I am cc'ing David on this and he will provide the command that 
is being used.  I GREATLY appreciate your support with this.

Thanks,
Melody

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Mauro Bartolomeoli
Sent: Wednesday, October 23, 2013 12:59 PM
To: Ballance, Melody (IS)
Cc: 
[email protected]<mailto:[email protected]>
Subject: EXT :Re: [Geoserver-users] GeoServer 2.3.4 imagepyramid plugin and SSL 
and J2EE login

Hi Melody,
could you please share the REST command you are using to create the image 
pyramid data store?

Thanks,
Mauro

2013/10/23 Ballance, Melody (IS) 
<[email protected]<mailto:[email protected]>>
I have installed and configured GeoServer 2.3.4 on Oracle WebLogic server with 
SSL enabled.  I have disabled all the authentication filters for all the filter 
chains except a newly create J2EE authentication filter.
We can successfully create a workspace via rest but when we attempt to create 
the image pyramid data store it fails.  And the following is the log of this 
error.

2013-10-23 13:21:09,735 INFO [catalog.rest] - POST workspace CADRG
2013-10-23 13:21:09,811 INFO [org.geoserver] - Loaded store 'JNC', enabled
2013-10-23 13:21:09,817 INFO [catalog.rest] - POST coverage store JNC
2013-10-23 13:21:09,882 INFO [org.geoserver] - Loaded coverage 'JNC', disabled
2013-10-23 13:21:09,886 ERROR [geoserver.rest] - :This plugin accepts only 
File, URL and String pointing to a file
2013-10-23 13:21:09,886 ERROR [geoserver.rest] -
org.geoserver.rest.RestletException: java.lang.IllegalArgumentException: This 
plugin accepts only File, URL and String pointing to a file
  at 
org.geoserver.rest.ReflectiveResource.handleException(ReflectiveResource.java:325)
  at 
org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:123)
  at org.restlet.Finder.handle(Finder.java:296)
  at 
org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet.java:37)
  at org.restlet.Filter.doHandle(Filter.java:105)
  at org.restlet.Filter.handle(Filter.java:134)
  at org.restlet.Router.handle(Router.java:444)
  at org.geoserver.rest.RESTDispatcher$1.handle(RESTDispatcher.java:204)
  at 
com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConverter.java:129)
  at 
org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatcher.java:86)

Thanks,
Melody
Melody Ballance, Senior Software Engineer
Northrop Grumman ISS/DSD
468 Viking Drive
Virginia Beach, VA 23452
(757)498-5508<tel:%28757%29498-5508> - office
(757)498-5670<tel:%28757%29498-5670> - fax
[email protected]<mailto:[email protected]> - email
"There are two ways to be fooled. One is to believe in what isn't true; the 
other is to refuse to believe what is true."  Soren Kierkegaard


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/geoserver-users



--
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more 
information.
==

Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to