여기에서 Json 데이터를 CSV 형식으로 변환하려고하는데 마지막으로이 파일을 Ofbiz 서버 api로 보내려고합니다. 그러나 URL에 매개 변수를 보낼 때 api 끝점에 인증 내용이 필요합니다. 아래 출력이 있습니다.apache camel DSL 또는 낙타 프로세서 내부에 추가 인증 속성을 설정하는 방법은 무엇입니까?
{ "_ERROR_MESSAGE _": "오류 이벤트를 호출 : org.apache.ofbiz.webapp.event.EventHandlerException을 찾음 URL 매개 변수 [configId] 이벤트와 URI [uploadAndImportFileFromCSVFile]와 (HTTPS) 요청 맵을 확보하기 위해 통과 그 사람은 서비스 [uploadAndImportFile]를 호출하는데 이것은 보안상의 이유로 허용되지 않습니다! 요청 URL 대신 요청 본문 (양식 필드)의 일부로 데이터를 암호화해야합니다. 또한 Jira를 만들 수 있다면 친절 할 것입니다 https://issues.apache.org/jira/browse/OFBIZ-2330의 하위 작업 (이 오류에 대한 하위 작업이없는 경우 전에 확인하십시오.) Jira 문제를 만드는 방법을 잘 모르는 경우 https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Contributors+Best+Practices에 미리 살펴보십시오. 도움을 주셔서 감사합니다. "," sessionId ":"someId .jvm1 ","removePathAlias ": false,"loggedIn ": true,"USERNAME ":"__ " , "_ LOGIN_PASSED _": "TRUE", "webSiteId": "API"}
그 후 저는 아래 요청을 보내기 위해 MultipartBuilder를 사용했습니다.
exchange.getIn().setHeader("bearer",token);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
File file =new File("//home/r2/Desktop/ofBizFile/orderFile.csv");
builder.addPart("configId",new StringBody("CON_ID"));
builder.addPart("fileTypeEnumId",new StringBody("CSV_FILE"));
builder.addPart("_uploadedFile_contentType",new StringBody("text/csv"));
builder.addPart("uploadedFile",new FileBody(file));
exchange.getIn().setBody(builder.build());
나는 이와 비슷한 것을 시도했다. 여기
exchange.setProperty(Exchange.CHARSET_NAME, "ISO-8859-1");
exchange.getIn().setHeader(Exchange.HTTP_QUERY,"USERNAME=abc&PASSWORD=bc69");
exchange.getIn().setBody("configId=CON_ID&fileTypeEnumId=CSV_FILE");
그래서 문제가 내가 다음
Route3에 대한
Route2 ProcessorGetToken 신체 내부에 데이터를 보낼 수있는 방법을 내 낙타 경로
//Route 1
from("couchdb:http://localhost:5984/order")
.process(new JsonToCsvProcessor())
//Storing file into local directory
.to("file:/home/r2/Desktop/ofBizFile?fileExist=append&fileName=order-${date:now:yyyyMMdd}.csv");
.to("direct:jsonToCsv");
//Route 2
from("direct:jsonToCsv")
.setHeader(Exchange.HTTP_QUERY,constant("USERNAME=__&PASSWORD=__"))
//For get token
.to("https4://SomeAddress.com/centerAPI/getAuthenticationToken")
//Get the token and set required parameter for route 3
.process(new ProcessorGetToken())
.to("direct:hold");
//Route 3
from("direct:hold")
.setHeader(Exchange.HTTP_QUERY,constant("USERNAME=__&PASSWORD=__"))
.to("https4://SomeAddress.com/centerAPI/uploadAndImportFileFromCSVFile?throwExceptionOnFailure=false")
//How I know the file is submited successfuly ?
.to("stream:out").end();
입니까?