16.13. PAYLOAD 모드에서 iPXE 헤더를 가져오고 설정하는 방법
PAYLOAD 데이터 형식의 camel-cxf 엔드포인트에 대한 메시지를 처리하는 방법 섹션에서 PAYLOAD 모드에서 CxfPayload 오브젝트로 CHAP 메시지에 액세스하는 방법을 이미 보여주었습니다.
CxfPayload 오브젝트를 가져온 후 CxfPayload.getHeaders() 메서드를 호출하면 List of ScanSetting(SOAP 헤더)를 반환할 수 있습니다.
예를 들어 CxfPayLoadSoapHeaderTest 를 참조하십시오.
from(getRouterEndpointURI()).process(new Processor() {
@SuppressWarnings("unchecked")
public void process(Exchange exchange) throws Exception {
CxfPayload<SoapHeader> payload = exchange.getIn().getBody(CxfPayload.class);
List<Source> elements = payload.getBodySources();
assertNotNull(elements, "We should get the elements here");
assertEquals(1, elements.size(), "Get the wrong elements size");
Element el = new XmlConverter().toDOMElement(elements.get(0));
elements.set(0, new DOMSource(el));
assertEquals("http://camel.apache.org/pizza/types",
el.getNamespaceURI(), "Get the wrong namespace URI");
List<SoapHeader> headers = payload.getHeaders();
assertNotNull(headers, "We should get the headers here");
assertEquals(1, headers.size(), "Get the wrong headers size");
assertEquals("http://camel.apache.org/pizza/types",
((Element) (headers.get(0).getObject())).getNamespaceURI(), "Get the wrong namespace URI");
// alternatively you can also get the SOAP header via the camel header:
headers = exchange.getIn().getHeader(Header.HEADER_LIST, List.class);
assertNotNull(headers, "We should get the headers here");
assertEquals(1, headers.size(), "Get the wrong headers size");
assertEquals("http://camel.apache.org/pizza/types",
((Element) (headers.get(0).getObject())).getNamespaceURI(), "Get the wrong namespace URI");
}
})
.to(getServiceEndpointURI());
sub-chapter " how to get and set iPXE headers inECDHE mode"에 설명된 것과 동일한 방법을 사용하여 iPXE 헤더를 설정하거나 가져올 수도 있습니다. 따라서 헤더 "org.apache.cxf.headers.Header.list" 헤더를 사용하여 CHAP 헤더 목록을 가져오고 설정할 수 있습니다. 이는 Camel-cxf 끝점에서 다른(SOAP 클라이언트