Tutorials > Web services > Define a User Registration Web Service
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
- Open WebSphere Commerce Developer and switch to the Java perspective.
- In the Package Explorer view, select File > New > Project.
- Select Java Project and click Next.
- In the Project name field, type SyncCustomerTest and click Finish.
- In the Package Explorer view, right-click the SyncCustomerTest project and select New > Package.
- In the Name field, type com.mycompany.webservice and click Finish.
- In the Package Explorer view, navigate to SyncCustomerTest > com.mycompany.webservice. Right-click com.mycompany.webservice and select Import.
- Select File system and click Next.
- Click the Browse button to the right of the From directory field.
- Navigate to the directory where you extracted SyncCustomerTest.java from the sample zip file and click OK.
- Select SyncCustomerTest.java from the list and click Finish to import the file.
- From the File menu, select Run > Run > Java Application > New .
- Click Search to locate the main class in the SyncCustomerTest project.
- Select SyncCustomerTest and click OK.
- 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:
- input.xml
- SyncCustomerTest.java