2013-09-02 3 views
0

У меня есть веб-сервис в C#, и я получаю сообщения с вложениями с вложениями. Это журнал Wireshark одного запросаКак получить сообщение о мыле с вложением в WCF

POST /scripts/vivo_sdp/ReceiveMmsNotificationService.asmx HTTP/1.1 SOAPAction: ""Content-Type: multipart/related; type="text/xml"; start="<[email protected]>"; boundary="----=_Part_1012.1378126647" Host: 1.1.1.1:0000 Connection: closeContent-Length: 5078 ------=_Part_1012.1378126647Content-Type: text/xml; charset=UTF-8Content-Transfer-Encoding: 8bitContent-ID: <[email protected]> 
<?xml version="1.0" encoding="utf-8" ?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soapenv:Header> 
     <ns1:NotifySOAPHeader xmlns:ns1="http://www.huawei.com.cn/schema/common/v2_1"> 
      <ns1:spRevId>XXXXXXX</ns1:spRevId> 
      <ns1:spRevpassword>XXXXXXXX</ns1:spRevpassword> 
      <ns1:spId>000370</ns1:spId> 
      <ns1:serviceId>0100218100</ns1:serviceId> 
     </ns1:NotifySOAPHeader> 
    </soapenv:Header> 
    <soapenv:Body> 
     <ns2:notifyMessageReception xmlns:ns2="http://www.csapi.org/schema/parlayx/multimedia_messaging/notification/v2_4/local"> 
      <ns2:correlator>01090212572613003106</ns2:correlator> 
      <ns2:message> 
       <messageIdentifier>hwiuFVMFHjTfK9</messageIdentifier> 
       <messageServiceActivationNumber>XXXXXXX</messageServiceActivationNumber> 
       <senderAddress>tel:XXXXXXXXXX</senderAddress> 
       <priority>Default</priority> 
       <dateTime>2013-09-02T09:50:58-03:00</dateTime> 
      </ns2:message> 
     </ns2:notifyMessageReception> 
    </soapenv:Body> 
