Consuming WebService from CompactFramework client
I am trying to call a webservice method like this:
myService.Register("mystring");
The web method definition is correct:
[WebMethod]
public void Register(string s)
{
}
But I am getting the following System.InvalidOperationException:
"The System.String type was not expected. Use the XmlInclude or SoapInclude attribute to indicate types that are not statically known.
at System.Xml.Serialization.AccessorCollection.findAccessor(Type t)
at System.Xml.Serialization.XmlSerializationWriter.EnqueueMember(MemberValueCollection members, LogicalMemberValue member, SerializationQueue attributes, SerializationQueue elements, Object fetcherTarget, String parentElementNamespace)
at System.Xml.Serialization.XmlSerializationWriter.EnqueueMembers(MemberValueCollection members, SerializationQueue attributes, SerializationQueue elements, Object fetcherTarget, String parentElementNamespace)
at System.Xml.Serialization.XmlSerializationWriter.SerializeComplexAsElement(LogicalType serializeAs, Accessor accessor, Object value, SerializationQueue delayedWork, Boolean recursiveCall, Boolean requiresTypeAttr, XmlSerializerNamespaces serializerNs)
at System.Web.Services.Protocols.SoapMessageFormatter.SerializeComplexAsElement(LogicalType serializeAs, Accessor accessor, Object value, SerializationQueue delayedWork, Boolean recursiveCall, Boolean requiresTypeAttr, XmlSerializerNamespaces ns)
at System.Xml.Serialization.XmlSerializationWriter.SerializeAsElement(Accessor accessor, Object value, Object fetcherTarget, SerializationQueue delayedWork, Boolean recursiveCall, Boolean schemaReqTypeAttr, XmlSerializerNamespaces serializerNs)
at System.Xml.Serialization.XmlSerializationWriter.serializeMembers(SerializationQueue queue, SerializationQueue delayedWork, Boolean recursiveCall, Boolean schemaReqTypeAttr, XmlSerializerNamespaces serializeNs)
at System.Web.Services.Protocols.SoapMessageFormatter.execute(String targetNamespace)
at System.Web.Services.Protocols.SoapMessageSerializer.Serialize(XmlWriter writer, SoapHttpClientProtocol client, Object[] parameters, LogicalSoapMethod soapMethod, Boolean soap12)
at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
Google doesn't bring anything useful and I'm stumped so suggestions would be welcome. My only thought so far is that this is some kind of inconsistency because CF is using a different version of System.dll for the webservice project.
This was caused by the fact that I was using a subclass of a web link and also with an interface, that is:
public class MyWebServiceReference : RawWebServiceReference, IService {}
The frontend was in a separate project for RawWebServiceReference and MyWebServiceReference and some aspects of that were causing the error.