TReKiE / msnp-sharp

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

Reflection error in Mono #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download Mono
2. Run the MSNPSharp sample on Mono
3. Attempt log in

What is the expected output? What do you see instead?

I would expect to log in, but I receive an exception intead. It 
says "InvalidOperationException: There was an error reflecting 
field 'RequestSecurityToken'.".

Full progran log (with stack trace) attached

Original issue reported on code.google.com by goo...@alishomepage.com on 17 Nov 2008 at 7:06

Attachments:

GoogleCodeExporter commented 9 years ago
Will this problem raises in .NET Framework under Windows?

Original comment by freezing...@gmail.com on 18 Nov 2008 at 5:09

GoogleCodeExporter commented 9 years ago
No, it is specific to Mono.

I've tried out with MS 2.0, 3.0 and 3.5; none of them has thrown that exception.

Original comment by goo...@alishomepage.com on 18 Nov 2008 at 7:46

GoogleCodeExporter commented 9 years ago
try to check out 
http://msnp-sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE
and see if the problem still exists

Original comment by freezing...@gmail.com on 18 Nov 2008 at 11:53

GoogleCodeExporter commented 9 years ago

Original comment by hepha...@gmail.com on 18 Nov 2008 at 9:09

GoogleCodeExporter commented 9 years ago
I've tried out http://msnp-
sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE/MSNPSharp revision 527

That version changes the exception. It is now:

WebServiceBindingAttribute is required on proxy 
class 'MSNPSharp.SOAP.MSNSecurityServiceSoapClient'.

It still only happens on Mono

Full log attached again

Original comment by goo...@alishomepage.com on 19 Nov 2008 at 5:55

Attachments:

GoogleCodeExporter commented 9 years ago
And what about now?

Original comment by freezing...@gmail.com on 19 Nov 2008 at 8:03

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hello

The exception changed again. It is now: There was an error reflecting 
field 'RequestSecurityToken'.

Tested with http://msnp-
sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE/MSNPSharp revision 529

Log attached again

Original comment by goo...@alishomepage.com on 19 Nov 2008 at 9:06

Attachments:

GoogleCodeExporter commented 9 years ago
What about svn checkout http://msnp-sharp.googlecode.com/svn/trunk/

Original comment by hepha...@gmail.com on 20 Nov 2008 at 9:46

GoogleCodeExporter commented 9 years ago
Just tried http://msnp-sharp.googlecode.com/svn/trunk/MSNP-Sharp15/MSNPSharp 
revision 536.

It now says: There was an error reflecting field 'RequestSecurityToken'.

Log attached

Original comment by goo...@alishomepage.com on 20 Nov 2008 at 10:14

Attachments:

GoogleCodeExporter commented 9 years ago
OK.

1) Copy WebServiceDefAndSchemas to your http://localhost/msnws/
2) Run this command on mono:
wsdl -protocol:SOAP12 -out:Reference.cs
http://localhost/msnws/WebServiceDefAndSchemas/MSNSecurityTokenService/ps.wsdl
3) Copy Reference.cs to MSNPSharp\Web References\MSNWS.MSNSecurityTokenService\
4) Recompile MSNPSharp with your editor again.
5) If everything works fine, attach Reference.cs here.
6) If it doesn't work, your mono is outdated. Because all wsdl & xsd files are 
W3C
compitable.

Original comment by hepha...@gmail.com on 21 Nov 2008 at 8:21

GoogleCodeExporter commented 9 years ago
Hello

That command unfortunately throws an exception: XmlSchema error: Ambiguous 
element 
label which is contained by -any- particle with ##other value was detected: 
XPath 
Related schema item SourceUri: 
http://192.168.59.1/msnws/WebServiceDefAndSchemas/MSNSecurityTokenService/xmldsi
g-
core-schema.xsd, Line 69, Position 8.

Full log attached.

Any help is welcome.

Original comment by goo...@alishomepage.com on 22 Nov 2008 at 12:29

Attachments:

GoogleCodeExporter commented 9 years ago
Hi again,

I have generated a Reference.cs with mono.

