Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

NASA-PDS/pds-api#125 #107

Closed
wants to merge 4 commits into from
Closed

NASA-PDS/pds-api#125 #107

wants to merge 4 commits into from

Conversation

al-niessner
Copy link
Contributor

@al-niessner al-niessner commented Dec 28, 2021

🗒️ Summary

Reworked the XML serialization.

⚙️ Test Data and/or Report

$ curl --location --request GET 'http://localhost:8080/products/urn:nasa:pds:izenberg_pdart14_meap:document:ns_inst::1.0' --header 'Accept: application/xml'
<PdsProduct xmlns="http://pds.nasa.gov/api"><id>urn:nasa:pds:izenberg_pdart14_meap:document:ns_inst::1.0</id><type>Product_Document</type><title>MESSENGER Neutron Spectrometer (NS) Description</title><description/><start_date_time/><stop_date_time/><investigations><investigations><title/><id>urn:nasa:pds:context:investigation:mission.messenger</id><href>http://localhost:8080/products/urn:nasa:pds:context:investigation:mission.messenger</href><type/><description/></investigations></investigations><observing_system_components><observing_system_components><title/><id>urn:nasa:pds:context:instrument_host:spacecraft.mess</id><href>http://localhost:8080/products/urn:nasa:pds:context:instrument_host:spacecraft.mess</href><type/><description/></observing_system_components><observing_system_components><title/><id>urn:nasa:pds:context:instrument:ns.mess</id><href>http://localhost:8080/products/urn:nasa:pds:context:instrument:ns.mess</href><type/><description/></observing_system_components></observing_system_components><targets><targets><title/><id>urn:nasa:pds:context:target:planet.mercury</id><href>http://localhost:8080/products/urn:nasa:pds:context:target:planet.mercury</href><type/><description/></targets></targets><metadata xmlns=""><creation_date_time xmlns="http://pds.nasa.gov/api"/><update_date_time xmlns="http://pds.nasa.gov/api"/><version xmlns="http://pds.nasa.gov/api">1.0</version><label_url xmlns="http://pds.nasa.gov/api">/var/local/harvest/archive/document/ns_inst.xml</label_url></metadata><properties/></PdsProduct>


$ curl --location --request GET 'http://localhost:8080/products/urn:nasa:pds:izenberg_pdart14_meap:document:ns_inst::1.0' --header 'Accept: application/pds4+xml'
<Pds4Product><id>urn:nasa:pds:izenberg_pdart14_meap:document:ns_inst::1.0</id><metadata><node_name>PSA</node_name><label_file><file_name>ns_inst.xml</file_name><file_ref>/var/local/harvest/archive/document/ns_inst.xml</file_ref><creation_date>2021-05-12T18:17:17Z</creation_date><file_size>3589</file_size><md5_checksum>a8d09cca0a01728db50c15052c2736cf</md5_checksum></label_file><data_files><data_files><file_name>ns_inst.pdf</file_name><file_ref>/var/local/harvest/archive/document/ns_inst.pdf</file_ref><creation_date>2021-05-12T18:17:17Z</creation_date><file_size>138172</file_size><md5_checksum>8103f20c13a3c321dac4a193aba19d16</md5_checksum><mime_type>application/pdf</mime_type></data_files></data_files></metadata><pds4/></Pds4Product>

♻️ Related Issues

NASA-PDS/pds-api#125

@al-niessner al-niessner self-assigned this Dec 28, 2021
Al Niessner added 2 commits December 30, 2021 15:18
While it may not be perfect, it is working again. Might need to change tag names or namespaces or some other aspect but this gets it going again.
Again, might not be generating the currect tags etc. but it is generating valid XML.
@al-niessner al-niessner requested a review from a team as a code owner December 30, 2021 23:56
@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl @jordanpadams

All XML is turned back on and producing XML. May not be the super correct tags etc but let me know and we can work through the details. However, valid XML should now be generated. See NASA-PDS/pds-api-javalib#17 for changes necessary for this code to function. 0.5.0-SNAPSHOT is up to date on swaggerhub and the pull request simply shows difference between what is needed and what is on main. Something else completely is on mvn site.

Copy link
Member

@tloubrieu-jpl tloubrieu-jpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Al,

At first sight, I am seeing 2 things to work on:

  1. With this request:
    curl --location --request GET 'http://localhost:8080/products'
    --header 'Accept: application/xml'

There are multiple namespace prefixes which are redundant, see:

  <wstxns1:q xmlns:wstxns1="http://pds.nasa.gov/api"/>
        <wstxns2:hits xmlns:wstxns2="http://pds.nasa.gov/api">25</wstxns2:hits>
        <wstxns3:took xmlns:wstxns3="http://pds.nasa.gov/api">956</wstxns3:took>
        <wstxns4:start xmlns:wstxns4="http://pds.nasa.gov/api">0</wstxns4:start>
        <wstxns5:limit xmlns:wstxns5="http://pds.nasa.gov/api">100</wstxns5:limit>
        <wstxns6:sort xmlns:wstxns6="http://pds.nasa.gov/api"/>
        <wstxns7:properties xmlns:wstxns7="http://pds.nasa.gov/api">
            <wstxns7:properties>_package_id</wstxns7:properties>
            <wstxns7:properties>description</wstxns7:properties>
            <wstxns7:properties>insight:Observation_Information.insight:mission_phase_name</wstxns7:properties>

They all (wstxns1, wstnx2, ...) have the same reference ("http://pds.nasa.gov/api") so we don't need multiple entries. I guess this is an effect of the marshalling library.

  1. with request:
    curl --location --request GET 'http://localhost:8080/products'
    --header 'Accept: application/pds4+xml'

The pds4 xml is still encoded in the result.

The decoding function was in code in the past, maybe you can find it otherwise you can ask Eugene.

@jordanpadams
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants