I am trying to publish a component using core services in Java but on running the code, I am getting this error :-

Exception in thread "main" com.sdltridion.contentmanager.coreservice.ICoreServicePublishCoreServiceFaultFaultFaultMessage: Value cannot be null. Parameter name: publishInstruction.ResolveInstruction.

Here's my code

         ReadOptions readOptions = new ReadOptions();

    ArrayOfstring componentsArray=new ArrayOfstring();

    ArrayOfstring publicationTarget=new ArrayOfstring();

    PublishInstructionData publishInstructionData = new PublishInstructionData();
    ResolveInstructionData resolveInstructionData = new ResolveInstructionData();

    JAXBElement<ResolvePurpose> resolvePurpose =    new JAXBElement<ResolvePurpose>(new QName("http://www.sdltridion.com/ContentManager/R6","Purpose"), ResolvePurpose.class, ResolvePurpose.PUBLISH);

    JAXBElement<ResolveInstructionData> jaxbElement =    new JAXBElement<ResolveInstructionData>(new QName("http://www.sdltridion.com/ContentManager/CoreService/2011","com.sdltridion.contentmanager.coreservice._2011.Publish"), ResolveInstructionData.class, resolveInstructionData);

     RenderInstructionData renderInstructionData = new RenderInstructionData();

      JAXBElement<RenderMode> renderMode =    new JAXBElement<RenderMode>(new QName("http://www.sdltridion.com/ContentManager/R6","RenderMode"), RenderMode.class, RenderMode.PUBLISH);

    JAXBElement<RenderInstructionData> renderInstruction =    new JAXBElement<RenderInstructionData>(new QName("http://www.sdltridion.com/ContentManager/CoreService/2011","com.sdltridion.contentmanager.coreservice._2011.Publish"), RenderInstructionData.class, renderInstructionData);


      ArrayOfPublishTransactionData ad= endpoint.publish(componentsArray, publishInstructionData, publicationTarget, PublishPriority.LOW, readOptions);

3 Answers 3


Looking at your implementation, publishinstructiondata has two main objects: ResolveInstructionData and RenderInstruction.

In your implementation, you have created object for ResolveInstructionData however you are missing RenderInstruction object. That could be reason the publishing is not working.

  • I have already tried adding the RenderInstruction but it did'nt work as I always get the same exception which I have pointed above.
    – Ankur
    Dec 16, 2016 at 9:14
  • RenderInstructionData renderInstructionData = new RenderInstructionData(); @SuppressWarnings("unchecked") JAXBElement<RenderInstructionData> jaxbElement1 = new JAXBElement<RenderInstructionData>(new QName("sdltridion.com/ContentManager/CoreService/…), RenderInstructionData.class, renderInstructionData); publishInstructionData.setRenderInstruction(jaxbElement1);
    – Ankur
    Dec 16, 2016 at 9:20
  • 1
    For ResolveInstructionData you also need to setPurpose, probably to ResolvePurpose.PUBLISH; and for the RenderInstructionData you need to set a RenderMode, again, probably to RenderMode.PUBLISH. You may also find yatb.mitza.net/2012/12/a-core-service-java-client.html useful if you want to unwrap the JAXB elements. Dec 16, 2016 at 21:40
  • Thanks for your answer Dave, but the recommendation by you doesn't seems to work. I have updated my code and still getting the same error as I have mentioned above.
    – Ankur
    Dec 19, 2016 at 7:34

I think this is mainly a question on how to construct a proper SOAP request in general in Java (using JAXB?)

I recommend to enable WCF Tracing in the Core Service (there are comments in webservices/web.config on how to do that). This allows you to see the SOAP request sent to the Core Service to check what's in there and what's not.

  • Well I have already made many SOAP request using JAXB to get the data from the CMS using core-services. I want to know here, if there's something I am missing or the way of doing this is not correct ??
    – Ankur
    Dec 16, 2016 at 12:17
  • 1
    The answer to that question is most probably "yes", but I can't tell you what the issue is exactly. I just hope that the WCF Trace helps you analyzing the problem. Dec 16, 2016 at 12:20

Just adding this answer here since there was no accepted answer and might help people. The namespace URI and the service name used for the QName objects are incorrect for ResolvePurpose, ResolveInstruction and RenderInstruction.

To get the publish to work, I had to use the right namespace URIs and the service names. Something like this should work:

public class PublishService {   
    private static final QName RENDER_MODE_Q_NAME = 
                 new QName("http://www.sdltridion.com/ContentManager/R6", "RenderMode");
    private static final QName RESOLVE_PURPOSE_Q_NAME = 
                 new QName("http://www.sdltridion.com/ContentManager/R6", "ResolvePurpose");
    private static final QName RESOLVE_INSTRUCTION_DATA_Q_NAME = 
                 new QName("http://www.sdltridion.com/ContentManager/R6", "ResolveInstruction");
    private static final QName RENDER_INSTRUCTION_DATA_Q_NAME = 
                 new QName("http://www.sdltridion.com/ContentManager/R6", "RenderInstruction");

    public void publish() throws ICoreServiceGetApiVersionCoreServiceFaultFaultFaultMessage, 
                 ICoreServicePublishCoreServiceFaultFaultFaultMessage  {
        CoreService201603 coreService = new CoreService201603();
        ICoreService coreServiceClient = coreService.getBasicHttp();

        ArrayOfstring targetIdsArrString = new ArrayOfstring();

        List<String> itemsToPublish = new ArrayList<String>();

        ArrayOfstring itemsToPublishArrString = new ArrayOfstring();

        JAXBElement<RenderMode> renderModeJaxElement = 
                new JAXBElement<RenderMode>(RENDER_MODE_Q_NAME, RenderMode.class, RenderMode.PUBLISH);
        RenderInstructionData renderInstructionData = new RenderInstructionData();

        JAXBElement<ResolvePurpose> resolvePurposeJaxElement = 
                new JAXBElement<ResolvePurpose>(RESOLVE_PURPOSE_Q_NAME, ResolvePurpose.class, ResolvePurpose.PUBLISH);
        ResolveInstructionData resolveInstructionData = new ResolveInstructionData();

        JAXBElement<RenderInstructionData> renderInstructionDataJaxElement = 
                new JAXBElement<RenderInstructionData>(RENDER_INSTRUCTION_DATA_Q_NAME, RenderInstructionData.class, renderInstructionData);
        JAXBElement<ResolveInstructionData> resolveInstructionDataJaxElement = 
                new JAXBElement<ResolveInstructionData>(RESOLVE_INSTRUCTION_DATA_Q_NAME, ResolveInstructionData.class, resolveInstructionData);

        PublishInstructionData publishInstructionData = new PublishInstructionData();

        coreServiceClient.publish(itemsToPublishArrString, publishInstructionData, targetIdsArrString, PublishPriority.NORMAL, new ReadOptions());

We can view how the SOAP body should look like and the namespaces and the service names to be used by loading up the WSDL in a tool like SoapUI.

enter image description here

  • i tried above given solution but i get this : Error occurred in web service client initialization : Unable to cast object of type 'Tridion.ContentManager.CommunicationManagement.BusinessProcessType' to type 'Tridion.ContentManager.CommunicationManagement.PublishingTarget'. Mar 12, 2021 at 12:37
  • You need to be using publishing target TCM IDs and not BPTs. I think you are passing a BPT TCM ID as a parameter to the publish function and not a publishing target (e.g., tcm:x-xx-65538). Mar 12, 2021 at 16:39

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.