1. svn checkout 
http://msnp-sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE/
2. copy attached Reference.cs to MSNPSharp\Web 
References\MSNWS.MSNSecurityTokenService\
3. Find MSNPSharp\MSNSecurityServiceSoapClient.cs and paste these attributes on 
class
MSNSecurityServiceSoapClient.
4. And recompile.

--------------------
[System.Web.Services.WebServiceBinding(Name="LiveSecurityTokenServicePort",
Namespace="http://schemas.microsoft.com/Passport/SoapServices/PPCRL")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SignaturePropertiesType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(Fault))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(BinarySecurityTokenType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AttributedString))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(EncryptedType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AgreementMethodType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(Envelope))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SecurityTokenReferenceType)
)]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(credPropertyType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(browserCookieType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(extPropertyType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SignatureType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(EncodedString))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ManifestType))]

public class MSNSecurityServiceSoapClient : SecurityTokenService

----------------

Original comment by hepha...@gmail.com on 22 Nov 2008 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
Hello

I've checked out 
http://msnp-sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE 
revision 540 and done the modifications you've listed.

It unfortunately doesn't compile. I have two errors:

    The type or namespace name 'MSNSecurityTokenService' does not exist in the 
namespace 'MSNPSharp.MSNWS' (are you missing an assembly reference?) in 
MSNPSharp\MSNSecurityServiceSoapClient.cs
    The type or namespace name 'MSNSecurityTokenService' does not exist in the 
namespace 'MSNPSharp.MSNWS' (are you missing an assembly reference?) in 
MSNPSharp\SingleSignOn.cs

Is this expected?

Original comment by goo...@alishomepage.com on 22 Nov 2008 at 11:01

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hello

Having had issues with the http://msnp-
sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE branch in Mono (exception 
"Not 
supported Content-Type in the 
response: 'text/html; charset=iso-8859-1'"), I've switched to http://msnp-
sharp.googlecode.com/svn/trunk/MSNP-Sharp15/MSNPSharp revision 543.

I've modified MSNWS.MSNSecurityTokenService\Reference.cs file and removed the:

    [System.Xml.Serialization.XmlAnyElementAttribute()]

for all "object[]" data types.

I've then had an issue with date parsing in the SingleSignOn class. Once that 
has 
been fixed as well (I've replaced XML date parsing with DateTime.Parse), it 
started 
working perfectly in MS .net 2.0, 3.0 and 3.5 as well as Mono 2.

Modified files attached.

Please commit that onto the SVN.

Thanks

Original comment by goo...@alishomepage.com on 22 Nov 2008 at 1:35

Attachments:

GoogleCodeExporter commented 9 years ago
You're right man, the issue "Not supported Content-Type in the response: 
'text/html; 
charset=iso-8859-1'" is because the SOAP response from M$ is not a standard 
response 
(That's why I write a MSNSecurityServiceSoapClient.cs to correct this, that 
class 
works well in windows, but it seems that it has problem with Mono.). If you 
have 
time and patient, please tell us how to fix this, or just be a member of us.

Original comment by wuhong...@gmail.com on 23 Nov 2008 at 5:52

GoogleCodeExporter commented 9 years ago
And by the way, this issue should not be close yet. I generate the Reference.cs 
in 
vs2005 by right clicking the web service then select "Update webservice" in the 
popup menu, then [System.Xml.Serialization.XmlAnyElementAttribute()] for 
object[] 
types comes out again. Any one know how to avoid this?

Original comment by freezing...@gmail.com on 23 Nov 2008 at 6:52

GoogleCodeExporter commented 9 years ago
@wuhongsui:

I guess that's why MS did https://login.live.com/RST2.srf with the good content 
type :) The wrong content type probably leaked into the spec and they didn't 
bother 
changing it afterwards.

The only fix I know for that is to use https://login.live.com/RST2.srf (that's 
what 
the trunk does).

I would be glad to be a member of MSNPSharp. My e-mail address is google at 
alishomepage dot com.

@freezingsoft:

I'll try to find an option that does what you need. At least we know what the 
problem is :)

Original comment by goo...@alishomepage.com on 23 Nov 2008 at 8:00

GoogleCodeExporter commented 9 years ago
OK alishomepage, both of comments were post by me, I post the first with a 
different 
account because someone use my computer before and he foregot to logout.

