Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

namespace problem in the SoapParser of Core #210

Open
epicureanism opened this issue Feb 28, 2017 · 13 comments · May be fixed by #467
Open

namespace problem in the SoapParser of Core #210

epicureanism opened this issue Feb 28, 2017 · 13 comments · May be fixed by #467
Milestone

Comments

@epicureanism
Copy link

epicureanism commented Feb 28, 2017

We have a simple SOS 2.0 test via SOAP, the testing endpoints and request body were saved as the POSTMAN collection which can be imported to see the req/res body:
https://www.getpostman.com/collections/e72b39d08ff37f1e4e0b

This problem was originally produced from
SOS 2.0 Test Suite GetObservation-Test fail for SOAP.
After some detail investigations, this problem might be redirected to the SoapParser which can't handle the inline namespace declaration.

The response body can be validated using other tools without any problem.
But the teamegine reports there is an error for the unrecognized namespace which was defined inline in the soap body, the response is like the following image:
https://github.com/opengeospatial/ets-sos20/blob/master/src/site/resources/img/soap-response-error-desc.png
the xml as well:
https://raw.githubusercontent.com/opengeospatial/ets-sos20/master/src/main/resources/sos-soap-response-demo.xml

The gml namespace was declared in line 6 and again in the om:result (line 26), but in line 28, the namespace was ignored by the SoapParser which causes the error.
In the other hand, the XmlValidatingParser works well without the same problem if there is no Soap wrapper for the response body. So we think it might be the problem from the SoapParser.

@keshavnangare
Copy link
Contributor

@epicureanism

Thanks for reporting this issue.

Can you please provide us capability URL to reproduce this issue.

I have tried with the following URL:

http://sensorweb.demo.52north.org/52n-sos-webapp/service/kvp

But it failing immediately with soap request. It would be great if you provide us steps to reproduce this issue.

I have a query with the following screenshots:

sos20_form

Thank you.

@keshavnangare
Copy link
Contributor

@epicureanism

I have executed the sos20 test with the following capability URL:

http://sensorweb.demo.52north.org/52n-sos-webapp/service?service=SOS&request=GetCapabilities&AcceptVersions=2.0.0

The SOS test failing with the two tests. TestResult

1. sos:GRTRequestValidRequest_resultRetrieval

Cause: The prefix (soap12) is not able to resolve from the XPath and not able to get the expected value.
If you observed the below request and response, it has the different prefix, prefix in XPath is soap12 and in response "soap" that's why the XPath is not able to get that value.

XPath:

<xsl:variable name="responseRoot" select="local-name-from-QName(node-name($GetResultTemplateResponse/*[1]))" />
<xsl:variable name="responseRoot2" select="local-name-from-QName(node-name($GetResultTemplateResponse/soap12:Envelope/soap12:Body/*[1]))" />
SOAP request: 
<soap-env:Envelope xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope">
  <soap-env:Body>
  <sos:GetResultTemplate xmlns:sos="http://www.opengis.net/sos/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="SOS" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0.0/sos.xsd">
  <sos:offering>http://www.52north.org/test/offering/1</sos:offering>
  <sos:observedProperty>http://www.52north.org/test/observableProperty/1</sos:observedProperty>
  </sos:GetResultTemplate>
  </soap-env:Body>
</soap-env:Envelope>

