Odata URI service troubleshooting - odata

I have an OData URI generated by a consumer desktop application like so
http://localhost:32702/TBC/Projects/15f1360adb2e4008921b9b5bb849ae78/
Entering this into my browser I can view the atom XML and see collections that should be available
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<service xmlns="http://www.w3.org/2007/app" xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xml:base="http://localhost:32702/TBC/Projects/15f1360adb2e4008921b9b5bb849ae78/">
<workspace>
<atom:title>Default</atom:title>
<collection href="FeatureAttributes">
<atom:title>FeatureAttributes</atom:title>
</collection> -<collection href="Points">
<atom:title>Points</atom:title>
</collection> -<collection href="TotalStations">
<atom:title>TotalStations</atom:title>
</collection> -<collection href="Vectors">
<atom:title>Vectors</atom:title>
</collection>
</workspace>
</service>
So I then change my browser URI to include the Points collection or the Vectors collection
http://localhost:32702/TBC/Projects/15f1360adb2e4008921b9b5bb849ae78/Points
And it only returns the current date for each item I was expecting, no actual data. The count of items, however is accurate. I was hoping to be able to use this in a LinqPad or VB.Net query application, but I can't even get the browser queries to work. Is it me or is there an issue with the service? I've tried the URI in LinqPAD and in a test project with WCF Data Services and when I test the same URI I get a (500) Internal Server Error.
The vendor is not providing any support, so I was hoping someone here could give me some troubleshooting steps to show where the issue is at.
Edit:
I modified IE options > Content > Feed Settings by unchecking "Turn on feed reading view"
This allowed me to see the data from the returned entity collection. I can now try to use WebRequest to consume the XML data in a .net application.
Adding $metadata to the URI in the browser yields "Website cannot display the page". Which leads me to guess that only feeds are exposed and no services. I'm not sure if this is possible.
I'm still unable to use this URI in LinqPad or in visual studio using Add Service Reference. VS returns error "An error occurred while attempting to find service at URI.

I'm not sure about LinqPad, but "Add service reference" in Visual Studio expects a link to your $metadata endpoint or the service document (i.e., the first query in your question). You can access the Points collection using both of those tools as a secondary step.
I'm not sure why your $metadata endpoint is not showing up though. If you right-click and "view source", do you see the xml document there?

Related

Protocol Binding error with wildcard sub domains in Windows Azure websites

I have multi tenant MVC application running as an Azure website. Tenants are resolved by using sub domains. So tenant A can be resolved by http://tenanta.myapp.com. This works perfectly well as long as I go and create individual CNAME records on my DNS server for each tenant. However I do not want to have to do this.
So I successfully added a wildcard A record *.myapp.com to my DNS records and in azure I added a custom domain name *.MyApp.com. So now I can use http://anything.myapp.com and it will resolved to my azure website ok. So that was great and I thought I was up and running.
Until I tried to browse to a page that is using AJAX to call a WCF service (the WCF service is internal to the website). There are a bunch of WCF services and they all throw a 500.
System.UriFormatException: The protocol binding '*:80:*.myapp.com' is not valid for 'http'. This might be because the port number is out of range.
If I remove the *.myapp.com from the list of custom domains in Azure then I don't get the error but my wildcard subdomains no longer get directed to the website and I get a 404 from azure.
I've tried a few things with the bindings for the WCF services including trying all of the HostNameComparisonMode options StrongWildcard, WeakWildcard and Exact.
I was hoping someone else had come accross this problem before. There are bunch of posts on getting the wildcard subdomains working but nothing specific to the issue I am having with WCF services.
Thanks in advance
This might be due to a binding of the shape :80:.myapp.com gets created in the applicaitonHost.config when the wildcard custom domain name is added to the site (in Azure Web Sites service). We will investigate and try to get this fixed.
Meanwhile, it might be worth a try to clear the bindings section in your web.config and recreate a binding of the form
<binding protocol="http" bindinginformation="*:80:"/>
Let me know if this works.
To add on Zhe's answer here is how it can be done:
Create an applicationHost.xdt file under your 'site' folder, and copy the content below into it
(more info on transform on Kudu site)
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.applicationHost>
<sites>
<site name="%XDT_SITENAME%" xdt:Locator="Match(name)">
<bindings>
<binding protocol="http" bindingInformation="'*:80:*.myapp.com" xdt:Locator="Match(bindingInformation)" xdt:Transform="Remove" />
</bindings>
</site>
</sites>
</system.applicationHost>
</configuration>
In azure, for custom domain name, add * instead of *.myapp.com and that should work.

WCF showing the "You have created a service." page instead of WSDL

I have a WCF service running inside an ASP.NET MVC 4 application. The site is running on IIS8 on Server 2012. Until recently, the WSDL pages loaded without any problems. This week, the WSDL no longer loads. The link from the "Welcome" page is correct, but when I click it or attempt to generate a client, the same Welcome page is returned.
I have tried this using a ServiceRoute and also using an .svc file.
The ServiceRoute looks like this:
/DataService
Its WSDL link is:
/DataService?wsdl
The .svc file looks like:
/directory/otherdir/DataService.svc
The WSDL link is
/directory/otherdir/DataService.svc?wsdl
I never needed any configuration in the web.comfic section before, using the SerivceRoute.
How can I get WCF to show the WSDL correctly?
I ran into this before and there can be multiple reasons, the service is not functioning due to errors in the operations or you may be using WebServiceHostFactory instead of ServiceHostFactory
RouteTable.Routes.Add(new ServiceRoute("DataService", new ServiceHostFactory(), typeof(MyServiceType)));