There're many XmlConvert.ToDateTime calling in this project, are you sure only 
the 
two calling in SSO have problem?

Original comment by freezing...@gmail.com on 23 Nov 2008 at 9:01

GoogleCodeExporter commented 9 years ago
Please try the version in http://msnp-
sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE/

Original comment by freezing...@gmail.com on 23 Nov 2008 at 1:43

GoogleCodeExporter commented 9 years ago
Hello

I have changed the only calls to XmlConvert.ToDateTime that made Mono throw 
exceptions during my tests. When I analysed the code, I've seen a few calls:

  * Most of them are calls with stat,ic arguments, such as XmlConvert.ToDateTime
("0001-01-01T00:00:00.0000000-08:00", 
XmlDateTimeSerializationMode.RoundtripKind). 
Do you think they can converted to DateTime constants?
  * There's one in OIMService that does parse incoming data. Do you think replacing 
that one with DateTime.Parse is a bad idea?

I've tried branch MSNPSHARP_25_STABLE revision 549. I've had the "invalid date 
format" exception again, after fixing the same file (SingleSignOn) at the same 
place 
logging in works correctly.

Original comment by goo...@alishomepage.com on 23 Nov 2008 at 2:44

GoogleCodeExporter commented 9 years ago
Yes I haven't fix the DateTime issue, but the webservice can wok now :), I will 
look 
into the XmlConvert. What I most afraid is DateTime.Parse will also throw 
exceptions, or, just can't generate the correct time. I need more time to test 
with 
it. Thanks for your reporting.

Original comment by freezing...@gmail.com on 23 Nov 2008 at 4:48

GoogleCodeExporter commented 9 years ago
Interesting DateTime.Parse parses wrong dates without throwing exceptions... I 
had 
the impression DateTime can parse everything XmlConvert parses.

Good luck.

Original comment by goo...@alishomepage.com on 23 Nov 2008 at 5:06

GoogleCodeExporter commented 9 years ago
Closing this report now, I hope all major problems were solved.
(and also I am getting a bit lost in such a long report ;-)).

Original comment by hepha...@gmail.com on 23 Nov 2008 at 5:49

GoogleCodeExporter commented 9 years ago
You could even mark it as "verified" if you think my word can be taken as QA.

It's been a pleasure working with you guys, what a pity we're too far away from 
each 
other for having a pint :)

Take care

Original comment by goo...@alishomepage.com on 23 Nov 2008 at 5:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
:) Haha
We haven't a QA team :) We are only 2 person, Pang and Me (Ethem)
Ali, you can be our QA person. That is a good news to see a new Turkish guy from
France :))
OK, marked as Verified.
(Edited, Sorry for incorrect spelling)

Original comment by hepha...@gmail.com on 23 Nov 2008 at 6:27

GoogleCodeExporter commented 9 years ago
:) I use XmlConvert.ToDateTime(token.LifeTime.Created.Value, 
"yyyy-MM-ddTHH:mm:ssZ") 
instead, tried it again please. In fact, thowing exceptions is not a bad thing, 
at 
least we know what's happening.

Original comment by freezing...@gmail.com on 24 Nov 2008 at 3:31

GoogleCodeExporter commented 9 years ago
Just updated to branch MSNPSHARP_25_STABLE revision 554.

I confirm that it's working perfectly in Mono 2.0.1 now :)

Great work

Original comment by goo...@alishomepage.com on 24 Nov 2008 at 7:28

GoogleCodeExporter commented 9 years ago
I'd actually like to join on the project as well as a Mono tester (I'm on 
OpenSuSE 11
and 10.3).   I originally filed #16 but I've been under pressure to get a 
release
done in my day job (SAP) I think I forgot about MSNP for a while after I got my 
test
working.  

I'd like to go back and try the latest branch again and stopped using this old 
-15
version that I hacked to work.

Original comment by christoofar@gmail.com on 24 Nov 2008 at 9:52

GoogleCodeExporter commented 9 years ago
Hi Chris,

Could you update your branch to http://msnp-
sharp.googlecode.com/svn/branches/MSNPSHARP_25_STABLE/

And, please, can you confirm to work this version on OpenSUSE with mono?

Thanks.

Original comment by hepha...@gmail.com on 25 Nov 2008 at 11:05