TReKiE / msnp-sharp

Automatically exported from code.google.com/p/msnp-sharp
0 stars 0 forks source link

error while getting Membership List and Adress Book #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, i receiving another error, when it tried to get the membership list or
the address book, it gets an error and show something like:

An error occured while getting CacheKey and Preferred host:
Service:    MSNPSharp.MSNWS.MSNABSharingService.ABServiceBinding
MethodName: ABFindContactsPaged
Message:    Argument is out of range.
Parameter name: startIndex

The full log is in attachment.

What version of the product are you using? (MSNPSharp, OS, Mono etc.)
Tried with MSNPSharp(3.0 and 3.5), CentOs, Mono 2.4.2.3

Thanks

Original issue reported on code.google.com by bydarkh...@gmail.com on 15 Oct 2009 at 8:44

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

Would you please put a breakpoint in line 587 in MSNService.cs and see what 
cause 
the exception?

Original comment by freezing...@gmail.com on 16 Oct 2009 at 4:30

GoogleCodeExporter commented 9 years ago
I guess the problem is the ws.Url is String.Empty:

string originalUrl = ws.Url;
                string originalHost = ws.Url.Substring(ws.Url.IndexOf(@"://") + 3 /*
@"://".Length */);
                originalHost = originalHost.Substring(0, originalHost.IndexOf(@"/"));

----------

Set webservice.URL when calling CreateService... I think you forgot the settings
resource file...

http://code.google.com/p/msnp-sharp/source/browse/trunk/MSNP-Sharp15/MSNPSharp/P
roperties/Settings.Designer.cs

Original comment by hepha...@gmail.com on 16 Oct 2009 at 10:35

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The error is:
System.Reflection.TargetInvocationException: Exception has been thrown by the 
target
of an invocation. ---> System.Net.WebException: The request failed with HTTP 
status
301: MovedPermanently
  at System.Web.Services.Protocols.SoapHttpClientProtocol.ReceiveResponse
(System.Net.WebResponse response, 
System.Web.Services.Protocols.SoapClientMessage
message, System.Web.Services.Protocols.SoapExtension[] extensions) [0x00233] in
/downloads/mono-2.4.2.3/mcs/class/System.Web.Services/System.Web.Services.Protoc
ols/SoapHttpClientProtocol.cs:352

I think is error in this URL:
https://contacts.msn.com/abservice/SharingService.asmx (or
https://byrdr.omega.contacts.msn.com/abservice/SharingService.asmx); Or I need 
to
configure something else in webservices?

Original comment by bydarkh...@gmail.com on 16 Oct 2009 at 5:27

GoogleCodeExporter commented 9 years ago
Hi,

TargetInvocationException is expected error to get cache key and preferred host.
"301: MovedPermanently" raises this error.

Line 558:
XmlDocument errdoc = new XmlDocument();
string errorMessage = ex.InnerException.Message;

What is the output of  errorMessage? It must me something like:

<?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:Header><ServiceHeader
xmlns="http://www.msn.com/webservices/AddressBook"><Version>14.02.2812.0000</Ver
sion><CacheKey>14r2;jdBBYFvS0BYC8cNuz/......evLg6I=</CacheKey><CacheKeyChanged>t
rue</CacheKeyChanged><PreferredHostName>local-bay.contacts.msn.com</PreferredHos
tName><SessionId>xxxxxxxxxx-c02b-4289-8e4c-0636ddf9a87d</SessionId></ServiceHead
er></soap:Header><soap:Body><FindMembershipResponse
xmlns="http://www.msn.com/webservices/AddressBook" 
/></soap:Body></soap:Envelope>

Original comment by hepha...@gmail.com on 16 Oct 2009 at 5:53

GoogleCodeExporter commented 9 years ago
The errorMessage is only:
"The request failed with HTTP status 301: MovedPermanently"

Original comment by bydarkh...@gmail.com on 16 Oct 2009 at 6:12

GoogleCodeExporter commented 9 years ago
I think this is Centos or mono bug... You should reveal "<?xml ...></xml>" from 
ex.InnerException.
WebException webExc = ex.InnerException as WebException;

Please try all off variables like webExc.StackTrace, webExc.Response etc.

Original comment by hepha...@gmail.com on 16 Oct 2009 at 6:28

GoogleCodeExporter commented 9 years ago
Try this please:

string data = "";
if (webExc.Response != null)
{
  StreamReader r = new StreamReader(webExc.Response.GetResponseStream());
  data = r.ReadToEnd();
  r.Close();
}

What is the output of data?

Original comment by hepha...@gmail.com on 16 Oct 2009 at 6:32

GoogleCodeExporter commented 9 years ago
Hi, it's an bug in mono, i added at line 279 of file
"/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProt
ocol.cs"[1]
this code:
if (code == HttpStatusCode.Moved || code == HttpStatusCode.MovedPermanently)
{
    Stream stream = http_response.GetResponseStream();
    StreamReader readStream = new StreamReader(stream);
    string msg = readStream.ReadToEnd();
    throw new WebException (msg, null, WebExceptionStatus.ProtocolError, http_response);
}

Not tested yet(still compiling Mono), but I think this will work.

Original comment by bydarkh...@gmail.com on 16 Oct 2009 at 7:03

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Also already tried use the webExc.Response, but it's was disposed.

Original comment by bydarkh...@gmail.com on 16 Oct 2009 at 7:06

GoogleCodeExporter commented 9 years ago
[1]http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/System.Web.Services/Sy
stem.Web.Services.Protocols/SoapHttpClientProtocol.cs?view=markup

The missing link from comment #9

Original comment by bydarkh...@gmail.com on 16 Oct 2009 at 7:10