Response:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows/1.1" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
  <soap:Header/>
  <soap:Body>
  <soap:Fault>
  <soap:Code>
  <soap:Value>soap:Sender</soap:Value>
  <soap:Subcode>
  <soap:Value xmlns:ns="http://www.opengis.net/ows/1.1">ns:InvalidPropertyOfferingCombination</soap:Value>
  </soap:Subcode>
  </soap:Code>
  <soap:Reason>
  <soap:Text xml:lang="en">Observations for the requested combination of observedProperty and offering do not use SWE Common encoded results.</soap:Text>
  </soap:Reason>
  <soap:Detail>
  <ows:Exception exceptionCode="InvalidPropertyOfferingCombination">
  <ows:ExceptionText>For the requested combination offering (http://www.52north.org/test/offering/1) and observedProperty (http://www.52north.org/test/observableProperty/1) no SWE Common 2.0 encoded result values are available!</ows:ExceptionText>
  </ows:Exception>
  </soap:Detail>
  </soap:Fault>
  </soap:Body>
</soap:Envelope>
  1. sos:GOBIRequestValidRequest_obsByIdRetrieval

Cause: This test failed due to the ows:parameter[name="Observation"] did not have the expected child nodes "ows:AllowedValues/ows:Value[1]"

XPath: "$getCapabilitiesResponse//ows:OperationsMetadata/ows:Operation[@name='GetObservationById']/ows:Parameter[@name='observation']/ows:AllowedValues/ows:Value[1]"

Request:

<sos:GetCapabilities service="SOS" xmlns:sos="http://www.opengis.net/sos/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd 
	http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sos.xsd"
	xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" >
</sos:GetCapabilities>

Response with highlighted part:

sos_server_response

Only two tests are failing but I am not able to reproduce the same issue that you have reported. It will be great if you provide steps to reproduce this issue, so we can figure out the exact issue

let me know your thought on above test failures.

Thank you!!!

@epicureanism
Copy link
Author

@keshav-nangare
Thanks for your help. Here are some details about this test.

  1. Endpoint:
    http://sensorweb.demo.52north.org/52n-sos-webapp/sos/soap
  2. Request Body:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
	xmlns:ns="http://www.opengis.net/gml/3.2"
    xmlns:env="http://www.w3.org/2003/05/soap-envelope"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd">
    <env:Body>
<sos:GetObservation service="SOS" version="2.0.0" xmlns:sos="http://www.opengis.net/sos/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd 
    http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sos.xsd"
    xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" ></sos:GetObservation>      
</env:Body>
</env:Envelope>
  1. Response Body:
<?xml version="1.0" encoding="UTF-8"?>
<sos:GetObservationResponse 
    xmlns:sos="http://www.opengis.net/sos/2.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:om="http://www.opengis.net/om/2.0" 
    xmlns:gml="http://www.opengis.net/gml/3.2" 
    xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sos/2.0 http://schemas.opengis.net/sos/2.0/sosGetObservation.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd http://www.opengis.net/om/2.0 http://schemas.opengis.net/om/2.0/observation.xsd">
    <sos:observationData>
        <om:OM_Observation gml:id="o_119F914A8F8F1E1F6025756E9F3D63BBBA50AA9E">
            <om:type xlink:href="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CountObservation"/>
            <om:phenomenonTime>
                <gml:TimeInstant gml:id="phenomenonTime_442">
                    <gml:timePosition>2016-11-19T17:45:15.000Z</gml:timePosition>
                </gml:TimeInstant>
            </om:phenomenonTime>
            <om:resultTime xlink:href="#phenomenonTime_442"/>
            <om:procedure xlink:href="http://www.52north.org/test/procedure/9"/>
            <om:observedProperty xlink:href="http://www.52north.org/test/observableProperty/9_2"/>
            <om:featureOfInterest xlink:href="http://www.52north.org/test/featureOfInterest/9"/>
            <om:result 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:integer">3
            </om:result>
        </om:OM_Observation>
    </sos:observationData>
    <sos:observationData>
        <om:OM_Observation gml:id="o_4BB6C4F47B7985BE4144BA98AECB84014AF92826">
            <om:phenomenonTime>
                <gml:TimeInstant gml:id="phenomenonTime_441">
                    <gml:timePosition>2012-11-19T17:45:15.000Z</gml:timePosition>
                </gml:TimeInstant>
            </om:phenomenonTime>
            <om:resultTime xlink:href="#phenomenonTime_441"/>
            <om:procedure xlink:href="http://www.52north.org/test/procedure/9"/>
            <om:observedProperty xlink:href="http://www.52north.org/test/observableProperty/9_2"/>
            <om:featureOfInterest xlink:href="http://www.52north.org/test/featureOfInterest/9"/>
            <om:result 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:integer">3
            </om:result>
        </om:OM_Observation>
    </sos:observationData>
    <sos:observationData>
        <om:OM_Observation gml:id="o_5C2D4B29FDA1639D63152D9B91F5AB1120BFB739">
            <gml:description>test description for this observation</gml:description>
            <gml:identifier codeSpace="http://www.opengis.net/def/nil/OGC/0/unknown">http:/www.tsuruoka-nct.ac.jp/test/observation/0</gml:identifier>
            <om:type xlink:href="http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"/>
            <om:phenomenonTime>
                <gml:TimeInstant gml:id="phenomenonTime_430">
                    <gml:timePosition>2012-11-19T17:45:15.000Z</gml:timePosition>
                </gml:TimeInstant>
            </om:phenomenonTime>
            <om:resultTime xlink:href="#phenomenonTime_430"/>
            <om:procedure xlink:href="http://www.tsuruoka-nct.ac.jp/test/procedure/0"/>
            <om:observedProperty xlink:href="http://www.tsuruoka-nct.ac.jp/test/observableProperty/Temperature"/>
            <om:featureOfInterest xlink:href="http://www.52north.org/test/featureOfInterest/9"/>
            <om:result 
                xmlns:ns="http://www.opengis.net/gml/3.2" uom="test_unit_9_3" xsi:type="ns:MeasureType">0.28
            </om:result>
        </om:OM_Observation>
    </sos:observationData>
</sos:GetObservationResponse>

Other Ref:
screenshots using TestNG:
step1
step2

@keshavnangare
Copy link
Contributor

@epicureanism Thanks for the details.

I will try to reproduce this issue.

@bermud
Copy link
Contributor

bermud commented Mar 9, 2017

@keshav-nangare, The response body is valid. We might need to find where in TE the validation is occurring for further debugging. Is the ns:MeasureType that is causing the problem.

<om:result xmlns:ns="http://www.opengis.net/gml/3.2" uom="test_unit_9_3" xsi:type="ns:MeasureType">0.28 </om:result>

@dstenger
Copy link
Contributor

dstenger commented Apr 4, 2018

@keshav-nangare Can you please do further investigation?

@keshavnangare
Copy link
Contributor

@dstenger

I did some workaround and found the root cause. This issue is occurring due to the schema document of the SoapParser.
The SoapParser is using the schema documentation i.e. teamengine-resources/schema/soap12.xsd.

The response is validated with the soap12.xsd and we get the following error:

Validation error:&#xD;
  cvc-elt.4.2: Cannot resolve 'ns:MeasureType' to a type definition for element 'om:result'.&#xD;

@dstenger
Copy link
Contributor

@keshav-nangare
Did you validate the response documented in #210 (comment)?
Actually, the error cannot derive from SOAP schema and the response of the comment is valid.

As epicureanism already describes in the first comment, the error probably derives from SoapParser not being able to handle the inline namespace declaration.

In this case, the ns prefix is not recognized as GML namespace.

@keshavnangare
Copy link
Contributor

Yes. I have validated the response and succeded but if we try to validate with the SoapParser schema then the ns prefix error is getting.

Here is the SoapParserSchema

@ghobona
Copy link
Contributor

ghobona commented Jan 20, 2021

MeasureType is defined in basicTypes.xsd.

The SOAP Envelope example imports gml.xsd. However, gml.xsd does not include basicTypes.xsd. That is what is causing the error.

The solution is to import gmlBase.xsd because it includes both basicTypes.xsd and gml.xsd.

@dstenger
Copy link
Contributor

dstenger commented Jan 27, 2021

@keshavnangare
Copy link
Contributor

I implemented the JUnit test for SoapParser and tried with the above comment variations but it is still failing with the same validation error mentioned in the comment.

@keshavnangare keshavnangare linked a pull request Apr 7, 2021 that will close this issue
@keshavnangare
Copy link
Contributor

I have added the JUnit test for SoapParser. Please find the changes in #467 PR.

@dstenger dstenger added this to the 6.0 milestone Feb 10, 2022
@dstenger dstenger modified the milestones: 6.0, 6.1 Feb 13, 2023
@dstenger dstenger added this to CITE Aug 1, 2024
@dstenger dstenger moved this to Needs discussion in CITE Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs discussion
Development

Successfully merging a pull request may close this issue.

6 participants