7

In Tridion 2011 SP1 you could add a Service Reference to CoreService.svc without using the DLL. Is this still possible?

It seems that CoreService2010, CoreService2011 and CoreService2012 won't allow this.

Why does the Core Service not publish metadata and can it be configured to publish metadata?

I get the following error when trying to add the reference:

There was an error downloading 'http://tridion.local.com:8585/webservices/CoreService2011.svc/_vti_bin/ListData.svc/$metadata'. The underlying connection was closed: An unexpected error occurred on a receive. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host Metadata contains a reference that cannot be resolved: 'http://tridion.local.com:8585/webservices/CoreService2011.svc'. An error occurred while receiving the HTTP response to http://tridion.local.com:8585/webservices/CoreService2011.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. The underlying connection was closed: An unexpected error occurred on a receive. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host If the service is defined in the current solution, try building the solution and adding the service reference again.

3 Answers 3

10

The Tridion Core Service has SOAP web service contracts. So it should be able to create a Service Reference to it from your Visual Studio project. Mind that you need to add a Service Reference, not a normal Reference.

3
  • I've just posted the error and read it properly and it may be my fault :) Commented Mar 22, 2013 at 16:42
  • Just to confirm Jan's answer. I was working on a core service app on friday and only had a service reference to the core service and NOT a reference to the dll and it worked fine. Commented Mar 23, 2013 at 14:48
  • Hi, I can confirm that this does work in 2013. my problem was that I was using a virtual machine and not using the machine name it using NAT to go via port numbers causing a DNS issue. Commented Mar 24, 2013 at 12:44
6

If you wanted to make the connection in JAVA I used this Apache CXF and this command:
wsdl2java -frontend jaxws21 -client -d [output_locaiton] http://[host_locaiton]/webservices/CoreService2011.svc?wsdl
That will give you the java class to make the connection out of. Then you can just make a client out of it:

          CoreService2011 service = new CoreService2011();
            ICoreService client = service.getBasicHttp();
            BindingProvider provider = (BindingProvider)client;
            provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "[user]");
            provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "[password]");

ComponentData component = (ComponentData) client.read("tcm:6-57171", null);

2

Here are some steps I went through to get this up and running. This was all on the same machine (SDL Tridion CMS and custom app), just a Development environment, so beware decoupled environments, different machine/host names and different ports.

  1. In IIS, browse to the CMS Website - SDL Tridion - webservices. On the right-hand side, you should see a listing of available services. Right click on the CoreService of choice, for instance CoreService2013.svc and click "Browse". This will issue a call to the webservice in the browser and let you see the proper url to access the CoreService.
    In my case, this turned out to be http://localhost:81/webservices/CoreService2013.svc

  2. In Visual Studio, for a given project, right click the project, select "Add Service Reference". The "Add Service Reference" window will popup. Paste the url browsed to above, in the "Address" box of the popup. Click Go. Visual Studio will now "discover" the webservice and add it to the project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.