Home > Articles > Web Services > SOA

  • Print
  • + Share This
Like this article? We recommend

XML Adaptation

Our two companies now have SOAP access to their package-pickup systems. But although each system is an individual service, they don't form yet a united SOA. These two systems don't yet work in collaboration. The partnership rules we saw earlier must be enforced somehow, which can be done directly in the code.

Create the file CWE_WS_Adaptor.wsdl in the CWE_WS_Adaptor project, as we'll need that next. Open EuroShipWS.jws in Design view and insert a web service control. Figure 5 shows you the data to enter. This step creates the file CWE_WS_Adaptor.jcx inside the euroship folder.

Figure 5Figure 5 Adding a Web Service control.

Look for the marker //*** in EuroShipWS.jws, which indicates places where new code is needed. Now enter the bold code in Listing 2.

Listing 2 Bridging the Euro-Ship and CWE Systems

if( (usaPackageNumber!=null) && !usaPackageNumber.trim().equals("") ) {
  //If the destination address is in the USA, forward to CWE here...
  //***

  GregorianCalendar cweCal = new GregorianCalendar();
  cal.setTime(pickUpTime);

  euroship.CWE_WS_AdaptorControl.CWEReturn cweReturn = cweAdaptor.pickUp(
    senderId,
    nextUSAShipmentNumber(),
    pickUpAddress,
    cal, //Note: Workshop converted our Date to a Calendar
    destinationAddress,
    taxNumber,
    packageType);

  result.setSubtotal(result.getSubtotal() + cweReturn.Subtotal);
  result.setTax(result.getTax() + cweReturn.Tax);
}
  • + Share This
  • 🔖 Save To Your Account