Exercises

You have covered many topics today. One of the most common tasks that you will want to perform is to send XML documents as SOAP messages.

  1. Create a JAXM client that accepts a SOAP message representing a new customer for the Job Agency and returns a response containing an assigned login. Generate your own string for the assigned login; there is no need to integrate this client with the agency EJBs you created earlier.

    The expected XML message in the SOAP body should be as follows:

    <acme:customer xmlns:acme="http://acme.com/commerce">
      <acme:name>Fred Bloggs</acme:name>
      <acme:email>[email protected]</acme:email>
      <acme:address>
        <acme:addressLine>Bury Old Road</acme:addressLine>
        <acme:addressLine>Manchester</acme:addressLine>
        <acme:addressLine>M25 7ZZ</acme:addressLine>
      </acme:address>
    </acme:customer>
    

    The generated XML response body should look like the following:

    <acme:login xmlns:acme="http://acme.com/commerce">
      Fred Bloggs1234
    </acme:login>
    

    An example solution is available under the JobService directory in the Day 21 exercise code on the CD-ROM.

  2. Create a JAXM client servlet that submits a new customer to the service you created in step 1. This should generate a SOAP message containing the customer information in its SOAP body and then send this to the SOAP service. Send the message directly to the service, do not use a JAXM Provider in this instance. Display the assigned login returned from the call.

    An example solution is available under the JobPortal directory in the Day 21 exercise code on the CD-ROM.

  3. Run the submitter and receiver to test that they work together.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.88.54