[INSPIRE] Test tool for Atom based INSPIRE Download Services

Angelo Quaglia angelo.quaglia at ext.jrc.ec.europa.eu
Tue Apr 9 10:26:07 CEST 2013


Hi Armin,
The following php code works for me.

<?php

$destination =
"http://inspire-geoportal.ec.europa.eu/GeoportalProxyWebServices/resources/I
NSPIREResourceTester";
 
$eol = "\r\n";
$data = '';
 
$mime_boundary=md5(time());
 
$data .= '--' . $mime_boundary . $eol;
$data .= 'Content-Disposition: form-data; name="resourceRepresentation"' .
$eol . $eol;
$data .=
"http://map1.naturschutz.rlp.de/service_lanis/mod_wms/wms_getmap.php?mapfile
=naturschutzgebiet&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS" .
$eol;
$data .= '--' . $mime_boundary . $eol;
//$data .= 'Content-Disposition: form-data; name="somefile";
filename="filename.ext"' . $eol;
//$data .= 'Content-Type: text/plain' . $eol;
//$data .= 'Content-Transfer-Encoding: base64' . $eol . $eol;
//$data .= chunk_split(base64_encode("Some file content")) . $eol;
//$data .= "--" . $mime_boundary . "--" . $eol ; // finish with two eol's!!
$data .= $eol; // finish with two eol's!!
 
$params = array('http' => array(
                  'method' => 'POST',
                  'header' => 'Content-Type: multipart/form-data; boundary='
. $mime_boundary . $eol,
                  'content' => $data
               ));
 
$ctx = stream_context_create($params);
$response = @file_get_contents($destination, FILE_TEXT, $ctx);

print $response
?>






Ing. Angelo Quaglia
External Consultant
European Commission, DG Joint Research Centre
Institute for Environment and Sustainability
Digital Earth and Reference Data Unit, T.P. 262 
Via E. Fermi, 2749. 
I-21027 Ispra (VA)
Italy 
Tel: +39 0332 78 5325
Fax: +39 0332 78 6325
e-mail: mailto:angelo.quaglia at ext.jrc.ec.europa.eu
URL:
http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.h
tml
 
The views expressed are purely those of the writer and may not in any
circumstances be regarded as stating an official position of the European
Commission.


-----Original Message-----
From: Armin Retterath [mailto:armin.retterath at lvermgeo.rlp.de] 
Sent: Tuesday, April 09, 2013 9:47 AM
To: Angelo Quaglia
Subject: Re: [INSPIRE] Test tool for Atom based INSPIRE Download Services

Hello Angelo,

the wadl is now accessable - thanx.

Armin



