Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 52DE7200BFA for ; Thu, 12 Jan 2017 14:48:54 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 51C5B160B2D; Thu, 12 Jan 2017 13:48:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 72472160B40 for ; Thu, 12 Jan 2017 14:48:53 +0100 (CET) Received: (qmail 40074 invoked by uid 500); 12 Jan 2017 13:48:52 -0000 Mailing-List: contact dev-help@olingo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@olingo.apache.org Delivered-To: mailing list dev@olingo.apache.org Received: (qmail 40051 invoked by uid 99); 12 Jan 2017 13:48:52 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jan 2017 13:48:52 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 7ABB22C0298 for ; Thu, 12 Jan 2017 13:48:52 +0000 (UTC) Date: Thu, 12 Jan 2017 13:48:52 +0000 (UTC) From: "Sumit (JIRA)" To: dev@olingo.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (OLINGO-1008) Metadata Parser is unable to parse external references of Microsoft dynamics CRM Odata metadata MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 12 Jan 2017 13:48:54 -0000 [ 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:48 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)