我在 Windows Store Apps 中编写了以下程序。
CustomBinding b = new CustomBinding() ;
TextMessageEncodingBindingElement t = new TextMessageEncodingBindingElement();
HttpTransportBindingElement h = new HttpTransportBindingElement();
b.Elements.Add(t);
b.Elements.Add(h);
MyService client = new MyService(b, new EndpointAddress("http://localhost:8080/"));
var request = ...;
var response = client.Service000(request);
在 Service000 中,请求消息是 Utf-8 编码,但响应消息是 Mtom 编码,如下所示。
mime-version: 1.0
Content-Type: Multipart/Related;
boundary=4aa7d814-adc1-47a2-8e1c-07585b9892a4;
type=application/xop+xml;
start=”<14629f74-2047-436c-8046-5cac76d280fc@uuid>”;
startinfo=”application/soap+xml”
--4aa7d814-adc1-47a2-8e1c-07585b9892a4
Content-Type: application/xop+xml; type="application/soap+xml"
charset=UTF-8
Content-Transfer-Encoding: binary
Content-ID: <14629f74-2047-436c-8046-5cac76d280fc@uuid>
<soap:Envelope>
....
</soap:Envelope>
--4aa7d814-adc1-47a2-8e1c-07585b9892a4
Content-Type: image/jpeg;
Content-Transfer-Encoding: binary
Content-ID: <1c696bd7-005a-48d9-9ee9-9adca11f8892@uuid>
Binary Scan Data
--4aa7d814-adc1-47a2-8e1c-07585b9892a4--
我想通过 MtomMwssageEncodeingBindingElement 处理响应消息。但 WinRT 不支持 MtomMwssageEncodeingBindingElement。有没有办法处理 Mtom Enconding 消息?