/** * Several tests (T1, etc) use the same functionality, send an empty body with the "echoOk" header * using various roles, and check the return in the "responseOk" header. * * @throws Exception */ protected void testEchoOkHeaderWithEmptyBody(String role) throws Exception { test.wsdl.soap12.assertion.Soap12TestDocBindingStub binding; try { binding = (test.wsdl.soap12.assertion.Soap12TestDocBindingStub) new test.wsdl.soap12.assertion.WhiteMesaSoap12TestSvcLocator().getSoap12TestDocPort(); } catch (javax.xml.rpc.ServiceException jre) { if (jre.getLinkedCause() != null) jre.getLinkedCause().printStackTrace(); throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre); } assertNotNull("binding is null", binding); // Time out after a minute binding.setTimeout(60000); // Test operation SOAPHeaderElement header = new SOAPHeaderElement(TEST_NS, "echoOk"); if (role != null) header.setRole(role); header.setObjectValue("this is a test"); binding.setHeader(header); binding.emptyBody(); // Get the response header SOAPHeaderElement respHeader = binding.getHeader(TEST_NS, "responseOk"); assertNotNull("Missing response header", respHeader); assertEquals("this is a test", respHeader.getValue()); }
/** * Test T6 - echoOk header targeted at endpoint via intermediary * * @throws Exception */ public void testT6() throws Exception { Call call = new Call(INTERMEDIARY_ENDPOINT); call.setOperationStyle(Style.DOCUMENT); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); SOAPEnvelope reqEnv = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS); SOAPHeaderElement header = new SOAPHeaderElement(TEST_NS, "echoOk"); header.setRole(ROLE_C); header.setObjectValue("test header"); reqEnv.addHeader(header); SOAPEnvelope respEnv = call.invoke(reqEnv); SOAPHeaderElement respHeader = respEnv.getHeaderByName(TEST_NS, "responseOk"); assertNotNull(respHeader); assertEquals("test header", respHeader.getValue()); }