@Test public void testSetHeaderChildString() throws Exception { String parentNamespace = "parentNamespace"; String parentName = "parentName"; when(mockSoapClient.getBinding()).thenReturn(mockBinding); when(mockBinding.getHandlerChain()).thenReturn(handlerChain); SOAPFactory soapFactory = SOAPFactory.newInstance(); SOAPElement parentHeader = soapFactory.createElement(parentName, null, parentNamespace); jaxWsHandler.setHeader(mockSoapClient, parentNamespace, parentName, parentHeader); String childNamespace = "childNamespace"; String childName = "childName"; String childValue = "foo"; jaxWsHandler.setHeaderChildString(mockSoapClient, parentName, childNamespace, childName, childValue); SOAPElement parentHeaderFromHandler = (SOAPElement) jaxWsHandler.getHeader(mockSoapClient, parentName); SOAPElement childHeaderFromHandler = (SOAPElement) parentHeaderFromHandler.getFirstChild(); assertEquals("Child name incorrect", childName, childHeaderFromHandler.getNodeName()); assertEquals("Child namespace incorrect", childNamespace, childHeaderFromHandler.getNamespaceURI()); assertEquals("Child value incorrect", childValue, childHeaderFromHandler.getTextContent()); }
public void setHeaderChildString(BindingProvider soapClient, final String headerName, String childNamespace, String childName, String childValue) { SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName); Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName); try { SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName)); childElement.setTextContent(childValue); } catch (SOAPException e) { throw new ServiceException("Failed to set header for child " + childName, e); } }
JaxWsHandler extends SoapClientHandler<BindingProvider> { public void setHeaderChildString(BindingProvider soapClient, final String headerName, String childNamespace, String childName, String childValue) { SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName); Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName); try { SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName)); childElement.setTextContent(childValue); } catch (SOAPException e) { throw new ServiceException("Failed to set header for child " + childName, e); } } }
JaxWsHandler extends SoapClientHandler<BindingProvider> { public void setHeaderChildString(BindingProvider soapClient, final String headerName, String childNamespace, String childName, String childValue) { SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName); Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName); try { SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName)); childElement.setTextContent(childValue); } catch (SOAPException e) { throw new ServiceException("Failed to set header for child " + childName, e); } } @Inject protected  JaxWsHandler(Provider<JaxWsSoapContextHandler> contextHandlerProvider); }
JaxWsHandler extends SoapClientHandler<BindingProvider> { public void setHeaderChildString(BindingProvider soapClient, final String headerName, String childNamespace, String childName, String childValue) { SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName); Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName); try { SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName)); childElement.setTextContent(childValue); } catch (SOAPException e) { throw new ServiceException("Failed to set header for child " + childName, e); } } @Inject protected  JaxWsHandler(Provider<JaxWsSoapContextHandler> contextHandlerProvider); @Override void setEndpointAddress(BindingProvider soapClient, String endpointAddress); @Override Object getHeader(BindingProvider soapClient, String headerName); @Override void clearHeaders(BindingProvider soapClient); @Override void setHeader(BindingProvider soapClient, String namespace, String headerName,
      Object headerValue); void setHeaderChildString(BindingProvider soapClient, final String headerName,
      String childNamespace, String childName, String childValue); @Override void putAllHttpHeaders(BindingProvider soapClient, Map<String, String> headersMap); @Override void setCompression(BindingProvider soapClient, boolean compress); @Override BindingProvider createSoapClient(SoapServiceDescriptor soapServiceDescriptor); @Override void setRequestTimeout(BindingProvider bindingProvider, int timeout); @Override RemoteCallReturn invokeSoapCall(SoapCall<BindingProvider> soapCall); @Override String getEndpointAddress(BindingProvider soapClient); @Override SOAPHeaderElement createSoapHeaderElement(QName qName); }
JaxWsHandler extends SoapClientHandler<BindingProvider> { public void setHeaderChildString(BindingProvider soapClient, final String headerName, String childNamespace, String childName, String childValue) { SOAPElement parentHeader = (SOAPElement) getHeader(soapClient, headerName); Preconditions.checkNotNull(parentHeader, "No header element found with name: %s", headerName); try { SOAPElement childElement = parentHeader.addChildElement(new QName(childNamespace, childName)); childElement.setTextContent(childValue); } catch (SOAPException e) { throw new ServiceException("Failed to set header for child " + childName, e); } } @Inject protected  JaxWsHandler(Provider<JaxWsSoapContextHandler> contextHandlerProvider); @Override void setEndpointAddress(BindingProvider soapClient, String endpointAddress); @Override Object getHeader(BindingProvider soapClient, String headerName); @Override void clearHeaders(BindingProvider soapClient); @Override void setHeader(BindingProvider soapClient, String namespace, String headerName,
      Object headerValue); void setHeaderChildString(BindingProvider soapClient, final String headerName,
      String childNamespace, String childName, String childValue); @Override void putAllHttpHeaders(BindingProvider soapClient, Map<String, String> headersMap); @Override void setCompression(BindingProvider soapClient, boolean compress); @Override BindingProvider createSoapClient(SoapServiceDescriptor soapServiceDescriptor); @Override void setRequestTimeout(BindingProvider bindingProvider, int timeout); @Override RemoteCallReturn invokeSoapCall(SoapCall<BindingProvider> soapCall); @Override String getEndpointAddress(BindingProvider soapClient); @Override SOAPHeaderElement createSoapHeaderElement(QName qName);  }