Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/services/publish/listofitems gets a 404, when trying to publish a list of items #44

Open
sgisbert opened this issue Aug 18, 2015 · 8 comments
Assignees

Comments

@sgisbert
Copy link

Hi!

I'm using your great tool to try to automate Sitecore 7 & 8 deployments, and I'm having a strange issue at the latest step: publishing the installed items is returning a 404 error.
My whole stack is TeamCity + Courier + Ship 0.4.0 (I've cloned your source code).

I have the items package created with Sitecore Courier.
I've created a simple command line tool that has 2 tasks:

  • Install the package to "/services/package/install/fileupload" and get the list of installed items.
  • Create the Items-To-Publish list and post it to "/services/publish/listofitems".

First step works fine, and I get the list, but when I post to do the publishing, I'm getting a 404.

This is the source code to POST the publishing:

    private static void PublishItems(PublishItems items, string targetUrl)
    {
        try
        {
            // Create a request using a URL that can receive a post. 
            WebRequest request = WebRequest.Create(targetUrl + "/services/publish/listofitems");

            // Set the Method property of the request to POST.
            request.Method = "POST";
            // Create POST data and convert it to a byte array.
            string postData = items.ToJson();
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);

            // Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded";
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;
            // Get the request stream.
            Stream dataStream = request.GetRequestStream();
            // Write the data to the request stream.
            dataStream.Write(byteArray, 0, byteArray.Length);
            // Close the Stream object.
            dataStream.Close();
            // Get the response.
            WebResponse response = request.GetResponse();
            // Display the status.
            Console.WriteLine(((HttpWebResponse)response).StatusDescription);
            // Get the stream containing content returned by the server.
            dataStream = response.GetResponseStream();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader(dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd();
            // Display the content.
            Console.WriteLine(responseFromServer);
            // Clean up the streams.
            reader.Close();
            dataStream.Close();
            response.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    }

This is a sample POST, as captured in Fiddler:

POST http://sitecore8target/services/publish/listofitems HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: sitecore8target
Content-Length: 366
Expect: 100-continue

{"Items":[{"itemId":"662a3670-2671-414c-97e5-f9b30473cdd7","PublishChildren":"false"},{"itemId":"a49599a5-1b25-4efe-82aa-fa1af0993919","PublishChildren":"false"},{"itemId":"377cb37e-2b00-417e-bbec-872b4ef9e9a0","PublishChildren":"false"},{"itemId":"9502a1e1-7bdd-4b3e-a234-a488ba871889","PublishChildren":"false"}],"TargetDatabases":["web"],"TargetLanguages":["en"]}

And the 404 error:
image

The Sitecore instance at "http://sitecore8target" has Ship 0.4.0 installed, and the Install package service works as expected.

Any ideas where to look at?
Many thanks in advance!

Sergi

@sgisbert
Copy link
Author

Tried also with curl with same results:

curl -H "Content-Type: application/json" -X POST -d "{"Items":[{"itemId":"662a3670-2671-414c-97e5-f9b30473cdd7","PublishChildren":"false
"},{"itemId":"a49599a5-1b25-4efe-82aa-fa1af0993919","PublishChildren":"false"},{"itemId":"377cb37e-2b00-417e-bbec-872b4ef9e9a0","PublishChildren":"false"},{"itemId":"9502a1e1-7bdd-4
b3e-a234-a488ba871889","PublishChildren":"false"}],"TargetDatabases":["web"],"TargetLanguages":["en"]}" http://sitecore8target/services/publish/listofitems --proxy 127.0.0.1:8888

@kevinobee
Copy link
Owner

@sgisbert Just looking at it now with POSTman and seem to be getting the same results as you.

I'll get back to you Sergi as quickly as possible.

@kevinobee kevinobee self-assigned this Aug 18, 2015
@sgisbert
Copy link
Author

Thanks Kevin. Awesome news. Looking forward to your results.

@kevinobee
Copy link
Owner

@sgisbert which NuGet package are you using for Ship?

@sgisbert
Copy link
Author

Sitecore.Ship.AspNet.0.4.0.nupkg, the one generated with the build.

@kevinobee
Copy link
Owner

@sgisbert OK, so that it the HTTP handler version rather than the package based around NancyFx.

I'll focus on that codebase then.

@sgisbert
Copy link
Author

Created a pull request with a potential fix: #46

jimmah added a commit to jimmah/Sitecore.Ship that referenced this issue Sep 22, 2015
# By Kevin Obee (19) and others
# Via Kevin Obee (6) and The Gitter Badger (1)
* 'develop' of github.com:kevinobee/Sitecore.Ship: (22 commits)
  Add Gitter badge
  Transferring blueprint from apiary.io
  Minor text changes to the  Apiary.Io content
  Initial defintition of the service root
  kevinobee#45 initial load
  Minor change to ItemsToPublish to make it safe to use by default
  kevinobee#47 fix for Activator.CreateInstance for Sitecore.Ship against Sitecore 8.0 rev. 141212
  Fix minor build configuration issues
  Tried to undo weird formatting that carried across from work StyleCop settings
  Issue kevinobee#44 - Smoke test added for specific example from kevinobee#44
  kevinobee#46 Fixed InvokePublishingCommand return values
  kevinobee#46 Fixes added to ensure InvokePublishingCommand handles the publish/listofitems JSON POST body robustly
  kevinobee#46 Add failing smoke test
  kevinobee#48 Remove support for IIS classic mode from wec.config.transform files
  Added guidance to README to ensure that existing web.config files are included in the target .csproj
  Add call to PublishService with List of Items
  Transferring blueprint from apiary.io
  kevinobee#26 Treat compiler warnings as errors applied to all src projects
  Minor changes to README to not update to NET 4.5 and the removal of Classic mode support in IIS
  Projects now built against NET 4.5. Platform assemblies tested from Sitecore 8.0 rev. 141212 (8.0 RTM).
  ...
@millusdk
Copy link

I have the same issue, any news on a fix? /services/about reports: Sitecore.Ship - version 0.4.0.0 as my version.

@kevinobee kevinobee added the bug label Jun 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants