2

What is Java code to construct this SOAP?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsse:UsernameToken wsu:Id="UsernameToken-5501096" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                <wsse:Username>XXXXXXXXXX</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXXXXXXX</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </soapenv:Header>
    <soapenv:Body>
     <PerformRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <Action>Start</Action>
         <Definitions>
            <Definition xsi:type="Program">
               <ObjectID>111111111-2222-3333-4444-55555555555555</ObjectID>
            </Definition>
         </Definitions>
      </PerformRequestMsg>
    </soapenv:Body>
</soapenv:Envelope>

I have tried this (ObjectID is changed):

// Configure Axis client with web service description file
EngineConfiguration config = new FileProvider( clientWSDD );        
// Create PartnerAPI stub with ExactTarget Web Service API endpoint and Axis configuration
PartnerAPI service = new PartnerAPILocator( config );
Soap stub = service.getSoap();

PerformRequestMsg performRequestMsg = new PerformRequestMsg();
performRequestMsg.setAction("START");

// Add retrieved automation objectID            
APIObject apiObject = new APIObject();
apiObject.setObjectID("111111111-2222-3333-4444-55555555555555");
performRequestMsg.setDefinitions(new APIObject[]{apiObject});

PerformResponseMsg response = stub.perform(performRequestMsg);
PerformResult[] res = response.getResults();
System.out.println("Response:: " + res[0].getStatusMessage());

Response:

Response:: Requested value 'APIObject' was not found.

What did I do wrong?

UPDATED Finally, It is possible launch Automation via Java SDK(Axis), but with exception at the end.

String automationObjectID = "111111111-2222-3333-4444-55555555555555"; //Put here valid ObjectID
Automation automation = new Automation();
automation.setObjectID(automationObjectID);

PerformRequestMsg performRequestMsg = new PerformRequestMsg();
performRequestMsg.setAction("Start");

performRequestMsg.setDefinitions(new APIObject[]{automation});

PerformResponseMsg results = stub.perform(performRequestMsg);

if(results.getOverallStatus().equalsIgnoreCase("OK") && results.getResults() != null){
    logger.info("Execution status: " + results.getOverallStatus());
    logger.info("ObjectId:         " + results.getResults()[0].getStatusMessage());

}else{
    logger.error("Execution status: " + results.getOverallStatus());
    logger.error("ObjectId:         " + results.getResults()[0].getStatusMessage());
}

Response:

- External communication error is found
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: Invalid element in com.exacttarget.wsdl.partnerAPI.Automation - IsPlatformObject
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Invalid element in com.exacttarget.wsdl.partnerAPI.Automation - IsPlatformObject
    at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
    at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
    at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
    at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
    at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
    at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
    at org.apache.axis.client.Call.invoke(Call.java:2467)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.exacttarget.wsdl.partnerAPI.SoapBindingStub.perform(SoapBindingStub.java:3258)
1
  • Hmmm, I have launched this soap(added real ObjectID) and I got OK response, but nothing happens... – Valijon Jun 5 '14 at 17:42
1

I don't use Axis, but I was able to successfully start a program using this CXF code:

Campaign campaign = new Campaign();
campaign.setCustomerKey("test");
PerformRequestMsg request = new PerformRequestMsg();
request.setAction("start");
Definitions definitions = new Definitions();
definitions.getDefinition().add(campaign);
request.setDefinitions(definitions);
PerformResponseMsg response = soap.perform(request);

SOAP request and response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    [...]
  </soap:Header>
  <soap:Body>
    <PerformRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
      <Action>start</Action>
      <Definitions>
        <Definition xsi:type="Campaign">
          <CustomerKey>test</CustomerKey>
        </Definition>
      </Definitions>
    </PerformRequestMsg>
  </soap:Body>
</soap:Envelope>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    [...]
  </soap:Header>
  <soap:Body>
    <PerformResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
      <Results>
        <Result>
          <StatusCode>OK</StatusCode>
          <StatusMessage>Campaign start performed</StatusMessage>
          <Object xsi:type="Campaign">
            <CustomerKey>test</CustomerKey>
            <Name>test</Name>
            <InteractionObjectID>baf155e9-4dad-434d-98c0-aba6f7740905</InteractionObjectID>
          </Object>
          <Task>
            <StatusCode>OK</StatusCode>
            <StatusMessage>6/10/2014 12:31:35 PM</StatusMessage>
            <ID>81673f3a-cd6d-414f-af16-591a3cfe3e6c</ID>
            <InteractionObjectID>baf155e9-4dad-434d-98c0-aba6f7740905</InteractionObjectID>
          </Task>
        </Result>
      </Results>
      <OverallStatus>OK</OverallStatus>
      <OverallStatusMessage/>
      <RequestID>df3cd39e-b1ef-4c82-915a-67449bca886f</RequestID>
    </PerformResponseMsg>
  </soap:Body>
</soap:Envelope>

More detail here (including an Axis example):

http://help.exacttarget.com/en-US/technical_library/web_service_guide/technical_articles/performing_a_campaign_via_the_web_service_api/

Let us know if you get this working.

-ian

2
  • I have copied Axis Java code from your link, added compaign code and got this error. Maybe campaign is not valid to be started? Result status: Result code: 9999999 Result message: Exception occurred during [Perform::Start] ErrorID = 211022463 – Valijon Jun 11 '14 at 10:23
  • Can you post the new code here? -ian – Ian Murdock Jun 11 '14 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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