Jboss Fuse 6.2.1을 사용하여 Apache Camel에서 머리를 감싸려고하고 있는데 SOAP 헤더가 어떻게 처리되는지 이해할 수 없습니다.Camel-CXF에서 SOAP 헤더는 어떻게 처리됩니까?
입력 및 출력 메시지에 대한 클래스를 생성 한 WSDL이 있습니다. 입력은 머리글과 본문으로 구성되며 출력은 본문으로 만 구성됩니다.
WSDL
<wsdl:types>
<xs:schema targetNamespace="http://cxftestserver.blueprint.me.com">
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="Id" />
<xs:element type="xs:string" name="Name" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="output">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="Code" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema targetNamespace="http://cxftestserver.blueprint.me.com/authentication">
<xs:element name="authHeader">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="username" />
<xs:element type="xs:string" name="password" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="inputTest">
<wsdl:part name="header" element="tns1:authHeader" />
<wsdl:part name="body" element="tns:input" />
</wsdl:message>
<wsdl:message name="outputTest">
<wsdl:part name="out" element="tns:output" />
</wsdl:message>
청사진
<bean id="myProcessor" class="com.me.blueprint.cxftestserver.MyProcessor" />
<cxf:cxfEndpoint id="test-ws" address="/Test" serviceClass="com.me.blueprint.cxftestserver.TestEndpoint" />
<camel:camelContext>
<camel:route>
<camel:from uri="cxf:bean:test-ws" />
<camel:process ref="myProcessor" />
</camel:route>
</camel:camelContext>
지금은 이해 내부 거래소의 메시지 바디가 authHeader 및 입력을 모두 포함되지 않는 이유는 무엇? 나는이 문서에서 읽은 모든 예제는 내가 수행하여 헤더를 추출 할 수 있어야한다고 제안 :
exchange.getIn().getHeaders(//insert your favorite parameter here);
을하지만 난 것을 시도했습니다 때마다 항상 null을 반환합니다. 마지막으로 Message-body에 SOAP-header와 SOAP-body를 둘 다 담고있는 MessageContentsList-object가 포함 된 것을 발견했을 때 몇 시간을 모두 낭비했습니다.
Message inMessage = e.getIn();
AuthHeader header = inMessage.getBody(AuthHeader.class);
Input body = inMessage.getBody(Input.class);
왜 이런 일이 발생했는지 설명해주세요.
답장을 보내 주셔서 감사합니다. 나는 그것이 지금 어디에서 그것을 발견하는지 알기 때문에 나의 머리말이 가공되고있는 방식으로 나에게 문제가되지 않는다고 덧붙여 야한다. 헤더가 헤더 대신 메시지 본문에서 발견되는 이유를 이해하지 못합니다. 필자는 약 1 주일 동안 Camel과 함께 놀았으므로 아직 모든 데이터 형식을 탐색 할 시간이 없었지만 확실하게 POJO가 MESSAGE 및 PAYLOAD보다 선호되는 시나리오가 있어야합니까? – noMad17
필자는 페이로드 유형이 무엇을 선호하는지에 달려 있다고 생각합니다. 항상 낙타와 함께 xslt를 사용하는 것을 선호합니다. 현재 내 서비스는 대부분 내부 용이므로 데이터 형식 MESSAGE + XSLT가 좋은 선택이며, 더 눈에 잘.니다. – gnanagurus