Read Multipart data from HttpWebResponse - c#

I got below response after web request
--uuid:d48d8249-7aa7-4674-b023-3a332240f077
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <root.message#cxf.apache.org>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:doTransferResponse xmlns:ns2="http://www.vontobel.com/vai/ws/filetransfer" xmlns:ns3="http://www.vontobel.com/vai/vai_header_types">
<serverFileSha1>
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:6f0ab43e-e466-4074-a4df-e026aeb94f89-22324#cxf.apache.org"/>
</serverFileSha1>
</ns2:doTransferResponse>
</soap:Body>
</soap:Envelope>
--uuid:d48d8249-7aa7-4674-b023-3a332240f077
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <6f0ab43e-e466-4074-a4df-e026aeb94f89-22324#cxf.apache.org>
%!�9:���_}`��I��~P�
--uuid:d48d8249-7aa7-4674-b023-3a332240f077--
How do I read binary data in the content?

Related

Stamps.com webservice Error - (500) Internal Server Error

I am getting the Error below when calling the Authenticate method of Stamps.com webservice.
The remote server returned an error: (500) Internal Server Error.
Here is the SOAP 1.1 definition of the request.
POST /swsim/SwsimV45.asmx HTTP/1.1
Host: swsim.testing.stamps.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://stamps.com/xml/namespace/2015/05/swsim/swsimv45/AuthenticateUser"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AuthenticateUser xmlns="http://stamps.com/xml/namespace/2015/05/swsim/swsimv45">
<Credentials>
<IntegrationID>guid</IntegrationID>
<Username>string</Username>
<Password>string</Password>
</Credentials>
</AuthenticateUser>
</soap:Body>
</soap:Envelope>
Here is my code calling the service.
private void button2_Click(object sender, EventArgs e)
{
CallStampsService();
}
private void CallStampsService()
{
HttpWebRequest request = CreateHTTPWebRequest();
XmlDocument soapEnvelopeXml = new XmlDocument();
soapEnvelopeXml.LoadXml(#"<?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""
xmlns:tns=""http://stamps.com/xml/namespace/2015/05/swsim/swsimv45"">
<soap:Body>
<AuthenticateUser>
<Credentials>
<IntegrationID>my_integration_id</IntegrationID>
<Username>my_username</Username>
<Password>my_password</Password>
</Credentials>
</AuthenticateUser>
</soap:Body>
</soap:Envelope>");
using (Stream stream = request.GetRequestStream())
{
soapEnvelopeXml.Save(stream);
}
using (WebResponse response = request.GetResponse())
{
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
string soapResult = rd.ReadToEnd();
MessageBox.Show(soapResult);
}
}
}
public static HttpWebRequest CreateHTTPWebRequest()
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(#"https://swsim.testing.stamps.com/swsim/SwsimV45.asmx");
webRequest.Headers.Add(#"SOAPAction: " + #"http://stamps.com/xml/namespace/2015/05/swsim/swsimv45/AuthenticateUser");
webRequest.ContentType = "text/xml;charset=utf-8";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
return webRequest;
}
}
I contacted Stamps.com and their support said they can't offer much assistance regarding the code, but indicated that the following error appears on their end.
<faultstring>Server did not recognize the value of HTTP Header SOAPAction: http://stamps.com/xml/namespace/2015/05/swsim/swsimv45.</faultstring>
So I inspected my Header object and got this.
{SOAPAction: http://stamps.com/xml/namespace/2015/05/swsim/swsimv45/AuthenticateUser
Content-Type: text/xml;charset=utf-8
Accept: text/xml
Host: swsim.testing.stamps.com
Content-Length: 580
Expect: 100-continue
Connection: Keep-Alive
}
The application fails at this line.
WebResponse response = request.GetResponse()
So I inspected the innerXML and got this.
<?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\"
xmlns:tns=\"http://stamps.com/xml/namespace/2015/05/swsim/swsimv45\">
<soap:Body>
<AuthenticateUser>
<Credentials>
<IntegrationID>my_integrationID</IntegrationID>
<Username>my_username</Username>
<Password>my_password</Password>
</Credentials>
</AuthenticateUser>
</soap:Body>
</soap:Envelope>
I do not know where I am going wrong.
I feel your pain. I've used the method below with success:
-- POST
https://swsim.stamps.com/swsim/swsimv42.asmx
-- HEADER
SOAPAction: http://stamps.com/xml/namespace/2015/01/swsim/swsimv42/AuthenticateUser
Content-type: text/xml
-- BODY
<?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>
<AuthenticateUser xmlns="http://stamps.com/xml/namespace/2015/01/swsim/swsimv42">
<Credentials>
<IntegrationID>XXXXXXX</IntegrationID>
<Username>XXXXXXX</Username>
<Password>XXXXXXX</Password>
</Credentials>
</AuthenticateUser>
</soap:Body>
</soap:Envelope>
Please note there are numerous versions of the stamps.com namespaces. Some work great, others are frustrating.
Yes, Stamps docs are VERY confusing. Especially, in their bunch of WSDL versions. But their support's answer was surprisingly informative. The http://stamps.com/xml/namespace/2015/05/swsim/swsimv45 xmls reference is in the wrong place. But they didn't tell you. And why.
xmls references a namespace, class, where stored a definition for the entity that referenced it.
For example,<AuthenticateUser xmlns="http://stamps.com/xml/namespace/2015/01/swsim/swsimv42"> tells that a definition of AuthenticateUser is in http://stamps.com/xml/namespace/2015/01/swsim/swsimv42 namespace. A non-global SOAP element (custom) located in a custom namespace. Everything is OK here.
Or <soap:Envelope ... mlns:tns=""http://stamps.com/xml/namespace/2015/05/swsim/swsimv45""> tells that soap element's description should be used from http://stamps.com/xml/namespace/2015/05/swsim/swsimv45 namespace. But the soap:Envelope element is global for SOAP. And a local namespace doesn't have a definition for it. That's why there was an error.
To fix the issue you need to reference that namespace in a proper place. Move it from <soap:Envelope ...> to <AuthenticateUser ...>. And your SOAP envelope will be OK.
P. S. Know, that the question is very old. But it wasn't answered and could help somebody who googled it.

WebService SOAP Encoding UTF-16 instead of UTF-8

Is it possible to force a WebService in C# .NET to use encoding UTF-16 instead of UTF-8?
I have created a simple WebService which receives a XML Document.
WebService.asmx
public class WebApplication1 : WebService
{
[WebMethod(Description = "Test")]
public string Test(XmlDocument xmlDocument)
{
return "Test";
}
}
Output
POST /WebService.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Test"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Test xmlns="http://tempuri.org/">
<xmlDocument>xml</xmlDocument>
</Test>
</soap:Body>
</soap:Envelope>
If I try an pass an XML Document that is UTF-16 encoded, I get the following error:
XML Content:
<?xml version="1.0" encoding="utf-16"?> <Affiliate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" leadinnumber="ABCDABCD" xmlns:xsd="http://www.w3.org/2001/XMLSchema" mediaid="30000">
<Details>
<Amount>5000</Amount>
<FirstName>Delivery</FirstName>
<Surname>Testing</Surname>
<Tel>02034056978</Tel>
<Email>adfsdfsdfsd#live.co.uk</Email>
</Details>
</Affiliate>
Post Response
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Receiver</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Xml.XmlException: There is no Unicode byte order mark. Cannot switch to Unicode. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) at System.Xml.XmlTextReaderImpl.CheckEncoding(String newEncodingName) at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl) at System.Xml.XmlTextReaderImpl.Read() at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.Read() at System.Xml.XmlReader.MoveToContent() at System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.MoveToContent() at System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement() at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) --- End of inner exception stack trace ---</soap:Text>
</soap:Reason>
<soap:Detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
Any help would be much appreciated :-)
You have to configure your web service. Go to globalization section of Web.config and make UTF-16 instead of UTF-8. The requestEncoding and responseEncoding attributes of the globalization tag should be set to UTF-16.
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
must be converted to
<globalization requestEncoding="utf-16" responseEncoding="utf-16"/>
This change will allow the web service to accept request and send response in UTF-16.
EDIT
For setting the encoding manually through code you can use following code:
// Set the path of the config file.
string configPath = "";
Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath);
GlobalizationSection configSection = (GlobalizationSection)config.GetSection("system.web/globalization");
configSection.RequestEncoding = Encoding.Unicode;
configSection.ResponseEncoding = Encoding.Unicode;

Call WCF service using specific internet connection

I have a Winform Application that I can use TCP client to connect to WCF service, but I don't know how to call its function.
I've been looking at sending SOAP-XML request to WCF service through TCP client, but always get "Bad Request" respond.
Here's my request:
POST /MyService.svc HTTP/1.1
Host: MyHost.com
Content-Type: text/xml; charset=utf-8
Content-Length: 700
SOAPAction: "http://MyHost.com/MyService/MyFunction"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<Action soap:must Understand="1"
xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">
http://MyHost.com/MyService/MyFunction
</Action>
</soap:Header>
<soap:Body>
<MyFunction xmlns="http://MyHost.com/">
</MyFunction>
</soap:Body>
And here's response:
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Tue, 07 Jul 2015 01:32:13 GMT
Connection: close
Content-Length: 339
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Header</h2>
<hr><p>HTTP Error 400. The request has an invalid header name.</p>
</BODY></HTML>

How can a WCF client consume a multipart/related java webservice reponse?

I wrote a WCF C# client that consumes a Java webservice:
var client = new abcClient("abc");
var response = client.AbcTransaction(msg);
The WCF binding info from web.config is:
<customBinding>
<binding name="abcSOAP">
<textMessageEncoding messageVersion="Soap12" />
<httpsTransport requireClientCertificate="true" />
</binding>
</customBinding>
It looks pretty straight-forward, right? ...And indeed, SoapFaults are easy to consume:
HTTP/1.1 500 Internal Server Error
Content-Length: 783
Content-Type: application/soap+xml;charset=UTF-8
Server: Microsoft-IIS/8.0
Date: Mon, 18 Nov 2013 14:06:18 GMT
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body><soap:Fault>...
However, the webservice sends "regular" responses in the multipart/related content-type:
HTTP/1.1 200 OK
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:c79210c3-bbef-4aa3-82ae-6a20c7a96564"; start="<root.message#cxf.apache.org>"; start-info="application/soap+xml"
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0
Date: Mon, 18 Nov 2013 14:11:25 GMT
Content-Length: 658
--uuid:c79210c3-bbef-4aa3-82ae-6a20c7a96564
Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message#cxf.apache.org>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">...
This leads to a ProtocolException in the WCF client because the WCF client does not expect a multipart/related answer. The ProtocolException message is (in German):
Der Inhaltstyp "multipart/related; type="application/xop+xml";
boundary="uuid:ead716a3-4b8b-4207-ad66-b9f18ae368b2";
start="";
start-info="application/soap+xml"" der Antwortnachricht stimmt nicht
mit dem Inhaltstyp der Bindung (application/soap+xml; charset=utf-8)
überein. Wenn Sie einen benutzerdefinierten Encoder verwenden, sollten
Sie sicherstellen, dass die IsContentTypeSupported-Methode korrekt
implementiert ist. Die ersten 1024 Bytes der Antwort waren: ...
In English:
The content type "multipart/related; type="application/xop+xml";
boundary="uuid:ead716a3-4b8b-4207-ad66-b9f18ae368b2";
start="";
start-info="application/soap+xml"" of the response message
does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the
IsContentTypeSupported method is implemented properly. The first 1024
bytes of the response were: ...
Does anyone have an idea how I can consume this multipart/related message with a WCF client (without using the HttpWebRequest class)? Is there any configuration available for this szenario?
Max' and Mehmet's hints showed the right direction but I had to change a bit more.
Since I used the element in , the wcf configuration ignored the messageEncoding="Mtom" attribute.
Instead of using attribute, it seems better to use the element directly:
<binding name="energylinkSOAP">
<mtomMessageEncoding messageVersion="Soap12" />
<httpsTransport requireClientCertificate="true" />
</binding>
By that you also can define more configurations, such as messageVersion.
I think that converting system into to MTOM will work for that.

How to receive a soap message with attachment in WCF

I have a webservice in c# and I'm receiving soap messages with attachments.
This is the wireshark log of one request
POST /scripts/vivo_sdp/ReceiveMmsNotificationService.asmx HTTP/1.1 SOAPAction: ""Content-Type: multipart/related; type="text/xml"; start="<sgp#email.com>"; 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: <sgp#email.com>
<?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.&......#..4.....jzy8........~..._...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\...#.E..............,.....?)........h....:.9>.HA.g..-}....o.|.2.H#L...(...\r"....=..C....Y......J.c...:`..Jf.+[0...H.U..q.
.].l.#X..k0..#.;.sU......1...#d.."m..4\...L.. .....5..=#.....i....)x.....W.yu........V.v....{.S?Fn{.c'..N%.I.v`Cl.......&:j]U...^ ..n*......V..)%w#..n.{4S.Q.8.*R.D.}.b.H#.#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.*..#...C.V2=.]\erW...W...!.
J..cT....#.m.2R......."J.f............}.M.qO,#...n.eFpq~..BA.W:...h.OA......>Ih.?..=.#...%Y.9`>..v.$j...3.......!8=>:>y>..
Z...7.b..#..".V..f\.C..7........D..*`y..vM..7f.......Pn.
..T.u..Cd...3.sp.>.g.=5...:..`b-..!h.....fr......K.....1.Fh+
}eLB(...X(+#N`..P....+P._o,..z4........Y.21+....e.g.{.Y.^l..Z..3,>.G...v...lf2.}....?...!vs..Y#....
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|....9.wNN...._......giE.....#.I. 0j..#v.....*^.&%.%L...+.........e....l...J"y
Q.2..]c.
.&..*$O....L.]A...;....k1..k+...E..._P....fc..R..v).oq.1....#I..i>.......P...Y`^....3....82..R_fY).'j..B.a?......M.......$R`......
.8...bF..*.y..`~..k#....*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--
and this is the answer that my server is giving
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. ---> Data at the root level is invalid. Line 1, position 1.</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
This is the signature of the method
[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;
}
}
How can i change my webservice so i can accept messages with attachments?
these are mime / swa type of attachments. wcf does not support them by default (only mtom is supported) but you can use this extension.

Categories

Resources