6

I can't find the right XML syntax of the message to pass to the business connector web service (http://website.com/BCListener/BusinessConnectorService.asmx) to unpublish a page.

The request I sent to get a publishing done is the following, and works perfectly:

<?xml version="1.0"?>
<tcmapi:Message xmlns:tcmapi="http://www.tridion.com/ContentManager/5.0/TCMAPI" version="5.0" from="robot" failOnError="false">
  <tcmapi:Request ID="REQ1" preserve="false">
    <tcmapi:Publish itemURI="tcm:">
      <tcm:PublishInstruction xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
        <tcm:OnlyPublishedItems>false</tcm:OnlyPublishedItems>
        <tcm:RollbackOnFailure>true</tcm:RollbackOnFailure>
        <tcm:ActivateBlueprinting>false</tcm:ActivateBlueprinting>
        <tcm:ActivateWorkflow>false</tcm:ActivateWorkflow>
        <tcm:RenderMode>Publish</tcm:RenderMode>
        <tcm:PublishTime/>
        <tcm:Targets>
          <tcm:TargetType xlink:href="tcm:0-2-65538" xlink:type="simple"/>
        </tcm:Targets>
      </tcm:PublishInstruction>
    </tcmapi:Publish>
  </tcmapi:Request>
</tcmapi:Message>

From what I understand of cm_tcmapi.xsd and cm_xml.xsd, the message to unpublish should be really similar. I've made numerous try changing the parameters, their order, adding and removing some, but nothing works.

Here's a request such as I send (I checked that the item is published, and the target type is right):

<?xml version="1.0"?>
<tcmapi:Message xmlns:tcmapi="http://www.tridion.com/ContentManager/5.0/TCMAPI" version="5.0" from="robot" failOnError="false">
  <tcmapi:Request ID="REQunp" preserve="false">
    <tcmapi:UnPublish itemURI="tcm:10-1045360-64">
      <tcm:PublishInstruction xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
        <tcm:ActivateWorkflow>false</tcm:ActivateWorkflow>
        <tcm:ActivateBlueprinting>false</tcm:ActivateBlueprinting>
        <tcm:RollbackOnFailure>true</tcm:RollbackOnFailure>
        <tcm:Targets>
          <tcm:TargetType xlink:href="tcm:0-7-65538" xlink:type="simple"/>
        </tcm:Targets>
      </tcm:PublishInstruction>
    </tcmapi:UnPublish>
  </tcmapi:Request>
</tcmapi:Message>

Unfortunately, the only response I get from the webserver, instead of one giving the tcmnid of the publication transaction, is this:

<tcmapi:Message xmlns:tcmapi="http://www.tridion.com/ContentManager/5.0/TCMAPI" from="robot" version="6.0">
  <tcmapi:Response ID="REQunp" success="true"></tcmapi:Response>
</tcmapi:Message>

And checking the publishing state of the object and the publishing queue confirms that nothing happened at all.

2 Answers 2

5

It took some time, but I've figured it out. The thing is you miss <tcm:UnpublishTime/> in your unpublish instruction. So complete request will look like this:

<?xml version="1.0"?>
<tcmapi:Message xmlns:tcmapi="http://www.tridion.com/ContentManager/5.0/TCMAPI" version="5.0" from="robot" failOnError="false">
  <tcmapi:Request ID="REQunp" preserve="false">
    <tcmapi:UnPublish itemURI="tcm:10-1045360-64">
      <tcm:PublishInstruction xmlns:tcm="http://www.tridion.com/ContentManager/5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
        <tcm:ActivateWorkflow>false</tcm:ActivateWorkflow>
        <tcm:ActivateBlueprinting>false</tcm:ActivateBlueprinting>
        <tcm:RollbackOnFailure>true</tcm:RollbackOnFailure>
        <tcm:UnpublishTime/>
        <tcm:Targets>
          <tcm:TargetType xlink:href="tcm:0-7-65538" xlink:type="simple"/>
        </tcm:Targets>
      </tcm:PublishInstruction>
    </tcmapi:UnPublish>
  </tcmapi:Request>
</tcmapi:Message>

And please don't ask why :)

0
1

My first suspicion when seeing success="true" is that you have succeeded in doing an unpublish that does nothing. Are you sure the item in question is published to the relevant target? If you do the same unpublish manually and check the items that are to be unpublished, is there anything in the list?

1
  • No, I already had this problem when coming up with the publish instruction... The target was good, but I missed an UnpublishTime tag. Tridion is just amazingly unhelpful in this case, leading you to believe that the action was successful when it's actually just failing silently.
    – m4573r
    Jul 23, 2013 at 16:44

Your Answer

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

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