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

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.

Related

How to send request to a method of Web Service from Postman?

I have an ASMX service, which has the below method. I want to debug this method, so I have put a breakpoint on it. But I am not able to send a request to it successfully, It gives a 404 error.
[WebMethod]
public void RequestNotification()
{
I have tried these options so far.
Page screenshots for reference.
This is how I am calling from the C# code, and this is also not hitting the breakpoint on the method RequestNotification of service. and it's not giving any exceptions also in the C# code.
MyService myService= new MyService ();
myService.RequestNotification();
Update: I have tried as described in the below answer, I am still getting 404.
Please find below the request screenshot.
Using POST call from Postman with XML Body
Demo code.
I will show this Calculator SOAP service for Add operation.
POST URL
http://www.dneonline.com/calculator.asmx
In body with XML ray selection
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Add xmlns="http://tempuri.org/">
<intA>100</intA>
<intB>200</intB>
</Add>
</soap:Body>
</soap:Envelope>
I got response this from service
<?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>
<AddResponse xmlns="http://tempuri.org/">
<AddResult>300</AddResult>
</AddResponse>
</soap:Body>
</soap:Envelope>
If you click code button from Postman, you can get the curl command too.
curl --location --request POST 'http://www.dneonline.com/calculator.asmx' \
--header 'Content-Type: text/xml; charset=utf-8' \
--header 'SOAPAction: http://tempuri.org/Add' \
--data-raw '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Add xmlns="http://tempuri.org/">
<intA>100</intA>
<intB>200</intB>
</Add>
</soap:Body>
</soap:Envelope>
'
#Bench Vue's answer has helped me in solving the issue. I am able to solve the issue with the below request.
Request and Response:

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;

How to convert ASMX Web reference method HttpWebRequest

Recently i started creating a Xamarin-iOS app, which consume ProjectServer PSI WebService. When I add the PSI as WebReference and I try to access the PSI methods I am getting 401 unauthorised error. Interestingly It works fine in local network and but getting error in enterprise network. So I plan to change WebReference to SOAP - HttpwebRequest method.
This is what i Tried
I am trying to get the resource id using this url BaseAddress + pwa/_vti_bin/PSI/Resource.asmx?op=GetCurrentUserUid
<?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>
<GetCurrentUserUid xmlns="http://schemas.microsoft.com/office/project/server/webservices/Resource/" />
</soap:Body>
I am passing the above code as body.
But when i execute this using HttpWebRequest I am getting the error HttpStatusCode InternalServerError System.Net.HttpStatusCode
Also in the response i found the following xml response.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
xmlns:a="http://Microsoft.Office.Project.Server">a:ProjectServerFaultCode
</faultcode>
<faultstring>
Unhandled Communication Fault occurred
</faultstring>
<detail>
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
Object reference not set to an instance of an object.</string></detail>
</s:Fault>
</s:Body>
</s:Envelope>
I don't know what' wrong. So my question are,
Is it possible to call PSI method using HttpWebRequest
If not what is the alternative.
Please help. Thanks in advance.
Here's a few items:
The URL should be: BaseAddress + pwa/_vti_bin/PSI/Resource.asmx
SOAP Action Header: ReadResource
In your example, the soap:body should be...
<SOAP:BODY>
<ReadResource>
<resourceUid>value</resourceUid>
</ReadResource>
</SOAP:BODY>

Request is not created

I have created a wcf client that makes a request to get the data.
When i made a call to service, the request itself not created.
I am sending all the header information to the service and it is not sending a request.
The request is using SOAP,
<?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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext- 1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<VisSvcHeaders xmlns="http://dai.es.VisSvc/2010/svc">
<packNGo>false</packNGo>
</VisSvcHeaders>
<wsa:Action>http://vissvc.esi.daimler.com/2010/svc/getData</wsa:Action>
<wsa:From>
<wsa:Address>Vis</wsa:Address>
</wsa:From>
<wsa:MessageID>urn:uuid:795b9745-4867-4f05-af5a- 87704920a6dd</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To>https://vissvc.e.corpintra.net/VisSvcNative/DAIESIVisService</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-6bf652ad-6f2e-4312-ae4f-5807c5f21e38">
<wsu:Created>2014-02-19T08:41:48Z</wsu:Created>
<wsu:Expires>2014-02-19T08:46:48Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<getData xmlns="http://dai.esi.VisSvc/2010/svc">
<part xmlns="">
<number xmlns="http://dai.es.VisSvc/2010/bo">43</number>
<referenceConfiguration xmlns="http://dai.esi.VisSvc/2010/bo">
<lifecycle xmlns="">Rel</lifecycle>
</referenceConfiguration>
<mode xmlns="http://dai.es.VisSvc/2010/bo">open</mode>
</part>
</getData>
</soap:Body>
How can I send the request as this, and the code I am using is,
ServiceReference2.ServicePortTypeClient svc = new ServiceReference2.ServicePortTypeClient();
WebRequest request = WebRequest.Create("http://vissvc- test.e.intra.net/SvcNative/VisService");
ServiceReference2.PartType part = new ServiceReference2.PartType();
part.number = "43";
ServiceReference2.ResponseType res = svc.getData(part);
Console.WriteLine(res);
This request of getData() is not sending or creating a request of this sort.
I am using .net c# 4.0.

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