</soapenv:Envelope> 
------=_Part_1012.1378126647Content-ID: <oQpSk>Content-Location: 01smilContent-Transfer-Encoding: 8bitContent-Type: application/smil; name=01smil<smil><head><layout><root-layout width="240" height="320" /><region id="Image" width="100%" height="70%" left="0%" top="0%" fit="meet" /></layout></head><body><par dur="8000ms"><img src="Bunny.svgz" region="Image" /></par></body></smil> 
------=_Part_1012.1378126647Content-ID: <Bunny.svgz>Content-Location: Bunny.svgzContent-Transfer-Encoding: 8bitContent-Type: application/oct-stream; name=Bunny.svgz...........Z.n.G.}v...,...3....!m QR` ....b....ea.J.(....9=$EzI..\..k..8....S.N.....?_7.&[email protected]~..._...j2....7.......I.....n^/5..5.6...Us...f6o.....^M.S/../............_|..i...q.....~{....l.....W.f. 
..p......:....O.>h.o.........yp.fv9.jv~..j|7..!...!&.1.......k..Asuq88}.........p..j..T.!/.__M..m..R.........A.K...O^4.W..................... 
...7.H..`B...G.....t........O......>..a./.n......lr7...T+\.... 
..... 
n_..C.;W..A........b.IV..76.N.:....;.....]..\<.z1....BkM..m..u.sP2.{Lj.(..[.d.+.56I+..O...x1!.1F..V./...\..>..S. 
.p..l06......Rqm0.eLe..G........7..Xp 
,......|...+c.D.k..z.}j.`*ii.W....7.V.&%.8Z;...0J..`.[.t..q..S0%...}..........p..W.{..F.. 
.......p{:......yz7..c'.?.s..:`&...........z.=...."..B.......3./....~.[.C.b......x...8I.>..i..3....{r>..\\M..J!..W'?.O..rq.....\r....1......HA......A 
..)......z8p../9...&..'.... 
?;......|8..|>.z.9.UBn./E..G....F.|j. 
\ 
.|A..1..7.Ms.....$.....r 
...n|s 
...(.Q.......<.... 
......\.[.Kg.....%)[..............(y.c..........XN.7.'...]....[$...h..M.}H.....?[.........q....y.#.....uE..[....k.I..A..Pu.."..z'C<A.OS.."*]c.u.V.Rj7....k..}<.z..jR.y..sJO.D..$.e#$.h......34l.}'..G.Y..B.p.hD...W...<....#../ 
z......."e...N....v.s...~..3V&...^..h.p...m.O<.O....MI...'........... ......0.. 
NH.=.1.3...e.qL....T.<......Ya...r.o.0.o.&S..b)..`.P.J..24..x0z..6..-...N."....Qc..0...G....5.3.G.....6.C........f$e.G.\..e..4.7.J}F".q.8..^.P...&).:.]|u.".7..W.....spE).$.....$..0s^M..t..y....4"..{..-.v..H..I...{M....L.v......d.M..<.b.m`H.I.N..Y.5pfk..q#....6#..Y:.:.V.L.7...s....(...t.%..:.k.o\[email protected],.....?)........h....:.9>.HA.g..-}....o.|.2.H#L...(...\r"....=..C....Y......J.c...:`..Jf.+[0...H.U..q. 
.][email protected]#.;.sU......1...#d.."m..4\...L.. [email protected])x.....W.yu........V.v....{.S?Fn{.c'..N%.I.v`Cl.......&:j]U...^ ..n*......V..)%[email protected]{4S.Q.8.*R.D.}[email protected]@Y 
. 
....N...PxK........T}V..L.0...MQ`%H=.6H..j.HU..T.{.....b/......B........-=A(w). yE...O%?...t.......,.Y.!.......-..K....fG.... 
`...6.,.823..4.I.*[email protected]=.]\erW...W...!. 
[email protected]"J.f............}.M.qO,#...n.eFpq~..BA.W:...h.OA......>Ih.?..=.#...%Y.9`>..v.$j...3.......!8=>:>y>.. 
[email protected]".V..f\.C..7........D..*`y..vM..7f.......Pn. 
..T.u..Cd...3.sp.>.g.=5...:..`b-..!h.....fr......K.....1.Fh+ 
}eLB(...X([email protected]`..P....+P._o,..z4........Y.21+....e.g.{.Y.^l..Z..3,>.G...v...lf2.}[email protected] 
T...x.... 
.......g[....X..'v.R...A.l.Q 
.f.}x..l.T...`.....-.O.Q.............R..-.1K*..j..R.j...T[E..M..j.....L...P.%'670e.r.........Q..h3oe.,.......-.N......}..kg.....M#.....q)i.1...]&v.`..e.....]..#...1B..&(1..3..B.....j..T;.%..,....D...........L{..r?...5r"[D0Y=.._r.........Q..J. 
...C...X{..l.z..c;......1G.Z.....\...u../y...?.....'.G._.U.N...y....)8.....%-.........).%...!....SE.vz.0;....=....I.Y.....Fv.=..HUL.....<B...v..... Y....+...i...p|L...Pa9...)@#..O...3K..q..S....p... hE..or.k...Vb.^8.".Td...N..g..U}...du........6>kSW...i..(.L.S.`.0..?1.7....e..tH`..>b.y..>... 
....4..t...~W.t|[email protected] 0j..#v.....*^.&%.%L...+.........e....l...J"y 
Q.2..]c. 
.&..*$O....L.]A...;....k1..k+...E..._P....fc..R..v)[email protected]>.......P...Y`^....3....82..R_fY).'j..B.a?......M.......$R`...... 
.8...bF..*.y..`[email protected]*cc..M..i.......Z."W 
.`!..L&.R"z... 
`......).8.k...K&......0)P....R..."..B....d.W.,....:.....S...u...d<o...S..S.q3X.pz3.o<~.g..=....q.....".v%.. 
------=_Part_1012.1378126647-- 

и это ответ, что мой сервер дает

HTTP/1.1 500 Internal Server ErrorConnection: closeDate: Mon, 02 Sep 2013 12:57:27 GMTServer: Microsoft-IIS/6.0P3P: CP="CAO PSA OUR"X-Powered-By: ASP.NETX-AspNet-Version: 2.0.50727Cache-Control: privateContent-Type: text/xml; charset=utf-8Content-Length: 754 
<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
     <soap:Fault> 
      <faultcode>soap:Server</faultcode> 
      <faultstring>The root element for the request could not be determined. When RoutingStyle is set to RequestElement, SoapExtensions configured via an attribute on the method cannot modify the request stream before it is read. The extension must be configured via the SoapExtensionTypes element in web.config, or the request must arrive at the server as clear text. ---&gt; Data at the root level is invalid. Line 1, position 1.</faultstring> 
      <detail /> 
     </soap:Fault> 
    </soap:Body> 
</soap:Envelope> 

Это подпись метода

[WebService(Namespace = "http://tempuri.org/")] 
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
[SoapDocumentService(RoutingStyle = SoapServiceRoutingStyle.RequestElement)] 
[System.ComponentModel.ToolboxItem(false)] 
public class ReceiveMmsNotificationService : WebService, IMessageNotificationBinding, IReceiveMessageBinding 
{ 
    [WebMethod] 
    public notifyMessageReceptionResponse notifyMessageReception(notifyMessageReception notifyMessageReception1) 
    { 
     notifyMessageReceptionResponse result = new notifyMessageReceptionResponse(); 
     return result; 
    } 
} 

Как может я изменить мой веб-сервис, чтобы я мог принимать сообщения с вложениями?

ответ

0

Это типы вложений mime/swa. wcf не поддерживает их по умолчанию (поддерживается только mtom), но вы можете использовать this extension.

+0

Он работает для получения сообщений? И тем, что я увидел в исходном коде, он чрезвычайно жестко закодирован –

+0

согласно документации, он должен работать в обоих направлениях (я не пробовал). –

+0

Это Чрезвычайно жестко закодированное, он использует идентификатор сообщения и не должен даже считаться одним расширением, но способ, которым парень работал вокруг своей собственной проблемы и даже не работает –

Смежные вопросы