On 09.04.2013 09:39, Angelo Quaglia wrote:
> Hi Armin,
> Thanks I will try that code.
> In the meantime I have fixed a typo in the configuration which indeed 
> made the wadl inaccessible, sorry!
> Many thanks for raising the issue.
> Could you please try if now you can see the wadl document?
>
> Angelo
>
>
> -----Original Message-----
> From: Armin Retterath [mailto:armin.retterath at lvermgeo.rlp.de]
> Sent: Tuesday, April 09, 2013 9:26 AM
> To: Angelo Quaglia
> Subject: Re: [INSPIRE] Test tool for Atom based INSPIRE Download 
> Services
>
> Hi Angelo,
>
> I use the follwoning syntax:
>
> $fields = array(
>               'dataFile'=>urlencode($xml)
>               );
> $fileId = guid();
> //generate temporary file under tmp
> if($h = fopen(TMPDIR."/".$fileId."iso19139_validate_tmp.xml","w")){
>       if(!fwrite($h,$xml)){
>           $e = new mb_exception("mod_layerISOMetadata: cannot write to
> file: ".TMPDIR."iso19139_validate_tmp.xml");
>       }
>       fclose($h);
> }
> //send file as post like described under
> http://www.tecbrat.com/?itemid=13&catid=1
> $fields['dataFile']='@'.TMPDIR.'/'.$fileId.'iso19139_validate_tmp.xml'
> ;
> $postData = $fields;
> $validatorInterfaceObject->set('httpPostFieldsNumber',count($postData)
> ); $validatorInterfaceObject->set('curlSendCustomHeaders',true);
> $validatorInterfaceObject->set('httpPostData', $postData); //give an 
> array $validatorInterfaceObject->load($validatorUrl);
>
> The object is handled as in the old webservice - generate a temporary 
> xml file and use the way above
>
> In the connector class following is done:
>
>           if(strtoupper($this->httpType) == 'POST'){
>               if (isset($this->accept) && $this->accept != "") {
>                   $headers = array(
>                       "POST ".$path." HTTP/1.1",
>                                "Content-type: 
> ".$this->httpContentType."; charset=".CHARSET,
>                              "Cache-Control: no-cache",
>                               "Pragma: no-cache",
>                               "Content-length:
".strlen($this->httpPostData)
>                   );
>               } else {
>                   $headers = array(
>                       "POST ".$path." HTTP/1.1",
>                       "Accept".$this->accept,
>                                "Content-type: 
> ".$this->httpContentType."; charset=".CHARSET,
>                              "Cache-Control: no-cache",
>                               "Pragma: no-cache",
>                               "Content-length:
".strlen($this->httpPostData)
>                   );
>               }
>               $e = new mb_notice("connector: CURL POST:
> ".$this->httpPostData);
>               $e = new mb_notice("connector: CURL POST length:
> ".strlen($this->httpPostData));
>
>               if ($this->curlSendCustomHeaders) {
>                   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
>               }
>               if ($this->httpPostFieldsNumber != 1){ 
> curl_setopt($ch,CURLOPT_POST,$this->httpPostFieldsNumber);
>               } else {
>                   curl_setopt($ch, CURLOPT_POST, 1);
>               }
>               curl_setopt($ch, CURLOPT_POSTFIELDS, $this->httpPostData);
>           }
>
> So i use curl_setopt($ch, CURLOPT_POSTFIELDS, and give an assoziative 
> array with the key 'dataFile' and value -> the xml.
>
> Hope that helps ;-)
>
> Armin
>
>
>
>
>
>
> On 09.04.2013 08:57, Angelo Quaglia wrote:
>> Hi Armin,
>> I have just tried to use the published form and I see the HTTP 500 in 
>> the
>> logs:
>>
>> 83.243.48.2 - - [09/Apr/2013:08:55:25 +0200] "POST 
>> /GeoportalProxyWebServices/resources/INSPIREResourceTester HTTP/1.1"
>> 500
>> 2923 "-" "-"
>>
>> So the request is processed.
>> Nothing is dumped, though and I do not see what is actually sent to 
>> the Web Service.
>> What is the text that is being sent?
>>
>> Angelo
>>
>>
>>
>> -----Original Message-----
>> From: Armin Retterath [mailto:armin.retterath at lvermgeo.rlp.de]
>> Sent: Tuesday, April 09, 2013 8:24 AM
>> To: Angelo Quaglia
>> Subject: Re: [INSPIRE] Test tool for Atom based INSPIRE Download 
>> Services
>>
>> Hi Angelo,
>>
>> here is a html metadata form:
>> http://www.geoportal.rlp.de/mapbender/php/mod_showMetadata.php?langua
>> g
>> eCode=
>> en&resource=layer&layout=tabs&id=30825
>> In the tab "Interfaces" there is the Link to invoke your webservice:
>> http://www.geoportal.rlp.de/mapbender/php/mod_layerISOMetadata.php?SE
>> R VICE=W MS&outputFormat=iso19139&Id=30825&validate=true
>>
>> I also get a 403 if I try to open your wadl:
>> http://inspire-geoportal.ec.europa.eu/GeoportalProxyWebServices/resou
>> r
>> ces/ap
>> plication.wadl
>> It may not be allowed.
>>
>> I call the webservice via php interface. There is a own connector 
>> class and i use php5-libcurl.
>>
>> I use POST, set own headers:
>> contentType is multipart/form-data
>> accept is text/html
>>
>> and the url is:
>> http://inspire-geoportal.ec.europa.eu/GeoportalProxyWebServices/resou
>> r
>> ces/IN
>> SPIREResourceTester
>>
>> - first time there was an error in the url - sorry a blank was in it.
>>
>> Now I get http 500.
>>
>> Maybe you can invoke it by your own and see something in the logfiles?
>>
>> The old validator was called in the same manner - only accept was not 
>> set to text/html.
>>
>> Thanx
>>
>> Armin
>>
>>
>> On 09.04.2013 08:01, Angelo Quaglia wrote:
>>> Hi Armin,
>>>
>>>     
>>>
>>> It must be working since  the html form at 
>>> http://inspire-geoportal.ec.europa.eu/validator2/index.html uses the 
>>> very same web service.
>>>
>>>     
>>>
>>> It really depends on the method you are requesting.
>>>
>>>     
>>>
>>> Could you please send me the code you are using?
>>>
>>>     
>>>
>>> Here is the firebug session for the browser interaction through the
form:
>>>
>>>     
>>>
>>>     
>>>
>>>
>>>
>>>     
>>>
>>>
>>>
>>>     
>>>
>>> Ing. Angelo Quaglia
>>>
>>> External Consultant
>>>
>>> European Commission, DG Joint Research Centre Institute for 
>>> Environment and Sustainability
>>>
>>> Digital Earth and Reference Data Unit, T.P. 262
>>>
>>> Via E. Fermi, 2749.
>>> I-21027 Ispra (VA)
>>> Italy
>>>
>>> Tel: +39 0332 78 5325
>>> Fax: +39 0332 78 6325
>>> e-mail:  <mailto:angelo.quaglia at ext.jrc.ec.europa.eu>
>>> mailto:angelo.quaglia at ext.jrc.ec.europa.eu
>>>
>>> URL:
>>>
>
<http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.
>>> html>
>>> http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-q
>>> u
>>> a
>>> glia.h
>>> tml
>>>
>>>     
>>>
>>> The views expressed are purely those of the writer and may not in 
>>> any circumstances be regarded as stating an official position of the 
>>> European Commission.
>>>
>>>     
>>>
>>> From: Armin Retterath [mailto:armin.retterath at gmail.com]
>>> Sent: Monday, April 08, 2013 6:53 PM
>>> To: Angelo Quaglia
>>> Subject: Re: [INSPIRE] Test tool for Atom based INSPIRE Download 
>>> Services
>>>
>>>     
>>>
>>> Hello Angelo,
>>>
>>> i get a 403 - maybe you have to activate the service for external usage?
>>>
>>> It may be a similar problem a had with ckan some weeks ago.
>>>
>>> Thanx in advance
>>>
>>> Armin
>>>
>>>     
>>>
>>> 2013/4/8 Angelo Quaglia <angelo.quaglia at ext.jrc.ec.europa.eu>
>>>
>>> Hi Armin,
>>>
>>>
>>>
>>> You have certainly seen already this:
>>> http://inspire-geoportal.ec.europa.eu/validator2/html/usingaswebserv
>>> i
>>> c
>>> e.html
>>>
>>>
>>>
>>> That page links also to
>>> http://inspire-geoportal.ec.europa.eu/GeoportalProxyWebServices/reso
>>> u
>>> r
>>> ces/ap
>>> plication.wadl
>>>
>>>
>>>
>>> <resource path="INSPIREResourceTester">
>>>
>>>                   <method name="POST" id="create">
>>>
>>>                                  <request>
>>>
>>>                                                 <representation 
>>> mediaType="multipart/form-data"/>
>>>
>>>                                  </request>
>>>
>>>                                  <response>
>>>
>>>                                                 <representation 
>>> mediaType="text/html"/>
>>>
>>>                                  </response>
>>>
>>>                   </method>
>>>
>>>                   <method name="PUT" id="putXml">
>>>
>>>                                  <request>
>>>
>>>                                                 <representation 
>>> mediaType="application/xml"/>
>>>
>>>                                                 <representation 
>>> mediaType="text/plain"/>
>>>
>>>                                  </request>
>>>
>>>                                  <response>
>>>
>>>                                                 <representation 
>>> mediaType="application/vnd.eu.europa.ec.inspire.resource+xml"/>
>>>
>>>                                  </response>
>>>
>>>                   </method>
>>>
>>>                   <method name="POST" id="testFromService">
>>>
>>>                                  <request>
>>>
>>>                                                 <representation 
>>> mediaType="multipart/form-data"/>
>>>
>>>                                  </request>
>>>
>>>                                  <response>
>>>
>>>                                                 <representation 
>>> mediaType="application/xml"/>
>>>
>>>                                  </response>
>>>
>>>                   </method>
>>>
>>>                   <method name="POST" id="testFromServiceClient">
>>>
>>>                                  <request>
>>>
>>>                                                 <representation 
>>> mediaType="text/plain"/>
>>>
>>>                                  </request>
>>>
>>>                                  <response>
>>>
>>>                                                 <representation 
>>> mediaType="application/xml"/>
>>>
>>>                                  </response>
>>>
>>>                   </method>
>>>
>>>                   <resource path="{locator: .*}">
>>>
>>>                                  <param 
>>> xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string"
>>> style="template" name="locator"/>
>>>
>>>                                  <method name="GET" id="getXml">
>>>
>>>                                                 <response>
>>>
>>>                                                                
>>> <representation mediaType="application/xml"/>
>>>
>>>                                                 </response>
>>>
>>>                                  </method>
>>>
>>>                   </resource>
>>>
>>> </resource>
>>>
>>>
>>>
>>> The part in bold is the one used by the validator test page 
>>> http://inspire-geoportal.ec.europa.eu/validator2/index.html
>>>
>>>
>>>
>>> What kind of environments are you referring to? Do you mean, for 
>>> example Java and .NET?
>>>
>>>
>>>
>>> Since the Web Service has a RESTful implementation, there should be 
>>> less dependency from the platform of the client.
>>>
>>>
>>>
>>> Best regards,
>>>
>>> Angelo
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Ing. Angelo Quaglia
>>>
>>> External Consultant
>>>
>>> European Commission, DG Joint Research Centre Institute for 
>>> Environment and Sustainability
>>>
>>> Digital Earth and Reference Data Unit, T.P. 262
>>>
>>> Via E. Fermi, 2749.
>>> I-21027 Ispra (VA)
>>> Italy
>>>
>>> Tel: +39 0332 78 5325 <tel:%2B39%200332%2078%205325>
>>> Fax: +39 0332 78 6325 <tel:%2B39%200332%2078%206325>
>>> e-mail:  <mailto:angelo.quaglia at ext.jrc.ec.europa.eu>
>>> mailto:angelo.quaglia at ext.jrc.ec.europa.eu
>>>
>>> URL:
>>>
>
<http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.
>
<http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.
>>> html>
>>> html>
>>> http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-q
>>> u
>>> a
>>> glia.h
>>>
>
<http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.
>>> html>
>>> tml
>>>
>>>
>>>
>>> The views expressed are purely those of the writer and may not in 
>>> any circumstances be regarded as stating an official position of the 
>>> European Commission.
>>>
>>>
>>>
>>> From: Angelo Quaglia [mailto:angelo.quaglia at ext.jrc.ec.europa.eu]
>>> Sent: Friday, February 01, 2013 4:11 PM
>>> To: 'inspire at fossgis.de'
>>> Subject: Test tool for Atom based INSPIRE Download Services
>>>
>>>
>>>
>>> Hi,
>>>
>>> I noticed the following mail thread:
>>>
>>>
>>>
>>> https://lists.fossgis.de/pipermail/inspire/2012-November/000029.html
>>>
>>>
>>>
>>>> I don't know any Testing Software, but JRC told, that they will 
>>>> validate those documents ;-) . The current INSPIRE Proxy only 
>>>> validate the ISO19139 files.
>>> If you submit the endpoint of the atom feed (i.e.
>>> http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?
>>> id=aaa
>>> <http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.p
>>> h
>>> p
>>> ?id=aa
>>> a492a3-0585-e27f-ff56-df9118420560>
>>> 492a3-0585-e27f-ff56-df9118420560
>>> <http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.p
>>> h
>>> p
>>> ?id=aa
>>> <http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.p
>>> h
>>> p
>>> ?id=aa
>>> a492a3-0585-e27f-ff56-df9118420560&type=SERVICE&generateFrom=wmslaye
>>> r
>>> &
>>> layeri
>>> d=32566>
>>> a492a3-0585-e27f-ff56-df9118420560&type=SERVICE&generateFrom=wmslaye
>>> r & layeri d=32566> 
>>> &type=SERVICE&generateFrom=wmslayer&layerid=32566
>>> ), the INSPIRE Geoportal Validator ( 
>>> http://inspire-geoportal.ec.europa.eu/validator2/ ) will validate 
>>> the feed and all linked download datasets.
>>>
>>>
>>>
>>> http://inspire-geoportal.ec.europa.eu/resources/sandbox/INSPIRE-30c3
>>> 4
>>> 2
>>> b2-6c8
>>> <http://inspire-geoportal.ec.europa.eu/resources/sandbox/INSPIRE-30c
>>> 3
>>> 4
>>> 2b2-6c
>>> 81-11e2-928f-52540004b857_20130201-160809/services/1/resourceReport/
>>> > 
>>> 1-11e2-928f-52540004b857_20130201-160809/services/1/resourceReport/
>>>
>>>
>>>
>>>
>>>
>>> Best regards,
>>>
>>>
>>>
>>> Angelo Quaglia
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Ing. Angelo Quaglia
>>>
>>> External Consultant
>>>
>>> European Commission, DG Joint Research Centre Institute for 
>>> Environment and Sustainability
>>>
>>> Digital Earth and Reference Data Unit, T.P. 262
>>>
>>> Via E. Fermi, 2749.
>>> I-21027 Ispra (VA)
>>> Italy
>>>
>>> Tel: +39 0332 78 5325 <tel:%2B39%200332%2078%205325>
>>> Fax: +39 0332 78 6325 <tel:%2B39%200332%2078%206325>
>>> e-mail:  <mailto:angelo.quaglia at ext.jrc.ec.europa.eu>
>>> mailto:angelo.quaglia at ext.jrc.ec.europa.eu
>>>
>>> URL:
>>>
>
<http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.
>
<http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.
>>> html>
>>> html>
>>> http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-q
>>> u
>>> a
>>> glia.h
>>>
>
<http://ies.jrc.ec.europa.eu/SDI/sdi-about-us/staff-profiles/angelo-quaglia.
>>> html>
>>> tml
>>>
>>>
>>>
>>> The views expressed are purely those of the writer and may not in 
>>> any circumstances be regarded as stating an official position of the 
>>> European Commission.
>>>
>>>
>>>
>>> -------------- next part -------------- An HTML attachment was 
>>> scrubbed...
>>> URL:
>>> <https://lists.fossgis.de/pipermail/inspire/attachments/20130408/6b8
>>> 1
>>> f
>>> 178/at
>>> tachment.htm>
>>> _______________________________________________
>>> Inspire mailing list
>>> Inspire at fossgis.de
>>> https://lists.fossgis.de/mailman/listinfo/inspire
>>>
>>>     
>>>
>>>     
>>>
>>> -------------- next part -------------- An HTML attachment was 
>>> scrubbed...
>>> URL:
>>> <https://lists.fossgis.de/pipermail/inspire/attachments/20130409/4c8
>>> 4
>>> f
>>> 82f/attachment.htm>
>>> -------------- next part -------------- A non-text attachment was 
>>> scrubbed...
>>> Name: image001.png
>>> Type: image/png
>>> Size: 97745 bytes
>>> Desc: not available
>>> URL:
>>> <https://lists.fossgis.de/pipermail/inspire/attachments/20130409/4c8
>>> 4
>>> f
>>> 82f/image001.png>
>>> -------------- next part -------------- A non-text attachment was 
>>> scrubbed...
>>> Name: image002.png
>>> Type: image/png
>>> Size: 42538 bytes
>>> Desc: not available
>>> URL:
>>> <https://lists.fossgis.de/pipermail/inspire/attachments/20130409/4c8
>>> 4 f 82f/image002.png> 
>>> _______________________________________________
>>> Inspire mailing list
>>> Inspire at fossgis.de
>>> https://lists.fossgis.de/mailman/listinfo/inspire
>>>
>> --
>> Zentrale Stelle Geodateninfrastruktur Rheinland-Pfalz LVermGeo-RP
>>
>> Ferdinand-Sauerbruch-Straße 15
>> 56073 Koblenz
>>
>> 0261/492-466
>> armin.retterath at lvermgeo.rlp.de
>> http://www.geoportal.rlp.de
>>
>>
>>
>
> --
> Zentrale Stelle Geodateninfrastruktur
> Rheinland-Pfalz
> LVermGeo-RP
>
> Ferdinand-Sauerbruch-Straße 15
> 56073 Koblenz
>
> 0261/492-466
> armin.retterath at lvermgeo.rlp.de
> http://www.geoportal.rlp.de
>
>
>


--
Zentrale Stelle Geodateninfrastruktur
Rheinland-Pfalz
LVermGeo-RP

Ferdinand-Sauerbruch-Straße 15
56073 Koblenz

0261/492-466
armin.retterath at lvermgeo.rlp.de
http://www.geoportal.rlp.de




More information about the Inspire mailing list