【问题标题】:IBM Mobile First 7.1: multipart/related Content-Type and XSL transformationIBM Mobile First 7.1:多部分/相关 Content-Type 和 XSL 转换
【发布时间】:2016-10-03 08:39:55
【问题描述】:

我需要从 HTTP 适配器调用具有 multipart/related 内容类型的 SOAP 服务。

如果我将此对象用作WL.Server.invokeHttp 参数

{
    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: <root.message@cxf.apache.org>\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=\"<root.message@cxf.apache.org>\"; start-info=\"text/xml\""
    ...
}
}

但是没有执行 xsl 转换。 通过对文本参数进行一些字符串操作,我可以将 SOAP 响应作为字符串获取,但我没有找到一种方法(某些 API)来手动调用 XSL 转换以获取 json。

【问题讨论】:

    标签: ibm-mobilefirst multipart worklight-adapters mobilefirst-adapters


    【解决方案1】:

    XSL 转换仅在服务器端完成(没有手动“激活”)。如果您仍然需要进行 XSL 转换,您可以做的也许是通过 JavaScript 运行 XSL。例如:how to run XSL file using JavaScript / HTML file

    【讨论】:

      猜你喜欢
      • 2017-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-14
      • 1970-01-01
      相关资源
      最近更新 更多