Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4026450
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:58:19+00:00 2026-05-20T10:58:19+00:00

I have a WCF service that’s consumed via an iPhone application. All other methods

  • 0

I have a WCF service that’s consumed via an iPhone application. All other methods that accept string parameters or single objects are working fine, however when I invoke a method that takes a “List<CustomObjectClass> ssf“.

I am passing an NSMutableArray of CustomObjectClass‘s to this method and I’m getting the following error:

Any ideas?

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode><faultstring xml:lang="en-AU">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ssf. The InnerException message was 'Error in line 2 position 6. Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. '.  Please see InnerException for more details.</faultstring><detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>Error in line 2 position 6. Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. </Message><StackTrace>   at ReadArrayOfScanShareFriendFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )&#xD;
   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract&amp; dataContract)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)&#xD;
   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)&#xD;
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)&#xD;
   at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)</StackTrace><Type>System.Runtime.Serialization.SerializationException</Type></InnerException><Message>The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ssf. The InnerException message was 'Error in line 2 position 6. Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. '.  Please see InnerException for more details.</Message><StackTrace>   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)&#xD;
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.ServiceModel.Dispatcher.NetDispatcherFaultException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:58:20+00:00Added an answer on May 20, 2026 at 10:58 am

    It looks like the SOAP message that was sent from iPhone application is not in format expected by the WCF service. If that’s the case, you will probably have to take more control over serialization of NSMutableArray of CustomObjectClasses when passing the array to the method.

    In order to check whether that is the issue, you could implement and configure WCF message inspector that would write the SOAP request message into a file and then review the file to check whether it looks like following SOAP message:

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
                xmlns:a="http://www.w3.org/2005/08/addressing">
        <s:Header>
            <a:Action s:mustUnderstand="1">http://tempuri.org/IService/SendData</a:Action>
            <a:MessageID>urn:uuid:8a582916-1b9a-47f8-8fb1-c9ff18420391</a:MessageID>
            <a:ReplyTo>
                <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
            </a:ReplyTo>
            <a:To s:mustUnderstand="1">net.tcp://localhost:13031/Service</a:To>
        </s:Header>
        <s:Body>
            <SendData xmlns="http://tempuri.org/">
                <ssf xmlns:b="http://schemas.datacontract.org/2004/07/Common"
                     xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                    <!-- Zero or more CustomObjectClass elements-->
                    <b:CustomObjectClass>
                        <!-- Zero or more elements for CustomObjectClass properties -->
                    </b:CustomObjectClass>
                </ssf>
            </SendData>
        </s:Body>
    </s:Envelope>
    

    Implement WCF message inspector:

    1. Implement WCF message inspector(IDispatchMessageInspector).
    2. Implement endpoint behavior (IEndpointBehavior).
    3. Implement custom behavior extension element (BehaviorExtensionElement).

    WCF message inspector:

    public class FileOutputMessageInspector : IDispatchMessageInspector
    {
        public object AfterReceiveRequest( ref Message request, IClientChannel channel,
            InstanceContext instanceContext )
        {
            string path = Path.Combine(
                AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                Guid.NewGuid().ToString() + ".xml"
            );
            File.WriteAllText( path, request.ToString() );
            return null;
        }
    
        public void BeforeSendReply( ref Message reply, object correlationState )
        { }
    }
    

    Endpoint behavior:

    public class FileOutputBehavior : IEndpointBehavior
    {
        public void AddBindingParameters( ServiceEndpoint endpoint,
            BindingParameterCollection bindingParameters )
        { }
    
        public void ApplyClientBehavior( ServiceEndpoint endpoint,
            ClientRuntime clientRuntime )
        {
            throw new ApplicationException( "Behavior is not supported on client side." );
        }
    
        public void ApplyDispatchBehavior( ServiceEndpoint endpoint,
            EndpointDispatcher endpointDispatcher )
        {
            FileOutputMessageInspector inspector = new FileOutputMessageInspector();
            endpointDispatcher.DispatchRuntime.MessageInspectors.Add( inspector );
        }
    
        public void Validate( ServiceEndpoint endpoint )
        { }
    }
    

    Behavior extension element:

    public class FileOutputElement : BehaviorExtensionElement
    {
        public override Type BehaviorType
        {
            get { return typeof( FileOutputBehavior ); }
        }
    
        protected override object CreateBehavior()
        {
            return new FileOutputBehavior();
        }
    }
    

    Configure WCF message inspector:

    1. Declare new behavior extension (Make sure that the correct full type name is used in type attribute).
    2. Use the declared behavior extension in an endpoint behavior.
    3. Reference the endpoint behavior.

    Use following configuration as reference:

    <system.serviceModel>
        <services>
            <service name="Server.Service">
                <endpoint address=""
                          binding="netTcpBinding" bindingConfiguration="TCP"
                          contract="Common.IService"
                          behaviorConfiguration="RequestMessageToFile"/>
                <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://localhost:13031/Service"/>
                    </baseAddresses>
                </host>
            </service>
        </services>
        <bindings>
            <netTcpBinding>
                <binding name="TCP">
                    <security mode="None"/>
                </binding>
            </netTcpBinding>
        </bindings>
        <behaviors>
            <endpointBehaviors>
                <behavior name="RequestMessageToFile">
                    <requestFileOutput />
                </behavior>
            </endpointBehaviors>
        </behaviors>
        <extensions>
            <behaviorExtensions>
                <add name="requestFileOutput"
                     type="Common.FileOutputElement, Common"/>
            </behaviorExtensions>
        </extensions>
    </system.serviceModel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service that is hosted in a windows application. The service
I have a WCF service that is called by a Windows Mobile application running
I have a WCF service that requires some DateTime parameters to be passed in.
I have a WCF service that exposes a bunch of methods that return business
I have a WCF service that I have to reference from a .net 2.0
I have a WCF Service that should not enter the faulted state. If there's
I have a WCF Service that exposes a method GetCustomers(). The internals of the
I have a WCF service that I call from a windows service. The WCF
I have a WCF service that uses basicHttpbinding in development. Now in product we
I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.