I’m trying to call a WCF Service from XCODE that has an Object as parameter instead of string or long. I’m always using a couple of services wish have simple Parameter like string or long and they work perfectly. But when I using the Object as Parameter I can get to the C# Service on my Windows Box but the Parameter is always a new C# object with no values in it.
The Object I’am using looks like this one:
[DataContract]
public class MobileComplaint
{
[DataMember]
public long MobileComplaintID { get; set; }
[DataMember]
public string CaseNo { get; set; }
[DataMember]
public DateTime CreationDate { get; set; }
[DataMember]
public string CreationUser { get; set; }
[DataMember]
public string DaysSinceLastChange { get; set; }
[DataMember]
public string State { get; set; }
}
The Function looks like this one:
[OperationContract]
MobileComplaint Save(long UserID, MobileComplaint mc);
For the normal Functions I use Messages that looks like this one:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<OpenComplaint xmlns="http://tempuri.org/">
<MobileComplaintID>3</MobileComplaintID>
</OpenComplaint>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The Question is now how do I have to write Parameter for this Message!
Second Question is it necessary to add all parameter for the object or is it ok when I just fill those I need.
THX for help
I always tried the following two:
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<Save xmlns="http://tempuri.org/">
<UserID>229001</UserID>
<mc xmlns:a="http://schemas.datacontract.org/2004/07/Ibs.MobileDefectDetection.Vo" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:MobileComplaintID>29292</MobileComplaintID>
</mc>
</Save>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<Save xmlns="http://tempuri.org/">
<UserID>229001</UserID>
<mc>
<MobileComplaintID>29292</MobileComplaintID>
</mc>
</Save>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
OK I had I typo in it:
29292
29292
I missed the “a:”
Now he fills in some of the Properties in the Object but not all!
Does anyone has Idea how this can happen?
I found it out my self! When you are in a pure .NET Environment the order of the Properties is regardless. But when you go from Xcode to C# the order must be correct. I added now the Order Property to all my DataMember Attributes in the DataContract and followed that order in xcode
Michael