GoogleCodeExporter commented 9 years ago
Hi, is working now(the code that i changed in soapHttpClientProtocol.cs is a 
little
diferente that I posted here(see the patch in attachment)). but now i'm seeing 
this
error:

NSMessageProcessor: Parsing incoming NS command...
NSMessageProcessor: Dispatching incoming NS command: 800 17
A server error occurred
Error Code: 800
Error Description: ChangingTooRapdly

Original comment by bydarkh...@gmail.com on 16 Oct 2009 at 8:22

Attachments:

GoogleCodeExporter commented 9 years ago
Dear bydarkhero,

I am glad to see you've found the solution. However, changing the code of Mono 
framework is not a good idea. Can you find some way only to change our library 
to 
make it work under Mono, or, how can we get the error response XML from the 
exception when the library is running under Mono?

Original comment by freezing...@gmail.com on 17 Oct 2009 at 6:45

GoogleCodeExporter commented 9 years ago
And for the 800 server error, please attach the debug log output by the example 
client.

Original comment by freezing...@gmail.com on 17 Oct 2009 at 12:39

GoogleCodeExporter commented 9 years ago
I agree with you, but I don't see any way to fix this. The exc.Response should 
work,
but it's disposed for some reason. 

The log is in attachment.

Original comment by bydarkh...@gmail.com on 17 Oct 2009 at 2:30

Attachments:

GoogleCodeExporter commented 9 years ago
Just see the following log, FindMembership and ABFindContactsPaged are called 
repeatly. Please go to ContactService.cs and locate to 
SynchronizeContactList(), 
line 360, check what exception was thrown there making SynchronizeContactList() 
was 
called recursively so many times.

ContactService: Getting your membership list for the first time. If you have a 
lot 
of contacts, please be patient!

MSNPSharp.MSNWS.MSNABSharingService.SharingServiceBinding is requesting a 
cachekey 
and preferred host for calling FindMembership

ContactService: Getting your address book for the first time. If you have a lot 
of 
contacts, please be patient!

MSNPSharp.MSNWS.MSNABSharingService.ABServiceBinding is requesting a cachekey 
and 
preferred host for calling ABFindContactsPaged

NSMessageProcessor: Outgoing message:
USR 23 SHA A 
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTE2Ij8+DQo8U2lnbmVkVGlja2V0IHhtbG5z
Onhza
T0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0c
DovL3
d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHZlcj0iMSIga2V5VmVyPSIxIj4NCiAgPERhdGE+UEQ5NG
JXd2d
kbVZ5YzJsdmJqMGlNUzR3SWlCbGJtTnZaR2x1WnowaWRYUm1MVEUySWo4K0RRbzhWR2xqYTJWMElIaHR
iRzV6
T25oemFUMGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TVM5WVRVeFRZMmhsYldFdGFXNXpkR0Z1
WTJVa
UlIaHRiRzV6T25oelpEMGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TVM5WVRVeFRZMmhsYldFa
VBnME
tJQ0E4VkZNK01qQXdPUzB4TUMweE4xUXhORG95TVRvMU5TNHhORFkzTlRKYVBDOVVVejROQ2lBZ1BFTk
pSRDR
0TlRreU9EZzNOekl4T1RVek16ZzNOamt4TlR3dlEwbEVQZzBLUEM5VWFXTnJaWFErPC9EYXRhPg0KICA
8U2ln
PlNUMTNvVUdvQ0tsU0QzNFZ5SFlYdVhadG01UEVtSHdjakhNZlR1VFNzM1dMY1VhMlRkelczMHFQSXRC
VWVUS
lc4eWkyN2t6MkVHNmVnZXAyeGozd0FaZWVrVGZMcyticlhDbStVNENDeDRYU1ZIV3UvR3NVdTRxM2tlO
Ul3YV
FxVExvVFdPYzRSNlBlZWdkRGNQN2JkcE05K29sME9RdTN0N0QzajYzLzdXWT08L1NpZz4NCjwvU2lnbm
VkVGl
ja2V0Pg==

NSMessageProcessor: Parsing incoming NS command...

NSMessageProcessor: Dispatching incoming NS command: 800 23

A server error occurred
Error Code: 800
Error Description: ChangingTooRapdly

Original comment by freezing...@gmail.com on 18 Oct 2009 at 5:19

GoogleCodeExporter commented 9 years ago
Hi, it not receive any exception there.
But i think it's working now,i disable the messenger.Nameserver.AutoSynchronize 
 and
then enable again, and is working now.

Thanks.

Original comment by bydarkh...@gmail.com on 18 Oct 2009 at 6:34

GoogleCodeExporter commented 9 years ago
No man, there must be some problem. Please delete all .mcl files in the 
directory 
and run the program again.

Original comment by freezing...@gmail.com on 18 Oct 2009 at 5:23

GoogleCodeExporter commented 9 years ago
Please try the latest 3.0 stable and post the debug info again. Thanks.

Original comment by freezing...@gmail.com on 18 Oct 2009 at 5:54

GoogleCodeExporter commented 9 years ago
Hi, i found the problem. I see now that on server(where i'll run the app) the
revision is #1229, I had updated to head, and i think that the 1230 have fix it.

It's working eveything now, thanks for all suport.

Original comment by bydarkh...@gmail.com on 18 Oct 2009 at 6:58

GoogleCodeExporter commented 9 years ago
Ok, my pleasure. I hope you can find solution without changing Mono.

Original comment by freezing...@gmail.com on 19 Oct 2009 at 6:03

GoogleCodeExporter commented 9 years ago

Original comment by freezing...@gmail.com on 25 Oct 2009 at 6:23

GoogleCodeExporter commented 9 years ago

Original comment by hepha...@gmail.com on 30 Oct 2009 at 4:56