3.1.4.2 CancelPublish

     <wsdl:operation name="CancelPublish">
       <wsdl:input message="tns:CancelPublishSoapIn" />
       <wsdl:output message="tns:CancelPublishSoapOut" />
     </wsdl:operation>

The CancelPublish operation is used to transition the server into the "Not Publishing" state. The connection to the instance of the server that was initialized by the BeginPublish operation is closed. In addition, if BeginPublish was invoked by using a value of true for the useTransactions argument, the transaction that covers all the changes made by the PublishScript and PublishData operations is rolled back.

Invoking CancelPublish when not in the "Publish" state results in an error being returned to the client. The error returned is in the following form:

 Microsoft.SqlServer.Hosting.Service.NotPublishingException: A valid publishing session must be started before it can be ended.

Invoking CancelPublish MUST release the connection to the target instance of the server.