title: Consuming WebService From CompactFramework Client
body: <p>I'm trying to call a webservice method like this:</p>
  
  <pre><code>myService.Register("mystring");
  </code></pre>
  
  <p>The webmethod definition is just:</p>
  
  <pre><code>[WebMethod]
  public void Register(string s)
  {
  }
  </code></pre>
  
  <p>But I receive the following System.InvalidOperationException:</p>
  
  <p>"The type System.String was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically."</p>
  
  <hr>
  
  <pre><code>   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)
  </code></pre>
  
  <hr>
  
  <p>Google isn't turning up anything useful and I'm at a dead-end so suggestions would be welcome. My only thought so far is that it's some kind of mismatch because CF uses a different version of the System.dll to the webservice project.</p>