Listing 1

<?xml version = '1.0' encoding = 'UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:ns0="http://schemas.xmlsoap.org/ws/2003/03/addressing"
    xmlns:ns1="http://www.autoloan.com/ns/autoloan">
   <env:Header>
      <ns0:ReplyTo>
<ns0:Address>http://localhost:8888/LoanFlowCallbackService/LoanFlowCallbackService
</ns0:Address>
         <ns0:PortType>null:LoanFlowCallback</ns0:PortType>
         <ns0:ServiceName>null:LoanFlowCallback</ns0:ServiceName>
      </ns0:ReplyTo>
      <ns0:MessageID>urn:my-unique-id</ns0:MessageID>
   </env:Header>
   <env:Body>
      <ns1:loanApplication>
         <ns1:SSN>123-45-6789</ns1:SSN>
         <ns1:email>myself@home.org</ns1:email>
         <ns1:customerName>Maurice Poulet</ns1:customerName>
         <ns1:loanAmount>1234.56</ns1:loanAmount>
         <ns1:carModel>BigCar</ns1:carModel>
         <ns1:carYear>1999</ns1:carYear>
         <ns1:creditRating>50</ns1:creditRating>
      </ns1:loanApplication>
   </env:Body>
</env:Envelope>


Listing 2

 public void onResult(String providerName,
                         boolean selected,
                         boolean approved,
                         double APR,
                         String email,
                         Relationship relatesTo)
    {
      System.out.println("Result for " + email);
      try
      {
        String content = "Your loan has been " +
		(approved?"approved":"rejected") + " by " + providerName;
        EMailClient.send(email, "Your Loan", content);
      }
      catch (Exception e) {
          e.printStackTrace();
      }
    }


Listing 3

public  void invokeLoanFlow() {

//.....
        try {
            loanclient.LoanFlowPortClient myPort = new loanclient.LoanFlowPortClient();
            System.out.println("calling " + myPort.getEndpoint());
            // Add your own code here

             String input = "Oliv";
             AttributedURI uri = new AttributedURI();
             uri.set_value(new
			  URI("http://localhost:8888/LoanFlowCallbackService/LoanFlowCallbackService"));

             AttributedQName portQname = new AttributedQName();
             portQname.set_value(new QName( "http://callback.service/", "LoanFlowCallback"));

             ServiceNameType serviceName = new ServiceNameType();
             serviceName.set_value(new QName("http://callback.service/", "LoanFlowCallback"));

             EndpointReferenceType replyTo = new EndpointReferenceType();

             replyTo.setAddress(uri);
             replyTo.setPortType(portQname);
             replyTo.setServiceName(serviceName);
             AttributedURI messageID = new AttributedURI();
             URI mURI = new URI("urn:my-unique-id");
             messageID.set_value(mURI);

             double loanAmount = 1234.56;
             int creditRating = 50;
             myPort.initiate("123-45-6789", "myself@home.org", "Maurice Poulet", loanAmount,
			  "BigCar", "1999", creditRating, replyTo, messageID);
             System.out.println("Invoked BPEL Process");

           
        
        } catch (Exception ex) {
            ex.printStackTrace();
        }
//............
}