1 package org.objectweb.celtix.systest.dispatch; 2 3 import java.io.IOException ; 4 import java.io.InputStream ; 5 import java.net.URL ; 6 import java.util.concurrent.Future ; 7 8 import javax.xml.bind.JAXBContext; 9 import javax.xml.namespace.QName ; 10 import javax.xml.soap.MessageFactory ; 11 import javax.xml.soap.SOAPMessage ; 12 import javax.xml.transform.dom.DOMSource ; 13 import javax.xml.transform.sax.SAXSource ; 14 import javax.xml.transform.stream.StreamSource ; 15 import javax.xml.ws.AsyncHandler; 16 import javax.xml.ws.Dispatch; 17 import javax.xml.ws.Response; 18 import javax.xml.ws.Service; 19 20 import org.xml.sax.InputSource ; 21 22 import junit.framework.Test; 23 import junit.framework.TestSuite; 24 25 import org.objectweb.celtix.systest.basic.Server; 26 import org.objectweb.celtix.systest.common.ClientServerSetupBase; 27 import org.objectweb.celtix.systest.common.ClientServerTestBase; 28 import org.objectweb.hello_world_soap_http.SOAPService; 29 import org.objectweb.hello_world_soap_http.types.GreetMe; 30 import org.objectweb.hello_world_soap_http.types.GreetMeResponse; 31 32 public class DispatchClientServerTest extends ClientServerTestBase { 33 34 private final QName serviceName = new QName ("http://objectweb.org/hello_world_soap_http", 35 "SOAPService"); 36 private final QName portName = new QName ("http://objectweb.org/hello_world_soap_http", 37 "SoapPort"); 38 39 public static Test suite() throws Exception { 40 TestSuite suite = new TestSuite(DispatchClientServerTest.class); 41 return new ClientServerSetupBase(suite) { 42 public void startServers() throws Exception { 43 assertTrue("server did not launch correctly", launchServer(Server.class)); 44 } 45 }; 46 } 47 48 public void testSOAPMessage() throws Exception { 49 50 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 51 assertNotNull(wsdl); 52 53 SOAPService service = new SOAPService(wsdl, serviceName); 54 assertNotNull(service); 55 56 InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml"); 57 SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is); 58 assertNotNull(soapReqMsg); 59 60 InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml"); 61 SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null, is1); 62 assertNotNull(soapReqMsg1); 63 64 InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml"); 65 SOAPMessage soapReqMsg2 = MessageFactory.newInstance().createMessage(null, is2); 66 assertNotNull(soapReqMsg2); 67 68 InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml"); 69 SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3); 70 assertNotNull(soapReqMsg3); 71 72 Dispatch<SOAPMessage > disp = service.createDispatch(portName, 73 SOAPMessage .class, Service.Mode.MESSAGE); 74 SOAPMessage soapResMsg = disp.invoke(soapReqMsg); 75 assertNotNull(soapResMsg); 76 String expected = "Hello TestSOAPInputMessage"; 77 assertEquals("Response should be : Hello TestSOAPInputMessage", 78 expected, soapResMsg.getSOAPBody().getTextContent()); 79 80 disp.invokeOneWay(soapReqMsg1); 81 82 Response response = disp.invokeAsync(soapReqMsg2); 83 SOAPMessage soapResMsg2 = (SOAPMessage )response.get(); 84 assertNotNull(soapResMsg2); 85 String expected2 = "Hello TestSOAPInputMessage2"; 86 assertEquals("Response should be : Hello TestSOAPInputMessage2", 87 expected2, soapResMsg2.getSOAPBody().getTextContent()); 88 89 TestSOAPMessageHandler tsmh = new TestSOAPMessageHandler(); 90 Future f = disp.invokeAsync(soapReqMsg3, tsmh); 91 assertNotNull(f); 92 while (!f.isDone()) { 93 } 95 String expected3 = "Hello TestSOAPInputMessage3"; 96 assertEquals("Response should be : Hello TestSOAPInputMessage3", 97 expected3, tsmh.getReplyBuffer()); 98 } 99 100 101 102 public void testDOMSourceMESSAGE() throws Exception { 103 104 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 105 assertNotNull(wsdl); 106 107 SOAPService service = new SOAPService(wsdl, serviceName); 108 assertNotNull(service); 109 110 InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml"); 111 SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is); 112 DOMSource domReqMsg = new DOMSource (soapReqMsg.getSOAPPart()); 113 assertNotNull(domReqMsg); 114 115 InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml"); 116 SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null, is1); 117 DOMSource domReqMsg1 = new DOMSource (soapReqMsg1.getSOAPPart()); 118 assertNotNull(domReqMsg1); 119 120 InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml"); 121 SOAPMessage soapReqMsg2 = MessageFactory.newInstance().createMessage(null, is2); 122 DOMSource domReqMsg2 = new DOMSource (soapReqMsg2.getSOAPPart()); 123 assertNotNull(domReqMsg2); 124 125 InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml"); 126 SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3); 127 DOMSource domReqMsg3 = new DOMSource (soapReqMsg3.getSOAPPart()); 128 assertNotNull(domReqMsg3); 129 130 131 Dispatch<DOMSource > disp = service.createDispatch(portName, 132 DOMSource .class, Service.Mode.MESSAGE); 133 DOMSource domResMsg = disp.invoke(domReqMsg); 134 assertNotNull(domResMsg); 135 String expected = "Hello TestSOAPInputMessage"; 136 assertEquals("Response should be : Hello TestSOAPInputMessage", 137 expected, domResMsg.getNode().getFirstChild().getTextContent()); 138 139 disp.invokeOneWay(domReqMsg1); 140 141 Response response = disp.invokeAsync(domReqMsg2); 142 DOMSource domRespMsg2 = (DOMSource )response.get(); 143 assertNotNull(domReqMsg2); 144 String expected2 = "Hello TestSOAPInputMessage2"; 145 assertEquals("Response should be : Hello TestSOAPInputMessage2", 146 expected2, domRespMsg2.getNode().getFirstChild().getTextContent()); 147 148 149 TestDOMSourceHandler tdsh = new TestDOMSourceHandler(); 150 Future fd = disp.invokeAsync(domReqMsg3, tdsh); 151 assertNotNull(fd); 152 while (!fd.isDone()) { 153 } 155 String expected3 = "Hello TestSOAPInputMessage3"; 156 assertEquals("Response should be : Hello TestSOAPInputMessage3", 157 expected3, tdsh.getReplyBuffer()); 158 } 159 160 161 public void testDOMSourcePAYLOAD() throws Exception { 162 163 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 164 assertNotNull(wsdl); 165 166 SOAPService service = new SOAPService(wsdl, serviceName); 167 assertNotNull(service); 168 169 InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml"); 170 SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is); 171 DOMSource domReqMsg = new DOMSource (soapReqMsg.getSOAPBody().extractContentAsDocument()); 172 assertNotNull(domReqMsg); 173 174 InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml"); 175 SOAPMessage soapReqMsg1 = MessageFactory.newInstance().createMessage(null, is1); 176 DOMSource domReqMsg1 = new DOMSource (soapReqMsg1.getSOAPBody().extractContentAsDocument()); 177 assertNotNull(domReqMsg1); 178 179 InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml"); 180 SOAPMessage soapReqMsg2 = MessageFactory.newInstance().createMessage(null, is2); 181 DOMSource domReqMsg2 = new DOMSource (soapReqMsg2.getSOAPBody().extractContentAsDocument()); 182 assertNotNull(domReqMsg2); 183 184 InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml"); 185 SOAPMessage soapReqMsg3 = MessageFactory.newInstance().createMessage(null, is3); 186 DOMSource domReqMsg3 = new DOMSource (soapReqMsg3.getSOAPBody().extractContentAsDocument()); 187 assertNotNull(domReqMsg3); 188 189 Dispatch<DOMSource > disp = service.createDispatch(portName, 190 DOMSource .class, Service.Mode.PAYLOAD); 191 192 DOMSource domResMsg = disp.invoke(domReqMsg); 194 assertNotNull(domResMsg); 195 String expected = "Hello TestSOAPInputMessage"; 196 assertEquals("Response should be : Hello TestSOAPInputMessage", 197 expected, domResMsg.getNode().getFirstChild().getTextContent()); 198 199 disp.invokeOneWay(domReqMsg1); 201 202 Response response = disp.invokeAsync(domReqMsg2); 204 DOMSource domRespMsg2 = (DOMSource )response.get(); 205 assertNotNull(domRespMsg2); 206 String expected2 = "Hello TestSOAPInputMessage2"; 207 assertEquals("Response should be : Hello TestSOAPInputMessage2", 208 expected2, domRespMsg2.getNode().getFirstChild().getTextContent()); 209 210 211 TestDOMSourceHandler tdsh = new TestDOMSourceHandler(); 213 Future fd = disp.invokeAsync(domReqMsg3, tdsh); 214 assertNotNull(fd); 215 while (!fd.isDone()) { 216 } 218 String expected3 = "Hello TestSOAPInputMessage3"; 219 assertEquals("Response should be : Hello TestSOAPInputMessage3", 220 expected3, tdsh.getReplyBuffer()); 221 222 } 223 224 public void testSAXSourceMESSAGE() throws Exception { 225 226 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 227 assertNotNull(wsdl); 228 229 SOAPService service = new SOAPService(wsdl, serviceName); 230 assertNotNull(service); 231 232 InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml"); 233 InputSource inputSource = new InputSource (is); 234 SAXSource saxSourceReq = new SAXSource (inputSource); 235 assertNotNull(saxSourceReq); 236 237 InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml"); 238 InputSource inputSource1 = new InputSource (is1); 239 SAXSource saxSourceReq1 = new SAXSource (inputSource1); 240 assertNotNull(saxSourceReq1); 241 242 InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml"); 243 InputSource inputSource2 = new InputSource (is2); 244 SAXSource saxSourceReq2 = new SAXSource (inputSource2); 245 assertNotNull(saxSourceReq2); 246 247 InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml"); 248 InputSource inputSource3 = new InputSource (is3); 249 SAXSource saxSourceReq3 = new SAXSource (inputSource3); 250 assertNotNull(saxSourceReq3); 251 252 Dispatch<SAXSource > disp = service.createDispatch(portName, 253 SAXSource .class, Service.Mode.MESSAGE); 254 SAXSource saxSourceResp = disp.invoke(saxSourceReq); 255 assertNotNull(saxSourceResp); 256 String expected = "Hello TestSOAPInputMessage"; 257 checkSAXSource(expected, saxSourceResp); 258 259 disp.invokeOneWay(saxSourceReq1); 260 261 Response response = disp.invokeAsync(saxSourceReq2); 262 SAXSource saxSourceResp2 = (SAXSource )response.get(); 263 assertNotNull(saxSourceResp2); 264 String expected2 = "Hello TestSOAPInputMessage2"; 265 checkSAXSource(expected2, saxSourceResp2); 266 267 268 TestSAXSourceHandler tssh = new TestSAXSourceHandler(); 269 Future fd = disp.invokeAsync(saxSourceReq3, tssh); 270 assertNotNull(fd); 271 while (!fd.isDone()) { 272 } 274 String expected3 = "Hello TestSOAPInputMessage3"; 275 SAXSource saxSourceResp3 = tssh.getSAXSource(); 276 assertNotNull(saxSourceResp3); 277 checkSAXSource(expected3, saxSourceResp3); 278 279 } 280 281 282 public void testSAXSourcePAYLOAD() throws Exception { 283 284 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 285 assertNotNull(wsdl); 286 287 SOAPService service = new SOAPService(wsdl, serviceName); 288 assertNotNull(service); 289 290 InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml"); 291 InputSource inputSource = new InputSource (is); 292 SAXSource saxSourceReq = new SAXSource (inputSource); 293 assertNotNull(saxSourceReq); 294 295 InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq1.xml"); 296 InputSource inputSource1 = new InputSource (is1); 297 SAXSource saxSourceReq1 = new SAXSource (inputSource1); 298 assertNotNull(saxSourceReq1); 299 300 InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq2.xml"); 301 InputSource inputSource2 = new InputSource (is2); 302 SAXSource saxSourceReq2 = new SAXSource (inputSource2); 303 assertNotNull(saxSourceReq2); 304 305 InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq3.xml"); 306 InputSource inputSource3 = new InputSource (is3); 307 SAXSource saxSourceReq3 = new SAXSource (inputSource3); 308 assertNotNull(saxSourceReq3); 309 310 Dispatch<SAXSource > disp = service.createDispatch(portName, 311 SAXSource .class, Service.Mode.PAYLOAD); 312 SAXSource saxSourceResp = disp.invoke(saxSourceReq); 313 assertNotNull(saxSourceResp); 314 String expected = "Hello TestSOAPInputMessage"; 315 checkSAXSource(expected, saxSourceResp); 316 317 disp.invokeOneWay(saxSourceReq1); 318 319 Response response = disp.invokeAsync(saxSourceReq2); 320 SAXSource saxSourceResp2 = (SAXSource )response.get(); 321 assertNotNull(saxSourceResp2); 322 String expected2 = "Hello TestSOAPInputMessage2"; 323 checkSAXSource(expected2, saxSourceResp2); 324 325 326 TestSAXSourceHandler tssh = new TestSAXSourceHandler(); 327 Future fd = disp.invokeAsync(saxSourceReq3, tssh); 328 assertNotNull(fd); 329 while (!fd.isDone()) { 330 } 332 String expected3 = "Hello TestSOAPInputMessage3"; 333 SAXSource saxSourceResp3 = tssh.getSAXSource(); 334 assertNotNull(saxSourceResp3); 335 checkSAXSource(expected3, saxSourceResp3); 336 337 } 338 339 public void testStreamSourceMESSAGE() throws Exception { 340 341 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 342 assertNotNull(wsdl); 343 344 SOAPService service = new SOAPService(wsdl, serviceName); 345 assertNotNull(service); 346 347 InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml"); 348 StreamSource streamSourceReq = new StreamSource (is); 349 assertNotNull(streamSourceReq); 350 351 InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq1.xml"); 352 StreamSource streamSourceReq1 = new StreamSource (is1); 353 assertNotNull(streamSourceReq1); 354 355 InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq2.xml"); 356 StreamSource streamSourceReq2 = new StreamSource (is2); 357 assertNotNull(streamSourceReq2); 358 359 InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml"); 360 StreamSource streamSourceReq3 = new StreamSource (is3); 361 assertNotNull(streamSourceReq3); 362 363 364 365 366 Dispatch<StreamSource > disp = service.createDispatch(portName, 367 StreamSource .class, Service.Mode.MESSAGE); 368 StreamSource streamSourceResp = disp.invoke(streamSourceReq); 369 assertNotNull(streamSourceResp); 370 String expected = "Hello TestSOAPInputMessage"; 371 checkStreamSource(expected, streamSourceResp); 372 373 disp.invokeOneWay(streamSourceReq1); 374 375 Response response = disp.invokeAsync(streamSourceReq2); 376 StreamSource streamSourceResp2 = (StreamSource )response.get(); 377 assertNotNull(streamSourceResp2); 378 String expected2 = "Hello TestSOAPInputMessage2"; 379 checkStreamSource(expected2, streamSourceResp2); 380 381 382 TestStreamSourceHandler tssh = new TestStreamSourceHandler(); 383 Future fd = disp.invokeAsync(streamSourceReq3, tssh); 384 assertNotNull(fd); 385 while (!fd.isDone()) { 386 } 388 String expected3 = "Hello TestSOAPInputMessage3"; 389 StreamSource streamSourceResp3 = tssh.getStreamSource(); 390 assertNotNull(streamSourceResp3); 391 checkStreamSource(expected3, streamSourceResp3); 392 393 } 394 395 public void testStreamSourcePAYLOAD() throws Exception { 396 397 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 398 assertNotNull(wsdl); 399 400 SOAPService service = new SOAPService(wsdl, serviceName); 401 assertNotNull(service); 402 403 InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq.xml"); 404 StreamSource streamSourceReq = new StreamSource (is); 405 assertNotNull(streamSourceReq); 406 407 InputStream is1 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq1.xml"); 408 StreamSource streamSourceReq1 = new StreamSource (is1); 409 assertNotNull(streamSourceReq1); 410 411 InputStream is2 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq2.xml"); 412 StreamSource streamSourceReq2 = new StreamSource (is2); 413 assertNotNull(streamSourceReq2); 414 415 InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralSOAPBodyReq3.xml"); 416 StreamSource streamSourceReq3 = new StreamSource (is3); 417 assertNotNull(streamSourceReq3); 418 419 Dispatch<StreamSource > disp = service.createDispatch(portName, 420 StreamSource .class, Service.Mode.PAYLOAD); 421 StreamSource streamSourceResp = disp.invoke(streamSourceReq); 422 assertNotNull(streamSourceResp); 423 String expected = "Hello TestSOAPInputMessage"; 424 checkStreamSource(expected, streamSourceResp); 425 426 disp.invokeOneWay(streamSourceReq1); 427 428 Response response = disp.invokeAsync(streamSourceReq2); 429 StreamSource streamSourceResp2 = (StreamSource )response.get(); 430 assertNotNull(streamSourceResp2); 431 String expected2 = "Hello TestSOAPInputMessage2"; 432 checkStreamSource(expected2, streamSourceResp2); 433 434 435 TestStreamSourceHandler tssh = new TestStreamSourceHandler(); 436 Future fd = disp.invokeAsync(streamSourceReq3, tssh); 437 assertNotNull(fd); 438 while (!fd.isDone()) { 439 } 441 String expected3 = "Hello TestSOAPInputMessage3"; 442 StreamSource streamSourceResp3 = tssh.getStreamSource(); 443 assertNotNull(streamSourceResp3); 444 checkStreamSource(expected3, streamSourceResp3); 445 446 } 447 448 public void testJAXBObjectPAYLOAD() throws Exception { 449 450 URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); 451 assertNotNull(wsdl); 452 453 SOAPService service = new SOAPService(wsdl, serviceName); 454 assertNotNull(service); 455 456 JAXBContext jc = JAXBContext.newInstance("org.objectweb.hello_world_soap_http.types"); 457 Dispatch<Object > disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD); 458 459 String expected = "Hello Jeeves"; 460 GreetMe greetMe = new GreetMe(); 461 greetMe.setRequestType("Jeeves"); 462 463 Object response = disp.invoke(greetMe); 464 assertNotNull(response); 465 String responseValue = ((GreetMeResponse)response).getResponseType(); 466 assertTrue("Expected string, " + expected , expected.equals(responseValue)); 467 468 disp.invokeOneWay(greetMe); 469 470 Response response2 = disp.invokeAsync(greetMe); 471 assertNotNull(response2); 472 GreetMeResponse greetMeResponse = (GreetMeResponse)response2.get(); 473 String responseValue2 = greetMeResponse.getResponseType(); 474 assertTrue("Expected string, " + expected , expected.equals(responseValue2)); 475 476 477 478 TestJAXBHandler tjbh = new TestJAXBHandler(); 479 Future fd = disp.invokeAsync(greetMe, tjbh); 480 assertNotNull(fd); 481 while (!fd.isDone()) { 482 } 484 String responseValue3 = ((GreetMeResponse)tjbh.getResponse()).getResponseType(); 485 assertTrue("Expected string, " + expected , expected.equals(responseValue3)); 486 487 } 488 489 490 private void checkSAXSource(String expected, SAXSource source) { 491 492 InputSource inputSource = source.getInputSource(); 493 InputStream is = inputSource.getByteStream(); 494 495 int i = 0; 496 StringBuilder sb = new StringBuilder (); 497 try { 498 while (i != -1) { 499 i = is.read(); 500 sb.append((char)i); 501 } 502 } catch (IOException e) { 503 e.printStackTrace(); 505 } 506 String received = sb.toString(); 507 assertTrue("Expected: " + expected, received.contains(expected)); 508 509 } 510 511 private void checkStreamSource(String expected, StreamSource source) { 512 513 InputStream is = source.getInputStream(); 514 515 int i = 0; 516 StringBuilder sb = new StringBuilder (); 517 try { 518 while (i != -1) { 519 i = is.read(); 520 sb.append((char)i); 521 } 522 } catch (IOException e) { 523 e.printStackTrace(); 525 } 526 String received = sb.toString(); 527 assertTrue("Expected: " + expected, received.contains(expected)); 528 529 } 530 531 532 533 class TestSOAPMessageHandler implements AsyncHandler<SOAPMessage > { 534 535 String replyBuffer; 536 537 public void handleResponse(Response<SOAPMessage > response) { 538 try { 539 SOAPMessage reply = response.get(); 540 replyBuffer = reply.getSOAPBody().getTextContent(); 541 } catch (Exception e) { 542 e.printStackTrace(); 543 } 544 } 545 546 public String getReplyBuffer() { 547 return replyBuffer; 548 } 549 } 550 551 class TestDOMSourceHandler implements AsyncHandler<DOMSource > { 552 553 String replyBuffer; 554 555 public void handleResponse(Response<DOMSource > response) { 556 try { 557 DOMSource reply = response.get(); 558 replyBuffer = reply.getNode().getFirstChild().getTextContent(); 559 } catch (Exception e) { 560 e.printStackTrace(); 561 } 562 } 563 564 public String getReplyBuffer() { 565 return replyBuffer; 566 } 567 } 568 569 class TestSAXSourceHandler implements AsyncHandler<SAXSource > { 570 571 SAXSource reply; 572 573 public void handleResponse(Response<SAXSource > response) { 574 try { 575 reply = response.get(); 576 577 } catch (Exception e) { 578 e.printStackTrace(); 579 } 580 } 581 582 public SAXSource getSAXSource() { 583 return reply; 584 } 585 } 586 587 class TestStreamSourceHandler implements AsyncHandler<StreamSource > { 588 589 StreamSource reply; 590 591 public void handleResponse(Response<StreamSource > response) { 592 try { 593 reply = response.get(); 594 595 } catch (Exception e) { 596 e.printStackTrace(); 597 } 598 } 599 600 public StreamSource getStreamSource() { 601 return reply; 602 } 603 } 604 605 class TestJAXBHandler implements AsyncHandler<Object > { 606 607 Object reply; 608 609 public void handleResponse(Response<Object > response) { 610 try { 611 reply = response.get(); 612 } catch (Exception e) { 613 e.printStackTrace(); 614 } 615 } 616 617 public Object getResponse() { 618 return reply; 619 } 620 } 621 622 } 623 | Popular Tags |