We need a private module feed for Orchard. I'm a bit of a novice when it comes to web services, but the problem we seem to be having is in the different schemas. I set up my remote feed as per Creating Remote Feeds:
http://docs.nuget.org/docs/creating-packages/hosting-your-own-nuget-feeds
For this web service the schema is:
<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="http://localhost:57641/nuget/">
<workspace>
<atom:title>Default</atom:title>
<collection href="Packages">
<atom:title>Packages</atom:title>
</collection>
</workspace>
</service>
Yet the Orchard schema contains a Screenshots element:
<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="http://packages.orchardproject.net/FeedService.svc/">
<workspace>
<atom:title>Default</atom:title>
<collection href="Packages">
<atom:title>Packages</atom:title>
</collection>
<collection href="Screenshots">
<atom:title>Screenshots</atom:title>
</collection>
</workspace>
</service>
Is there a way I can configure the Nuget.Server web service to expose this too?
It's quite non-trivial now, as the orchard gallery server and nuget server definitions parted ways somewhat. You can just about get it working by altering the Orchard gallery codebase (it expects several items that are not present in the data), but we abandoned our attempt in the end, as the complexity and altering the core code base was not worth the gain
Related
while I'm Passing an entity in the URL its saying ...
Could not find an entity set or function import for 'Books'.
I'm trying to expose an "ODataService" of book and publisher in Java. Code is very long. so can you suggest me what might be the possible cause for this??
I guess that you didn't define an entity set (Books) for an entity type (Book for example) within your EDM provider. To check this, you can have the look at the root URL of your service (for example http://services.odata.org/V4/OData/OData.svc/). I think that, in your case, no collection entry is defined for Books :
<service xmlns="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
xml:base="http://services.odata.org/V4/OData/OData.svc/"
m:context="http://services.odata.org/V4/OData/OData.svc/$metadata">
<workspace>
<atom:title type="text">Default</atom:title>
<collection href="Books">
<atom:title type="text">Books</atom:title>
</collection>
(...)
</workspace>
</service>
You could also check if an entity type is defined of type Book. See a link like that http://services.odata.org/V4/OData/OData.svc/$metadata.
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"
Version="4.0">
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm"
Namespace="ODataDemo">
<EntityType Name="Book">
(...)
</EntityType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
The following link provides you a comprehensive description of how to implement an OData service with Olingo v4:
https://templth.wordpress.com/2015/04/27/implementing-an-odata-service-with-olingo/
See section "Implementing a custom EdmProvider" to see how to implement an EDM provider with Olingo.
Hope it will help you,
Thierry
I read a really cool blog about using Autofac to completely decouple an application. But try as I might (and being horribly new to all this), I just couldn't get Autofac to gel.
I turned to Unity from the MS Patterns & Practices Enterprise Library and that went a whole lot better. To make things unnecessarily hard for myself, I separated out all my stuff into projects as:
UnityDi (Console app)
UnityDi.Contracts (Interfaces)
UntiyDi.Domain (Classes)
UnityDi.Repositories (Data Access)
UnityDi.Services (Access to repository through a service layer)
I used XML configuration to pony up Unity:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
</configSections>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<assembly name="UnityDi.Contracts" />
<assembly name="UnityDi.Domain" />
<assembly name="UnityDi.Services" />
<assembly name="UnityDi.Repositories" />
<namespace name="UnityDi.Contracts" />
<namespace name="UnityDi.Domain" />
<namespace name="UnityDi.Services" />
<namespace name="UnityDi.Repositories" />
<container>
<register type="IUser" mapTo="User"></register>
<register type="IUserService" mapTo="UserService"></register>
<register type="IUserRepository" mapTo="UserRepository"></register>
</container>
</unity>
</configuration>
And got that into a running app, no worries:
private static readonly IUnityContainer Container = new UnityContainer();
...
Container.LoadConfiguration();
BUT in order to do so, I need a reference to all the above projects from my console app.
Is there a way to make the app only ever have a reference to UnityDi.Contracts (the interfaces)? Then the app is well and truly decoupled (admittedly with a sledgehammer).
I hope that is enough of an explanation, I'm totally new to this and I'm being extreme like this to facilitate better learning.
I suspect the reason it looks like you need project references is that without them, VS won't copy the assemblies into your apps bin folder when you hit F5. How would it, it has no way of knowing you need them!
The project references are the quickest solution to the problem. The other thing you could do is add a post-build step to copy the appropriate DLLs to end up in the right directory so you can run the app.
I got 1 Azure web role for multiple websites, and it worked, the code in "ServiceDefinition.csdef" looks like:
<Sites>
<Site name="SiteA" physicalDirectory="..\SiteA">
<Bindings>
<Binding name="HttpBinding" endpointName="HttpEndpoint" hostHeader="a.com" />
</Bindings>
</Site>
<Site name="SiteB" physicalDirectory="..\SiteB">
<Bindings>
<Binding name="HttpBinding" endpointName="HttpEndpoint" hostHeader="b.com" />
</Bindings>
</Site>
<Site name="SiteC" physicalDirectory="..\SiteC">
<Bindings>
<Binding name="HttpBinding" endpointName="HttpEndpoint" hostHeader="c.com" />
</Bindings>
</Site>
</Sites>
A, B, C all works.
but the situation is, A, B, C are projects, need to build ( as release ) to get them work well.
What Azure tool (in Visual Studio) does is just simply copy them (the folder) not build them ( as release). The result is, all files on server, even MVC patten works, but the Web.Release.config does not replace(a part of) Web.config, so some codes not work.
My question is, how to setup Azure support multiple projects, and build them as release, in one web role?
This might be a pretty basic issue but I feel like I'm way over my head with it. I created a client side web service java object using the customer provided wdsl (wsimport). the problem is that they are saying I need to include a security header so it will connect. the header is not in the WSDL. I did some research into this and it seems that I need to import a wsit-client.xml into it when I do the wsimport. I can't seem to find a clear example of this file. I have tried to piece one together from the example I have found but when I run wsimport it never seems to pick it up. here is what I have:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions targetNamespace="http://www.jboss.org/jbossws/ws-extensions/wssecurity" name="SecurityService"
xmlns:tns="http://www.jboss.org/jbossws/ws-extensions/wssecurity"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wspp="http://java.sun.com/xml/ns/wsit/policy"
xmlns:sc="http://schemas.sun.com/2006/03/wss/server"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<portType name="LOOKUP_PortType"/>
<binding name="LOOKUP_Binding" type="tns:LOOKUP_PortType">
<wsp:PolicyReference URI="#lookupSecurityPolicy"/>
</binding>
<service name="XXSW_GPOS_CUSTOMER_CREDIT_PKG_Service">
<port name="XXSW_GPOS_CUSTOMER_CREDIT_PKG_Port" binding="tns:LOOKUP_Binding"/>
</service>
<wsp:Policy wsu:Id="lookupSecurityPolicy">
<wsp:ExactlyOne>
<wsp:All>
<sc:CallbackHandlerConfiguration wspp:visibility="private">
<sc:CallbackHandler name="usernameHandler" default="username" />
<sc:CallbackHandler name="passwordHandler" default="password" />
</sc:CallbackHandlerConfiguration>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
</definitions>
the XML isn't malformed but I know I'm missing something or completely have the whole idea of this wrong. I really need a good walk through of how to create this but I can't seem to find one on the net. any help would be very appreciated.
wsit-client.xml is not used by wsimport. You put in in /META-INF/ and Metro reads it when you connect to the service.
I am super new to MVC (in fact, this is my first assignment)
So, I have a good webservice running, functional, on my local machine
http://www.codetrials.local/wcf/UserServices.svc?wsdl
and In my MVC application, I added a service reference as usual, and then in my Model.cs I am trying this:
using (CodeTrials.UserServicesClient _client = new UserServicesClient())
{
UserWebsite = _client.GetUserWebsite(username);
}
but when I try to run this, I always get the exception endpoint not found. I can access this from my (different) asp.net project and it works just fine, same code and everything. After some digging around I found this answer I modified my above code to:
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://www.codetrials.local/wcf/UserServices.svc");
using (CodeTrials.UserServicesClient _client = new UserServicesClient(binding, address))
{
UserWebsite = _client.GetUserWebsite(username);
}
but now, I get a new exception: There was no endpoint listening at http://www.codetrials.local/wcf/UserServices.svc?wsdl that could accept the message
So I am at my wits end.
I found a similar question but it's not what I am looking for.
Can you please guide me to the right path?
what am I not doing right?
should I shift the consuming of webservice from Model to Controller?
Thanks.
EDIT - This is my config file system.serviceModel section. I just copy pasted it from the WCF client test gui tool into web.config since it was not being generated by visual studio.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IUserServices" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.codetrials.local/wcf/UserServices.svc/wcf/UserServices.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserServices"
contract="IUserServices" name="BasicHttpBinding_IUserServices" />
</client>
</system.serviceModel>
Reposting from the comments since it turned out to be the answer. :) Turned out that web.debug.config was overwriting the web.config in this case.
Are you sure its in the right web.config then? VS should create it automatically when you add the service reference (it does for me at least). One gotcha is that a normal MVC app has two web.config files, there's a second one inside the Views folder by default. Other then that, I'm not really sure whats going on.
Your code shows you are using this URL: http://www.codetrials.local/wcf/UserServices.svc to access the service endpoint but your exception message says you are actually using http://www.codetrials.local/wcf/UserServices.svc?wsdl instead.
Check your MVC app web.config file for a serviceModel element. If you need to configure the WCF client in code then remove that entire element from the web.config file which may be where the wrong URL is coming from. If you do want to configure WCF from the web.config file, then remove your current code and use the following two lines to create the client and invoke the service:
var _client = new UserServicesClient("BasicHttpBinding_IUserServices");
UserWebsite = _client.GetUserWebsite(username);
where the something like the following section exists in your web.config serviceModel element:
<system.serviceModel>
<client>
<endpoint
name="BasicHttpBinding_IUserServices"
address="http://www.codetrials.local/wcf/UserServices.svc"
binding="basicHttpBinding"
contract="IUserServices" >
</endpoint>
</client>
<!-- rest of element snipped -->
Finally, you should not wrap the UserServicesClient instantiation in a using statement because of the reasons outlined in this post. WCF is a tricksty beast....
EDIT:
Based on the update with your config, your problem may be that the service URL is:
http://www.codetrials.local/wcf/UserServices.svc/wcf/UserServices.svc
The wcf/UserServices.svc seems to be duplicated.