Rest Publisher Pseudo Code

//Import required classes
import com.oracle.retail.integration.base.bo.fulfilorddesc.v1.*
import com.oracle.retail.integration.payload.Payload
import com.retek.rib.domain.payload.PayloadFactory
import com.oracle.retail.integration.rib.applicationmessages.v1.ApplicationMessage;
import com.oracle.retail.integration.rib.applicationmessages.v1.ApplicationMessages;
//Create new instance of your FulfilOrdDesc object and populate it.
FulfilOrdDesc fulfilOrdDesc = new FulfilOrdDesc()
fulfilOrdDesc.setCustomerOrderNo(123)
//Get a string version of the payload
String payloadXml = PayloadFactory.marshalPayload(fulfilOrdDesc)
 
//Prepare the header message section
ApplicationMessages ams = new ApplicationMessages();
ApplicationMessage am = new ApplicationMessage();
am.setFamily("FULFILORD");
am.setType("FULFILORDPOCRE");
am.setBusinessObjectId("abc"); //optional
//Set the payload xml into the message
am.setPayloadXml(payloadXml);
ams.getApplicationMessage().add(am);
 
//Call rest url with ams
 
String ribPublisherRestUrl = "http://<host>:<port>/rib-ext-services-web/resources/publisher/publish"
 
Client client = ClientBuilder.newClient();
WebTarget webTarget = client.target(ribPublisherRestUrl);
 
String userName = "user";
char[] password = "passed";
 
String usernameAndPassword = userName + ":" + new String(password);
String authorizationHeaderValue = "Basic " + java.util.Base64.getEncoder().encodeToString( usernameAndPassword.getBytes() );
 
Invocation.Builder invocationBuilder =  webTarget.request().header("Authorization", authorizationHeaderValue);
 
 
Response response = invocationBuilder.post(Entity.entity(ams, MediaType.APPLICATION_XML));
 
log.debug("Publish call response(" + response + ").");