Tutorials > Web services > Define a User Registration Web Service

< Previous | Next >


Test Web SyncCustomer service

The following Java application can be used to test the Web service. This application uses the content of the input.xml file as the body of the Web service request and makes the request. When the response is received, the application will print out the SOAP body of the Web service response.

Since this sample uses the OAGIS ConfirmBOD schema to represent the result of the Web service request, the standard JAX-RPC Web service tooling has difficulties generating the appropriate Java code to represent a client for this Web service. Though the JAX-WS 2.0 specification is designed to handle these limitations, in the meantime there is an alternative approach to use the Eclipse Modeling Framework and SOAP binding options to generate Java clients. However, to quickly test the Web service, SAAJ can be used to create a quick test client for the newly created Web service.

Executing the Java application

When executing this application with the same input.xml file, the success scenario of creating a new user should occur:


Procedure

  1. Open WebSphere Commerce Developer and switch to the Java perspective.

  2. In the Package Explorer view, select File > New > Project.

  3. Select Java Project and click Next.

  4. In the Project name field, type SyncCustomerTest and click Finish.

  5. In the Package Explorer view, right-click the SyncCustomerTest project and select New > Package.

  6. In the Name field, type com.mycompany.webservice and click Finish.

  7. In the Package Explorer view, navigate to SyncCustomerTest > com.mycompany.webservice. Right-click com.mycompany.webservice and select Import.

  8. Select File system and click Next.

  9. Click the Browse button to the right of the From directory field.

  10. Navigate to the directory where you extracted SyncCustomerTest.java from the sample zip file and click OK.

  11. Select SyncCustomerTest.java from the list and click Finish to import the file.

  12. From the File menu, select Run > Run > Java Application > New .

  13. Click Search to locate the main class in the SyncCustomerTest project.

  14. Select SyncCustomerTest and click OK.

  15. Click Run. If you see a </oa:BODSuccessMessage> entry in the output, then you have successfully created a Web SyncCustomer service. When re-executing the application with the same input.xml, the failure scenario will occur because the logon id of the user is already specified. By executing the application twice both types of responses can be tested. After re-executing the application, you should receive a </oa:BODFailureMessage> entry in the output.

Code samples

In tutorial2-assets.zip, see:

< Previous | Next >


+

Search Tips   |   Advanced Search