[
https://issues.apache.org/jira/browse/OLINGO-1008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15744731#comment-15744731
]
Sumit edited comment on OLINGO-1008 at 1/12/17 1:54 PM:
--------------------------------------------------------
I am also trying to connect to a Microsoft dynamics instance using Apache
olingo 4.4.0 and hitting the same issue.
The exception comes from following piece of code in
XMLMetadataRequestImpl.java. URL - [0]
/**
* Referenced document's URIs must only have the same scheme, host, and
port as the
* main metadata document's URI but don't have to start with the service
root
* as all other OData request URIs.
*/
@Override
protected void checkRequest(final ODataClient odataClient, final
HttpUriRequest request) {
if (parentURI == null) {
super.checkRequest(odataClient, request);
} else {
if (!parentURI.getScheme().equals(uri.getScheme())
|| !parentURI.getAuthority().equals(uri.getAuthority())) {
throw new IllegalArgumentException(
String.format("The referenced EDMX document has the URI '%s'"
+ " where scheme, host, or port is different from the main
metadata document URI '%s'.",
uri.toASCIIString(), parentURI.toASCIIString()));
}
}
}
Olingo restricts that the referenced document's scheme, host and port must be
same as main metadata document's schema port and document. I couldn't find any
such restriction being specified in by OData V4 protocol [1]
I have verified that if this restriction is removed (I commented out above
piece of code after cloning olingo source code and compiled it), parsing of the
metadata document succeeds without any issues.
Is there any specific reason why this restriction has been imposed ?
[0] -
https://github.com/apache/olingo-odata4/blob/8515b48dd5e09e4597d0b396326bd6a074efa1f5/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java#L159
[1] - http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html
was (Author: susharm):
I am also trying to connect to a Microsoft dynamics instance using Apache
olingo 4.4.0 and hitting the same issue.
The exception comes from following piece of code in
XMLMetadataRequestImpl.java. URL - [0]
{{
/**
* Referenced document's URIs must only have the same scheme, host, and
port as the
* main metadata document's URI but don't have to start with the service
root
* as all other OData request URIs.
*/
@Override
protected void checkRequest(final ODataClient odataClient, final
HttpUriRequest request) {
if (parentURI == null) {
super.checkRequest(odataClient, request);
} else {
if (!parentURI.getScheme().equals(uri.getScheme())
|| !parentURI.getAuthority().equals(uri.getAuthority())) {
throw new IllegalArgumentException(
String.format("The referenced EDMX document has the URI '%s'"
+ " where scheme, host, or port is different from the main
metadata document URI '%s'.",
uri.toASCIIString(), parentURI.toASCIIString()));
}
}
}
}}
Olingo restricts that the referenced document's scheme, host and port must be
same as main metadata document's schema port and document. I couldn't find any
such restriction being specified in by OData V4 protocol [1]
I have verified that if this restriction is removed (I commented out above
piece of code after cloning olingo source code and compiled it), parsing of the
metadata document succeeds without any issues.
Is there any specific reason why this restriction has been imposed ?
[0] -
https://github.com/apache/olingo-odata4/blob/8515b48dd5e09e4597d0b396326bd6a074efa1f5/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java#L159
[1] - http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html
> Metadata Parser is unable to parse external references of Microsoft dynamics
> CRM Odata metadata
> -----------------------------------------------------------------------------------------------
>
> Key: OLINGO-1008
> URL: https://issues.apache.org/jira/browse/OLINGO-1008
> Project: Olingo
> Issue Type: Bug
> Components: odata4-client
> Affects Versions: (Java) V4 4.2.0
> Reporter: Prashant Singh
>
> I am currently using Apache olingo 4.2.0 and facing issue while accessing the
> microsoft CRM metadata and getting following exception:
> java.lang.IllegalArgumentException: The referenced EDMX document has the URI
> 'http://vocabularies.odata.org/OData.Community.Keys.V1.xml' where scheme,
> host, or port is different from the main metadata document URI
> 'https://crmonlinebcone.crm8.dynamics.com/api/data/v8.1/$metadata'.
> at
> org.apache.olingo.client.core.communication.request.retrieve.XMLMetadataRequestImpl$SingleXMLMetadatRequestImpl.checkRequest(XMLMetadataRequestImpl.java:154)
> at
> org.apache.olingo.client.core.communication.request.AbstractODataRequest.doExecute(AbstractODataRequest.java:271)
> at
> org.apache.olingo.client.core.communication.request.retrieve.XMLMetadataRequestImpl$SingleXMLMetadatRequestImpl.execute(XMLMetadataRequestImpl.java:164)
> at
> org.apache.olingo.client.core.communication.request.retrieve.XMLMetadataRequestImpl.execute(XMLMetadataRequestImpl.java:74)
> at
> org.apache.olingo.client.core.communication.request.retrieve.XMLMetadataRequestImpl.execute(XMLMetadataRequestImpl.java:40)
> at
> org.apache.olingo.client.core.communication.request.retrieve.EdmMetadataRequestImpl.getPrivateResponse(EdmMetadataRequestImpl.java:58)
> at
> org.apache.olingo.client.core.communication.request.retrieve.EdmMetadataRequestImpl.execute(EdmMetadataRequestImpl.java:72)
> at
> org.apache.olingo.client.core.communication.request.retrieve.EdmMetadataRequestImpl.execute(EdmMetadataRequestImpl.java:35)
> at com.bcone.apache.plingo.odata.TestOData.main(TestOData.java:40)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)