289.9. IDoc에 대한 XML Serialization
289.9.1. 개요
IDoc 메시지 본문은 기본 제공 형식 변환기의 도움으로 XML 문자열 형식으로 serialize될 수 있습니다.An IDoc message body can be serialized into an XML string format, with the help of a built-in type converter.
289.9.2. XML 네임스페이스
각 직렬화된 IDoc는 다음과 같은 일반적인 형식을 가진 XML 네임스페이스와 연결됩니다.
http://sap.fusesource.org/idoc/repositoryName/idocType/idocTypeExtension/systemRelease/applicationRelease
repositoryName (원격 SAP 메타 데이터 리포지토리의 이름)과 idocType (IDoc 문서 유형)은 모두 필수이지만 네임스페이스의 다른 구성 요소는 비워 둘 수 있습니다. 예를 들어 다음과 같은 XML 네임스페이스가 있을 수 있습니다.
http://sap.fusesource.org/idoc/MY_REPO/FLCUSTOMER_CREATEFROMDATA01///
289.9.3. 내장 유형 변환기
Camel SAP 구성 요소에는 Document 오브젝트 또는 DocumentList 개체를 String 유형으로 변환할 수 있는 기본 제공 형식 변환기가 있습니다.
예를 들어 Document 개체를 XML 문자열로 serialize하려면 XML DSL의 경로에 다음 행을 추가하면 됩니다.
<convertBodyTo type="java.lang.String"/>
이 방법을 사용하여 serialize된 XML 메시지를 Document 개체에 포함할 수도 있습니다.You can also use this approach to a serialized XML message into a Document object. 예를 들어 현재 메시지 본문이 직렬화된 XML 문자열인 경우 XML DSL의 경로에 다음 줄을 추가하여 문서 오브젝트로 다시 변환할 수 있습니다.
<convertBodyTo type="org.fusesource.camel.component.sap.model.idoc.Document"/>
289.9.4. 샘플 IDoc 메시지 본문 XML 형식
IDoc 메시지를 문자열로 변환할 때 루트 요소는 idoc:Document(단일 문서용) 또는 의 경우)가 되는 XML 문서로 idoc:Document (문서 목록직렬화 됩니다. 예 289.2. “XML의 IDoc 메시지 본문” idoc:Document 요소로 직렬화된 단일 IDoc 문서를 보여줍니다.
예 289.2. XML의 IDoc 메시지 본문
<?xml version="1.0" encoding="ASCII"?>
<idoc:Document
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:FLCUSTOMER_CREATEFROMDATA01---="http://sap.fusesource.org/idoc/XXX/FLCUSTOMER_CREATEFROMDATA01///"
xmlns:idoc="http://sap.fusesource.org/idoc"
creationDate="2015-01-28T12:39:13.980-0500"
creationTime="2015-01-28T12:39:13.980-0500"
iDocType="FLCUSTOMER_CREATEFROMDATA01"
iDocTypeExtension=""
messageType="FLCUSTOMER_CREATEFROMDATA"
recipientPartnerNumber="QUICKCLNT"
recipientPartnerType="LS"
senderPartnerNumber="QUICKSTART"
senderPartnerType="LS">
<rootSegment xsi:type="FLCUSTOMER_CREATEFROMDATA01---:ROOT" document="/">
<segmentChildren parent="//@rootSegment">
<E1SCU_CRE parent="//@rootSegment" document="/">
<segmentChildren parent="//@rootSegment/@segmentChildren/@E1SCU_CRE.0">
<E1BPSCUNEW parent="//@rootSegment/@segmentChildren/@E1SCU_CRE.0"
document="/"
CUSTNAME="Fred Flintstone" FORM="Mr."
STREET="123 Rubble Lane"
POSTCODE="01234"
CITY="Bedrock"
COUNTR="US"
PHONE="800-555-1212"
EMAIL="fred@bedrock.com"
CUSTTYPE="P"
DISCOUNT="005"
LANGU="E"/>
</segmentChildren>
</E1SCU_CRE>
</segmentChildren>
</rootSegment>
</idoc:Document>