0

HTTP 어댑터에서 multipart/related 콘텐트 유형의 SOAP 서비스를 호출해야합니다. 내가 WL.Server.invokeHttp 매개 변수IBM Mobile First 7.1 : 다중 파트/관련 Content-Type 및 XSL 변환

{ 
    method : 'post', 
    returnedContentType : 'xml', 
    returnedContentEncoding : 'utf-8', 
    path : servicePath, 
    body : { 
     content : MY_REQUEST, 
     contentType : "text/xml; charset=utf-8" 
    }, 
    transformation: { 
      type: 'xslFile', 
      xslFile: 'myXsl.xsl' 
    } 
}; 

으로이 객체를 사용하는 경우

나는이 오류가 발생했습니다 :

"Runtime: Failed to read the HTTP response to: /MyService 
\njava.lang.IllegalArgumentException: Http content type 'multipart/related' not supported. 
Supported types are: [json, css, csv, javascript, plain, xml, html]" 

그래서 나는 결과를 얻기 위해 매개 변수 returnedContentType: 'plain'를 수정했습니다. 이제 응답은 다음과 같습니다.

{ 
"isSuccessful": true, 
"errors": [], 
"warnings": [], 
"info": [], 
"text": "--uuid:85c87f37-9436-41d1-94d4-0b944c3618b1\nContent-Type: application/xop+xml; charset=UTF-8; type=\"text/xml\";\nContent-Transfer-Encoding: binary\nContent-ID: <[email protected]>\n\n 

MY SOAP RESPONSE 

\n--uuid:85c87f37-9436-41d1-94d4-0b944c3618b1--", 
"responseHeaders": { 
    ... 
    "Content-Type": "multipart/related; type=\"application/xop+xml\"; boundary=\"uuid:85c87f37-9436-41d1-94d4-0b944c3618b1\"; start=\"<[email protected]>\"; start-info=\"text/xml\"" 
    ... 
} 
} 

그러나 xsl 변환은 수행되지 않습니다. 텍스트 매개 변수에서 일부 문자열 조작으로 SOAP 응답을 문자열로 얻을 수 있지만 json을 얻기 위해 수동으로 XSL 변환을 호출하는 방법 (일부 API)을 찾지 못했습니다.

답변

0

XSL 변환은 서버 측에서만 수행됩니다 (수동 활성화는 없습니다). 아마도 XSL 변환이 필요한 경우 JavaScript를 통해 XSL을 실행할 수 있습니다. 예를 들어 : how to run XSL file using JavaScript/HTML file