Monday, November 11, 2013

#283 - BPM 11g Web Service Clients

Scenario:

I have the following simple process -









Payload is as follows -






















I deploy the composite and then pick up the WSDL from EM
Click on the icon -

















I then create a new "Generic" project in JDev and add a Web Service Proxy based on the above WSDL.

JDev does its magic and all I need to do is add the following code to the auto-generated client

public class NiallCSimpleOrdersProcessPortClient
{
  @WebServiceRef
  private static NiallCSimpleOrdersProcessService niallCSimpleOrdersProcessService;

  public static void main(String [] args)
  {
    niallCSimpleOrdersProcessService = new NiallCSimpleOrdersProcessService();
    NiallCSimpleOrdersProcessPortType niallCSimpleOrdersProcessPortType =
        niallCSimpleOrdersProcessService.getNiallCSimpleOrdersProcessPort();
 
    // MY CODE HERE
    Order order = new Order();
    order.setCustCountry("IE");
    order.setUnitPrice(new BigDecimal("199.99") );
    order.setCustEmail("n@c.com");
    order.setCustFirstName("Niall");
    order.setCustLastName("Commiskey");
    order.setExportRestriction("N");
    order.setOrderNr("123");
    order.setProduct("iToaster");
    order.setQuantity(10);
    niallCSimpleOrdersProcessService.getNiallCSimpleOrdersProcessPort().start(order);
  }
}

I run the client and check for the instance in EM -
















Simple stuff!

No comments:

Post a Comment