我有一个MIME附件,其中包含存储为字符串的SOAP消息,如下所示:
------=_Part_10_182815722.1522086113658
Content-Type: application/soap+xml; charset=utf-8
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
.....
</s:Header>
<s:Body>
...
</s:Body>
</s:Envelope>
------=_Part_10_182815722.1522086113658
Content-Type: application/octet-stream
Content-ID: <635742060149828871>
Content-Transfer-Encoding: binary
......
我认为我可以使用getSOAPPart()
在将所有内容写入ByteArrayOutputStream
之前将其提取出来以存储为字符串但是它出现的效果不符合我的预期。
有关于此的任何提示吗?
答案 0 :(得分:0)
我完成了它,而不是将其作为一个字符串:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => 'innoDB',
],
我使用下面的方法只转换MIME多部分的SOAP部分:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
soapMessage.writeTo(baos);
String strSOAPMessage = baos.toString(getMessageEncoding(msg));