官术网_书友最值得收藏!

Creating a business service to call an external SOAP-based web service

With the basic folder structure of the OSB project in place, we are ready to create our first OSB service. We will start with the business service Customer Service which will act as a wrapper of the external service. Business services in OSB are required definitions to exchange messages with enterprise information systems—such as databases and queues or other web services. The external service is a web service offered by a fictive CRM system. The business service will allow the definition of all sorts of properties for controlling how the external service is invoked:

Creating a business service to call an external SOAP-based web service

Getting ready

Make sure that the external web service we want to invoke is started by running the script \chapter-1\getting-ready\misc\customer-external-webservice\start-service.cmd. This service is implemented using soapUI's capabilities for creating mock services.

Verify that the service is running and available by asking it for its WSDL definition. Enter the following URI in a browser window: http://localhost:8088/mockCustomerServiceSOAP?WSDL:

Getting ready

How to do it...

In Eclipse OEPE, perform the following steps:

  1. In the project tree, right-click on the business folder and select New | Business Service.
  2. Enter CustomerService into the File name field, check a second time that the business folder is selected, and click on the Finish button:
    How to do it...
  3. A new business service artifact is created in the business folder and the editor for the business service opens automatically.
  4. Navigate to the General tab, if it does not already have the focus, and select the WSDL Web Service radio button.
  5. Click on the Browse button and a pop up window will show up, where the WSDL resource of the external service to be wrapped, can be selected.
  6. Click on the Consume button.
  7. A second pop-up window will show up where the WSDL resource can be specified:
    How to do it...
  8. Select URI in the Service Resource drop-down listbox.
  9. In the URI field, enter the URL of the WSDL resource to consume. The external service provides its WSDL through the following URL: http://localhost:8088/mockCustomerServiceSOAP?WSDL.
  10. Click on the OK button and Eclipse will consume the WSDL from this URL.
  11. Select the CustomerServiceSOAP port on the next window.
  12. Click on the OK button.
  13. Select Yes on the pop-up message window to confirm that the transport configuration settings will be overwritten by the information from the selected WSDL.
  14. Save the OSB project by selecting File | Save.
  15. In the Project Explorer, right-click on the imported WSDL file mockCustomerServiceSOAP.wsdl and select Rename. Enter CustomerService.wsdl into the New name field of the pop-up window and confirm.
  16. In the Project Explorer, drag the CustomerService.wsdl file into the wsdl folder and drop it there. All the references to the WSDL file are automatically adapted by Eclipse OEPE.
  17. Navigate to the Transport tab and check that the Endpoint URI has been replaced with the service endpoint setting from the WSDL that we consumed:
    How to do it...
  18. Save the artifact by selecting File | Save or by clicking on the Save toolbar button.

How it works...

The business service acts as a wrapper of our external service. Once created, we will no longer have to use the WSDL to refer to the external service, but can use the business service. This forms an additional abstraction layer, which will become handy later in some of the more advanced recipes to enable functionality in the OSB, which is applied before the real endpoint is invoked, such as SLA monitoring, service throttling, service pooling, and others. Sentence is too long, runs on too long. Would be better split into two sentences.

主站蜘蛛池模板: 米脂县| 江华| 伊通| 拉孜县| 宜阳县| 德格县| 潮安县| 车险| 双柏县| 新野县| 安阳县| 浦东新区| 邵阳市| 林芝县| 萨迦县| 大田县| 六安市| 柳州市| 西宁市| 绍兴县| 池州市| 神池县| 丰台区| 巴南区| 阿克苏市| 永年县| 芒康县| 揭阳市| 马边| 合作市| 堆龙德庆县| 大安市| 金溪县| 文山县| 临清市| 改则县| 东莞市| 昌图县| 永顺县| 抚宁县| 苏尼特右旗|