This is a migrated thread and some comments may be shown as answers.

Problems with local OData services

3 Answers 130 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Eli
Top achievements
Rank 1
Eli asked on 02 Dec 2011, 01:29 PM
hi,

I am trying to use a combo box (also tried it in autocomple and it didn't work).
I  took the code from your sample and it works fine in my test page (so links and scripts are ok), but when i try to change the address of the remote OData feed to my other project it does not show anything.
If i just copy the address to IE9 - the service look fine and i got data.
Any idea what i have done wrong? any tests i can do?

Thanks

Eli

3 Answers, 1 is accepted

Sort by
0
Ryan
Top achievements
Rank 1
answered on 27 Feb 2012, 05:17 AM
I am having the same problem with the same results , per the attached images. Are we able to explain why this is not working?
Let me know if there is anything I can give you to help you diagnose the problem.

Thanks
Ryan
0
Ryan
Top achievements
Rank 1
answered on 28 Feb 2012, 02:38 AM
I have some additional information for you. 
I have one of your examples working and the only difference is the odata service url.
Here is the not working example:

IMPORTANT: I notice when this non-working one executes, the request is bad and it is using "http://wcf-clsearch.ryanhelms.com/ServerDataService.svc/Servers?$format=json&$inlinecount=allpages&$callback=callback" ,,,, something seems weird there.

Request:     
$("#Server").kendoComboBox({
    dataTextField: "CompanyName",
    dataValueField: "SupplierID",
    dataSource: {
        type: "odata",
        serverFiltering: true,
        transport: {
        }
    },
    change: function () { }
}).data("kendoComboBox");

OData Service Response:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
  <title type="text">Servers</title>
  <updated>2012-02-28T01:33:57Z</updated>
  <link rel="self" title="Servers" href="Servers" />
  <entry>
    <id>http://wcf-clsearch.ryanhelms.com/ServerDataService.svc/Servers(guid'681782bb-bd74-485c-a7ca-0017078fe2a0')</id>
    <title type="text"></title>
    <updated>2012-02-28T01:33:57Z</updated>
    <author>
      <name />
    </author>
    <link rel="edit" title="Server" href="Servers(guid'681782bb-bd74-485c-a7ca-0017078fe2a0')" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/City" type="application/atom+xml;type=entry" title="City" href="Servers(guid'681782bb-bd74-485c-a7ca-0017078fe2a0')/City" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Country" type="application/atom+xml;type=entry" title="Country" href="Servers(guid'681782bb-bd74-485c-a7ca-0017078fe2a0')/Country" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Region" type="application/atom+xml;type=entry" title="Region" href="Servers(guid'681782bb-bd74-485c-a7ca-0017078fe2a0')/Region" />
    <category term="CraigsListSearcherModel.Server" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <content type="application/xml">
      <m:properties>
        <d:ID m:type="Edm.Guid">681782bb-bd74-485c-a7ca-0017078fe2a0</d:ID>
        <d:Url>http://corpuschristi.craigslist.org/<;/d:Url>
        <d:PostingPrefix>cor</d:PostingPrefix>
        <d:CountryID m:type="Edm.Int32">246</d:CountryID>
        <d:RegionID m:type="Edm.Int32">3237</d:RegionID>
        <d:CityID m:type="Edm.Int32">2849817</d:CityID>
      </m:properties>
    </content>
  </entry>
</feed>

For spaces sake, I cut all of the results from above except the first one, as there were a few hundred in the resultset.

Now, this next version works and populates the combobox.

Request:
$("#Server").kendoComboBox({
            dataTextField: "CompanyName",
            dataValueField: "SupplierID",
            dataSource: {
                type: "odata",
                serverFiltering: true,
                transport: {
                    read: "http://services.odata.org/Northwind/Northwind.svc/Suppliers"
                }
            },
            change: function () {}
        }).data("kendoComboBox");

OData Service Response:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
  <title type="text">Suppliers</title>
  <updated>2012-02-28T01:22:43Z</updated>
  <link rel="self" title="Suppliers" href="Suppliers" />
  <entry>
    <title type="text"></title>
    <updated>2012-02-28T01:22:43Z</updated>
    <author>
      <name />
    </author>
    <link rel="edit" title="Supplier" href="Suppliers(1)" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Products" type="application/atom+xml;type=feed" title="Products" href="Suppliers(1)/Products" />
    <category term="NorthwindModel.Supplier" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <content type="application/xml">
      <m:properties>
        <d:SupplierID m:type="Edm.Int32">1</d:SupplierID>
        <d:CompanyName>Exotic Liquids</d:CompanyName>
        <d:ContactName>Charlotte Cooper</d:ContactName>
        <d:ContactTitle>Purchasing Manager</d:ContactTitle>
        <d:Address>49 Gilbert St.</d:Address>
        <d:City>London</d:City>
        <d:Region m:null="true" />
        <d:PostalCode>EC1 4SD</d:PostalCode>
        <d:Country>UK</d:Country>
        <d:Phone>(171) 555-2222</d:Phone>
        <d:Fax m:null="true" />
        <d:HomePage m:null="true" />
      </m:properties>
    </content>
  </entry>
</feed>

Please explain the difference, since everything is exactly the same, except the fields in the results.

Thanks
Ryan
0
Georgi Krustev
Telerik team
answered on 29 Feb 2012, 09:49 AM
Hello,

The generated URL seems correct. Could you please verify that your service has the correct JSONP behavior. Check these links for more information:
http://archive.msdn.microsoft.com/DataServicesJSONP 
http://www.kendoui.com/blogs/archive/11-08-23/cross-domain_queries_to_odata_services_with_jquery.aspx 

Greetings,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
Eli
Top achievements
Rank 1
Answers by
Ryan
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or