Thursday, January 8, 2009

ArgumentException on Synchronize - Walkthrough Creating an Occasionally Connected Smart Device Application

Hi

1. I have resolved my issue I have remove all extra class and enumeration from reference’s file. Also import Microsoft.Synchronization.Data namespace in reference.cs class

2. If you access web service which is on your localhost than replace localhost with your machine ip address because device can not recognized localhost.
http://Machine ip address : port no/SyncServerPvoider/Service.asmx

3. Now connect your device emulator from Device manager and than after cradle that device, to cradle device emulator you want Microsoft Active sync software installed on your machine. For more information how to cradle your device visit http://newdotnetfx.blogspot.com/2009/01/connect-mobile-emulator-with-internet.html

Also I have copy past my web service reference.cs file for more clarification


//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//

//------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.CompactFramework.Design.Data, Version 2.0.50727.3053.
//
namespace xyz.SyncProxy {
using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
using System.Data;
using Microsoft.Synchronization.Data;
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://tempuri.org/")]
public partial class Service : System.Web.Services.Protocols.SoapHttpClientProtocol {
///
public Service() {
this.Url = "http://Machine IP Address: Port no /SyncServerPvoider/Service.asmx";
}
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetServerInfo", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public SyncServerInfo GetServerInfo(SyncSession session) {
object[] results = this.Invoke("GetServerInfo", new object[] {
session});
return ((SyncServerInfo)(results[0]));
}
///
public System.IAsyncResult BeginGetServerInfo(SyncSession session, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetServerInfo", new object[] {
session}, callback, asyncState);
}
///
public SyncServerInfo EndGetServerInfo(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((SyncServerInfo)(results[0]));
}
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetSchema", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public SyncSchema GetSchema(string[] tableNames, SyncSession session) {
object[] results = this.Invoke("GetSchema", new object[] {
tableNames,
session});
return ((SyncSchema)(results[0]));
}
///
public System.IAsyncResult BeginGetSchema(string[] tableNames, SyncSession session, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetSchema", new object[] {
tableNames,
session}, callback, asyncState);
}
///
public SyncSchema EndGetSchema(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((SyncSchema)(results[0]));
}
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetChanges", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public SyncContext GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession) {
object[] results = this.Invoke("GetChanges", new object[] {
groupMetadata,
syncSession});
return ((SyncContext)(results[0]));
}
///
public System.IAsyncResult BeginGetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetChanges", new object[] {
groupMetadata,
syncSession}, callback, asyncState);
}
///
public SyncContext EndGetChanges(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((SyncContext)(results[0]));
}
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ApplyChanges", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public SyncContext ApplyChanges(SyncGroupMetadata groupMetadata, System.Data.DataSet dataSet, SyncSession syncSession) {
object[] results = this.Invoke("ApplyChanges", new object[] {
groupMetadata,
dataSet,
syncSession});
return ((SyncContext)(results[0]));
}
///
public System.IAsyncResult BeginApplyChanges(SyncGroupMetadata groupMetadata, System.Data.DataSet dataSet, SyncSession syncSession, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ApplyChanges", new object[] {
groupMetadata,
dataSet,
syncSession}, callback, asyncState);
}
///
public SyncContext EndApplyChanges(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((SyncContext)(results[0]));
}
///
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string HelloWorld() {
object[] results = this.Invoke("HelloWorld", new object[0]);
return ((string)(results[0]));
}
///
public System.IAsyncResult BeginHelloWorld(System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("HelloWorld", new object[0], callback, asyncState);
}
///
public string EndHelloWorld(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
}
/*///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncSession {
private int originatorIdField;
private System.Guid clientIdField;
private SyncParameter[] customParametersField;
///
public int OriginatorId {
get {
return this.originatorIdField;
}
set {
this.originatorIdField = value;
}
}
///
public System.Guid ClientId {
get {
return this.clientIdField;
}
set {
this.clientIdField = value;
}
}
///
[System.Xml.Serialization.XmlElementAttribute("CustomParameters")]
public SyncParameter[] CustomParameters {
get {
return this.customParametersField;
}
set {
this.customParametersField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncParameter {
private string nameField;
private object valueField;
///
public string Name {
get {
return this.nameField;
}
set {
this.nameField = value;
}
}
///
public object Value {
get {
return this.valueField;
}
set {
this.valueField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncConflict {
private ConflictType conflictTypeField;
private string errorMessageField;
private SyncStage syncStageField;
private System.Data.DataTable serverChangeField;
private System.Data.DataTable clientChangeField;
///
public ConflictType ConflictType {
get {
return this.conflictTypeField;
}
set {
this.conflictTypeField = value;
}
}
///
public string ErrorMessage {
get {
return this.errorMessageField;
}
set {
this.errorMessageField = value;
}
}
///
public SyncStage SyncStage {
get {
return this.syncStageField;
}
set {
this.syncStageField = value;
}
}
///
public System.Data.DataTable ServerChange {
get {
return this.serverChangeField;
}
set {
this.serverChangeField = value;
}
}
///
public System.Data.DataTable ClientChange {
get {
return this.clientChangeField;
}
set {
this.clientChangeField = value;
}
}
}
///
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public enum ConflictType {
///
Unknown,
///
ErrorsOccurred,
///
ClientUpdateServerUpdate,
///
ClientUpdateServerDelete,
///
ClientDeleteServerUpdate,
///
ClientInsertServerInsert,
}
///
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public enum SyncStage {
///
ReadingSchema,
///
CreatingSchema,
///
ReadingMetadata,
///
CreatingMetadata,
///
DeletingMetadata,
///
WritingMetadata,
///
UploadingChanges,
///
DownloadingChanges,
///
ApplyingInserts,
///
ApplyingUpdates,
///
ApplyingDeletes,
///
GettingInserts,
///
GettingUpdates,
///
GettingDeletes,
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncTableProgress {
private string tableNameField;
private int insertsField;
private int updatesField;
private int deletesField;
private int changesAppliedField;
private int changesFailedField;
private SyncConflict[] conflictsField;
///
public string TableName {
get {
return this.tableNameField;
}
set {
this.tableNameField = value;
}
}
///
public int Inserts {
get {
return this.insertsField;
}
set {
this.insertsField = value;
}
}
///
public int Updates {
get {
return this.updatesField;
}
set {
this.updatesField = value;
}
}
///
public int Deletes {
get {
return this.deletesField;
}
set {
this.deletesField = value;
}
}
///
public int ChangesApplied {
get {
return this.changesAppliedField;
}
set {
this.changesAppliedField = value;
}
}
///
public int ChangesFailed {
get {
return this.changesFailedField;
}
set {
this.changesFailedField = value;
}
}
///
public SyncConflict[] Conflicts {
get {
return this.conflictsField;
}
set {
this.conflictsField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncGroupProgress {
private string groupNameField;
private SyncTableProgress[] tablesProgressField;
///
public string GroupName {
get {
return this.groupNameField;
}
set {
this.groupNameField = value;
}
}
///
public SyncTableProgress[] TablesProgress {
get {
return this.tablesProgressField;
}
set {
this.tablesProgressField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncContext {
private SyncGroupProgress groupProgressField;
private int originatorIdField;
private SyncAnchor newAnchorField;
private SyncAnchor maxAnchorField;
private int batchCountField;
private System.Data.DataSet dataSetField;
///
public SyncGroupProgress GroupProgress {
get {
return this.groupProgressField;
}
set {
this.groupProgressField = value;
}
}
///
public int OriginatorId {
get {
return this.originatorIdField;
}
set {
this.originatorIdField = value;
}
}
///
public SyncAnchor NewAnchor {
get {
return this.newAnchorField;
}
set {
this.newAnchorField = value;
}
}
///
public SyncAnchor MaxAnchor {
get {
return this.maxAnchorField;
}
set {
this.maxAnchorField = value;
}
}
///
public int BatchCount {
get {
return this.batchCountField;
}
set {
this.batchCountField = value;
}
}
///
public System.Data.DataSet DataSet {
get {
return this.dataSetField;
}
set {
this.dataSetField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncAnchor {
private byte[] anchorField;
///
[System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
public byte[] Anchor {
get {
return this.anchorField;
}
set {
this.anchorField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncTableMetadata {
private string tableNameField;
private SyncDirection syncDirectionField;
private SyncAnchor lastSentAnchorField;
private SyncAnchor lastReceivedAnchorField;
///
public string TableName {
get {
return this.tableNameField;
}
set {
this.tableNameField = value;
}
}
///
public SyncDirection SyncDirection {
get {
return this.syncDirectionField;
}
set {
this.syncDirectionField = value;
}
}
///
public SyncAnchor LastSentAnchor {
get {
return this.lastSentAnchorField;
}
set {
this.lastSentAnchorField = value;
}
}
///
public SyncAnchor LastReceivedAnchor {
get {
return this.lastReceivedAnchorField;
}
set {
this.lastReceivedAnchorField = value;
}
}
}
///
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public enum SyncDirection {
///
DownloadOnly,
///
UploadOnly,
///
Bidirectional,
///
Snapshot,
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncGroupMetadata {
private string groupNameField;
private SyncAnchor newAnchorField;
private SyncAnchor maxAnchorField;
private int batchCountField;
private SyncTableMetadata[] tablesMetadataField;
///
public string GroupName {
get {
return this.groupNameField;
}
set {
this.groupNameField = value;
}
}
///
public SyncAnchor NewAnchor {
get {
return this.newAnchorField;
}
set {
this.newAnchorField = value;
}
}
///
public SyncAnchor MaxAnchor {
get {
return this.maxAnchorField;
}
set {
this.maxAnchorField = value;
}
}
///
public int BatchCount {
get {
return this.batchCountField;
}
set {
this.batchCountField = value;
}
}
///
public SyncTableMetadata[] TablesMetadata {
get {
return this.tablesMetadataField;
}
set {
this.tablesMetadataField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncSchema {
private System.Data.DataSet schemaDataSetField;
///
public System.Data.DataSet SchemaDataSet {
get {
return this.schemaDataSetField;
}
set {
this.schemaDataSetField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncTableInfo {
private string tableNameField;
private string descriptionField;
///
public string TableName {
get {
return this.tableNameField;
}
set {
this.tableNameField = value;
}
}
///
public string Description {
get {
return this.descriptionField;
}
set {
this.descriptionField = value;
}
}
}
///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class SyncServerInfo {
private SyncTableInfo[] tablesInfoField;
///
public SyncTableInfo[] TablesInfo {
get {
return this.tablesInfoField;
}
set {
this.tablesInfoField = value;
}
}
}*/
}
Thanks
Abhishek Hingu
http://www.indianic.com/

2 comments:

  1. I have problems with this sync and no one has responded, you think you can help, please add me to your email and answer me please.

    ReplyDelete
  2. OneClick is the best custom software development company based in India & USA with expertise in BLE, Travel etc. Our software developer provides offshore services. We are a Tech savvy company with 55+ developers who have successfully delivered 525+ Mobile Apps and Enterprise apps and 370+ websites for our clients and partners with different business verticals and domains across the world.

    ReplyDelete