Error when attempting to run application

I am moving an asp.net web forms application over to mvc. I want to re-use as much code as possible so I decided use my existing linq to sql library.
I am new to MVC, but have viewed numerous videos from PluralSite for direction.
I created a model library to work between the linq to sql and the web api. I had read that I needed to do this because of linq to sql's complexities.
I have also created a web api and started adding linq queries to the controllers.
public IList<Model.vSchedulesFill> GetCustomerSchedules(int id)
{
var sch = from p in _context.vSchedulesFills
where p.CustomerID == id
orderby p.SchedStartDateTime descending
select new Model.vSchedulesFill(p);
return sch.ToList();
}
I tested the above query using Fiddler and the result were good, so I tried to run the program and received the HTTP Error 403.14 - Forbidden error.
The database is on a remote server, but I am running the app in debug mode on my local machine.
The error mentions no default document or IIS directory browser not turned on.
I looked up the default document and saw a lot about adding the web api help file. So I went to NuGet and installed it, but the application still will not run.
I have looked all over for solution to this problem...
What am I doing wrong and what do I need to do to fix this?
Thanks for your help
Added
<directoryBrowse enabled="true" />
to web config under section system.webServer.
Can view directory but that's not what I needed. I basically wanted to be able to run the program and then type in the path in the address bar, like I did in Fiddler.
I didn't remove any of the default layout forms included in the web api project.
Thanks

Use FusionCharts in sandbox solution

Has anyone been successfully rendering charts using fusion charts in a sandboxed solution?
How would you get the SWF file onto SharePoint? I included it and deployed it via feature and the Elements.xml looks like the following:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="FusionCharts">
<File Path="FusionCharts\FCF_Column2D.swf" Url="FusionCharts/FCF_Column2D.swf" />
<File Path="FusionCharts\FCF_Gantt.swf" Url="FusionCharts/FCF_Gantt.swf" />
</Module>
</Elements>
When the sandbox solution is deployed, you can access the SWF file from http://sharepointsite/FusionCharts/FCF_Gantt.swf, the browser will attempt to open/save the file. If this file is deployed via farm solution, and be deployed to _layouts folder, which I can access via http://sharepointsite/_layouts/FusionCharts/FCF_Gantt.swf, it renders with error message "invalid xml data". The farm solution deployment is correct because MIME type is properly set to "application/x-shockwave-flash" and thus my custom web part which renders chart using this SWF file works. But if my sandboxed web part is to use the SWF file deployed as site pages, it does not work. Any idea?
Thanks in advance.
Sean
The problem is resolved with help from DevExpress team. Though SWF can be deployed to SharePoint site document library, you would need Farm Administrator to go into Central Admin pages and set the property in Application Management for the Web application to allow "Permissive". Go to Central Admin -> Application Management -> Select Web Application -> General Settings (Ribbon button), change "Browser File Handling" from "Restrict" to "Permissive".

Integrating FedEx Web Services into .Net, stuck at step 1

I'm signed up, I've downloaded sample code, I've got a WSDL...and yet I have no idea how to get this stuff into my existing .Net application. The WSDL was in a zip file, not a URL so I can't just "Add Web Reference." I've run the wsdl tool from the .Net command prompt, and it made a nice class for me...yet dropping that into my web_reference folder doesn't give me any kind of instantiatable class.
I know I'm missing something stupid. Can someone point me in the right direction please?
The proper way to load the FedEx API WSDL file in Visual Studio 2010:
Open the Solution Explorer
Right click your project
Click 'Add Service Reference'
Click the 'Advanced...' button
Click the 'Add Web Reference...' button
Enter the exact path to the WSDL file for the specific FedEx web reference you're using. For example, I extracted mine to the root of my C:\ drive, so all I entered into the URL field was "C:\ShipService.wsdl" without quotes. If you leave quotes, it won't work.
When you hit go, Visual Studio should consume the wsdl into workable classes for you. Click Add Reference and enjoy!
Note: Make sure you read the FedEx documentation well - a lot of their services have gotchyas and implementation can be a nightmare. For example, their address validation service is consumed incorrectly and creates two-dimensional arrays in Reference.cs where they shouldn't exist - this is detailed in the documentation. Worse yet, the fact that they don't allow address validation on their dev environment isn't documented anywhere! Good luck!
Actually, you can just "Add Web Reference". Give the path to the URL.
OTOH, you should be doing all new web service development (even client development) using WCF. Microsoft now considers ASMX web services to be "legacy technology".
BTW, I just tried using their address validation service, and it won't work with .NET. Both ASMX and WCF clients will attempt to use the XML serializer to consume this service, and there is a bug there that prevents that service from being used.
Matt, the WSDL zip file has the WSDL and its associated transactions for that service. Unzip the file and then "Add the reference" to the WSDL in your code.
Try changing the namespace of the proxy class to that of your application. I currently use the proxy class with C# and it works in spite of FedEx's limited documentation and samples.

Resources