Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Using SOAPUI

If you've installed SOAPUI using the Windows installer, you just need to double-click the SOAPUI icon to see a window that looks like Figure 1.

Figure 1

Figure 1 SOAPUI in action.

Click the plus symbol to the left of the Tutorial menu item and expand the contents to reveal the "Request 1" operation. Double-click "Request 1" to open a SOAP request dialog, as illustrated in Figure 2.

Figure 2

Figure 2 The SOAP request dialog.

Modify the request settings to use the date and employee settings in Listing 4.

Listing 4 The SOAP message settings.

<sch:Holiday>
<sch:StartDate>2008-01-01</sch:StartDate>
<sch:EndDate>2008-01-10</sch:EndDate>
</sch:Holiday>
<sch:Employee>
<sch:Number>44</sch:Number>
<sch:FirstName>Me</sch:FirstName>
<sch:LastName>Myself</sch:LastName>
</sch:Employee>

Once these changes are in place, you're just about ready to send the SOAP request. Before sending the request, change the endpoint at the top of the SOAP request dialog. Make sure that the endpoint matches the one in Figure 2:

http:://localhost:8080/tutorial/

You're ready to submit the SOAP request to the web service. You can do this by clicking the green arrow at the upper-left side of the SOAP request dialog. If all is well with your configuration, you should see Tomcat log output similar that in Listing 5.

Listing 5 Tomcat output: Processing the SOAP request.

2008-05-24 14:05:39,546 DEBUG [org.springframework.ws.server.MessageTracing] - Received request [SaajSoapMessage {http://mycompany.com/hr/schemas}HolidayRequest]
2008-05-24 14:05:39,578 DEBUG [org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping] - Looking up endpoint for [{http://mycompany.com/hr/schemas}HolidayRequest]
2008-05-24 14:05:39,578 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Endpoint mapping [org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping@1a5ec6c] maps request to endpoint [com.mycompany.hr.ws.HolidayEndpoint@b3f9b8]
2008-05-24 14:05:39,625 DEBUG [org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor] - Request: <sch:HolidayRequest xmlns:sch="http://mycompany.com/hr/schemas">
     <!--You may enter the following 2 items in any order-->
     <sch:Holiday>
      <sch:StartDate>2008-01-01</sch:StartDate>
      <sch:EndDate>2008-01-10</sch:EndDate>
     </sch:Holiday>
     <sch:Employee>
      <sch:Number>44</sch:Number>
      <sch:FirstName>Me</sch:FirstName>
      <sch:LastName>Myself</sch:LastName>
     </sch:Employee>
   </sch:HolidayRequest>
2008-05-24 14:05:39,640 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter@15f4a7f]
2008-05-24 14:05:39,640 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.PayloadEndpointAdapter@670479]
2008-05-24 14:05:39,734 INFO [com.mycompany.hr.service.StubHumanResourceService] - Booking holiday for meself [Tue Jan 01 00:00:00 GMT 2008-Thu Jan 10 00:00:00 GMT 2008] for [Me Myself]
2008-05-24 14:05:39,734 DEBUG [org.springframework.ws.server.MessageTracing] - MessageDispatcher with name 'spring-ws' sends no response for request [SaajSoapMessage {http://mycompany.com/hr/schemas}HolidayRequest]
2008-05-24 14:05:39,734 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] - Successfully completed request

Notice in Listing 5 the way that the incoming SOAP request message is displayed. In a real application, this data would be validated and then used to update an employee vacation details database. You can see the power! That concludes this whistle-stop tour of Spring web services.

  • + Share This
  • 🔖 Save To Your Account