Exception occured while trying to use MsmqSubscription storage - msmq

I am newbie in NService bus and I am trying to create a bus using MSMQSubscribtion storage , but I am getting following error.
Exception when starting endpoint,
error has been logged. Reason: Error
creating object with name
'NServiceBus.Unicast.Subscriptions.Msmq.MsmqSubscriptionStorage'
: Error setting property values:
PropertyAccessExceptionsException (1
errors); nested
PropertyAccessExceptions are:
[Spring.Core.TypeMismatchException:
Cannot convert property value of type
[System.String] to required type
[System.String] for property 'Queue'.,
Inner Exception:
System.ArgumentException: There is a
problem with the subscription storage
queue . See enclosed exception for
details. --->
System.Messaging.MessageQueueException:
Format name is invalid.
at System.Messaging.MessageQueue.MQCacheableInfo.get_Transactional()
at System.Messaging.MessageQueue.get_Transactional()
at NServiceBus.Unicast.Subscriptions.Msmq.MsmqSubscriptionStorage.set_Queue(String
value) in
d:\BuildAgent-02\work\672d81652eaca4e1\src\impl\unicast\NServiceBus.Unicast.Subscriptions.Msmq\MsmqSubscriptionStorage.cs:line
184
--- End of inner exception stack trace ---
at NServiceBus.Unicast.Subscriptions.Msmq.MsmqSubscriptionStorage.set_Queue(String
value) in
d:\BuildAgent-02\work\672d81652eaca4e1\src\impl\unicast\NServiceBus.Unicast.Subscriptions.Msmq\MsmqSubscriptionStorage.cs:line
188
at (Object , Object , Object[] )
at Spring.Reflection.Dynamic.SafeProperty.SetValue(Object
target, Object value) in
l:\projects\spring-net\trunk\src\Spring\Spring.Core\Reflection\Dynamic\DynamicProperty.cs:line
204
at Spring.Expressions.PropertyOrFieldNode.PropertyValueAccessor.Set(Object
context, Object value) in
l:\projects\spring-net\trunk\src\Spring\Spring.Core\Expressions\PropertyOrFieldNode.cs:line
585
at Spring.Expressions.PropertyOrFieldNode.SetPropertyOrFieldValueInternal(Object
context, Object newValue) in
l:\projects\spring-net\trunk\src\Spring\Spring.Core\Expressions\PropertyOrFieldNode.cs:line
406
at Spring.Expressions.PropertyOrFieldNode.SetPropertyOrFieldValue(Object
context, EvaluationContext
evalContext, Object newValue) in
l:\projects\spring-net\trunk\src\Spring\Spring.Core\Expressions\PropertyOrFieldNode.cs:line
348]
This is my Config section .
<configuration>
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig,NServiceBus.Core"/>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig,NServiceBus.Core"/>
<section name="MsmqSubscriptionStorageConfig"
type="NServiceBus.Config.MsmqSubscriptionStorageConfig,NServiceBus.Core" />
</configSections>
<MsmqTransportConfig InputQueue="MyResponseQueue" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5"/>
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="MyMessages.Message1" Endpoint="PubQueue"/>
</MessageEndpointMappings>
</UnicastBusConfig>
</configuration>
This is how I tried to create the bus
NServiceBus.Configure.With()
.DefaultBuilder()
.Log4Net()
.MsmqSubscriptionStorage()
.XmlSerializer()
.MsmqTransport()
.IsTransactional(true)
.UnicastBus()
.CreateBus();
Can any one explain what went wrong for me?
Any help would be much appreciated.
Thanks
Alex.

Looks like you are missing the actual MsmqSubscriptionStorageConfig section. This is required and will point to your subscription queue.
<MsmqSubscriptionStorageConfig Queue="queueName" />

NServiceBus will automatically use a queue called "NServiceBus_Subscriptions", if not defined in configuration file. Be sure to have installed MSMQ.

Related

Npgsql nhibernate 57014 canceling statement due to statement timeout

I'm getting random errors in some queries using Npgsql.
Here is the stack trace:
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 1597
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 1497
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 1487
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 1955
at NHibernate.Impl.CriteriaImpl.List(IList results) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\CriteriaImpl.cs:line 265
at NHibernate.Impl.CriteriaImpl.List[T]() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl\CriteriaImpl.cs:line 276
at LAVASPORT.DAO.MigrarCadeteDAO.findByCompania(Compania compania, String conexion, DateTime fechainicial, DateTime fechafinal) in D:\Aplicaciones\LavaSport\LAVASPORT\DAO\MigrarCadeteDAO.cs:line 125
And here is the message
InnerException = {"57014: canceling statement due to statement timeout"}
I'm not getting this exceptions all the time, just 1 or 2 times at day. The query in special that most send the exception is a high volume query.
Here is the query:
public IList<Cadete> findByCompania(Compania compania, String conexion,DateTime fechainicial,DateTime fechafinal)
{
try
{
DateTime fechaini = new DateTime(fechainicial.Year, fechainicial.Month, fechainicial.Day);
DateTime fechafin = new DateTime(fechafinal.Year, fechafinal.Month, fechafinal.Day);
var nhConfig = new Configuration().Configure(conexion);
var sessionFactory = nhConfig.BuildSessionFactory();
var session = sessionFactory.OpenSession();
session.BeginTransaction();
var query = session.CreateCriteria<Cadete>();
query.CreateAlias("compania", "compania");
query.Add(Restrictions.Eq("compania.id", compania.id))
.Add(Restrictions.Lt("fechaIngreso", fechafin))
.Add(Restrictions.Ge("fechaIngreso",fechaini));
IList<Cadete> cadetes = query.List<Cadete>();
return cadetes;
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message);
}
return null;
}
This are my NHibernate configuration and my web config file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="LAVASPORT">
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
<property name="connection.connection_string">
Server=localhost;database=LAVASPORT;user id=postgres;password=admin;MaxPoolSize=500;TimeOut=1000;
</property>
<property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
<property name="show_sql">true</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<mapping assembly="LAVASPORT"/>
</session-factory>
</hibernate-configuration>
If I increase the timeout to more than 1000, I get errors on connections every time.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"></section>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<system.transactions>
<defaultSettings timeout="10:00:00" />
</system.transactions>
</configuration>
I would really appreciate any help.
First, note that the Timeout connection string parameter manages connection timeouts (i.e. NpgsqlConnection.Open()) rather than command execution timeout. Defaul command execution timeout is managed via the Command Timeout connection string parameter.
Beyond that, it seems like your commands are simply timing out. Since the default command timeout is 30 seconds, it would seem you have some serious performance issue with your queries, your database index, or something else. You need to carefully analyze the SQL being created by NHibernate and how it's executed by PostgreSQL.

Query Xml data in Sql Server holding serialized objects

We are storing some serialized objects in an Xml-column in Sql Server.
I would like to create a query that gives me the list of serialized objects (rows) where a specific field has a specific value.
My Xml looks like this:
<MessageContainer xmlns="http://schemas.datacontract.org/2004/07/D3A.Messages" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="1" z:Type="D3A.Messages.MessageContainer" z:Assembly="D3A.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<Messages xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" z:Id="2" z:Type="System.Collections.Generic.List`1[[D3A.Messages.IMessage, D3A.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]" z:Assembly="0">
<a:_items z:Id="3" z:Size="512">
<a:anyType z:Id="4" z:Type="D3A.Messages.MessageAlarmLog" z:Assembly="D3A.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<_x003C_Id_x003E_k__BackingField>00000000-0000-0000-0000-000000000000</_x003C_Id_x003E_k__BackingField>
<_x003C_StorageOperation_x003E_k__BackingField>Create</_x003C_StorageOperation_x003E_k__BackingField>
<_x003C_Comment_x003E_k__BackingField z:Id="5" />
<_x003C_ErrorCodeTranslation_x003E_k__BackingField>Ok</_x003C_ErrorCodeTranslation_x003E_k__BackingField>
<_x003C_ErrorCode_x003E_k__BackingField>0</_x003C_ErrorCode_x003E_k__BackingField>
<_x003C_GroupType_x003E_k__BackingField>System</_x003C_GroupType_x003E_k__BackingField>
<_x003C_LogType_x003E_k__BackingField z:Id="6">1</_x003C_LogType_x003E_k__BackingField>
<_x003C_Parameter_x003E_k__BackingField z:Id="7">Timed out.</_x003C_Parameter_x003E_k__BackingField>
<_x003C_TimeStampOff_x003E_k__BackingField i:nil="true" />
<_x003C_TimeStamp_x003E_k__BackingField>2014-05-10T03:10:04Z</_x003C_TimeStamp_x003E_k__BackingField>
<_x003C_Unit_x003E_k__BackingField z:Id="8">100001</_x003C_Unit_x003E_k__BackingField>
<_x003C_UserName_x003E_k__BackingField z:Id="9">e2_fælles</_x003C_UserName_x003E_k__BackingField>
<_x003C_Value_x003E_k__BackingField z:Id="10">50101</_x003C_Value_x003E_k__BackingField>
<_x003C_WindFarm_x003E_k__BackingField z:Id="11">HR2</_x003C_WindFarm_x003E_k__BackingField>
</a:anyType>
<a:anyType z:Id="12" z:Type="D3A.Messages.MessageAlarmLog" z:Assembly="D3A.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<_x003C_Id_x003E_k__BackingField>00000000-0000-0000-0000-000000000000</_x003C_Id_x003E_k__BackingField>
<_x003C_StorageOperation_x003E_k__BackingField>Create</_x003C_StorageOperation_x003E_k__BackingField>
<_x003C_Comment_x003E_k__BackingField z:Ref="5" i:nil="true" />
<_x003C_ErrorCodeTranslation_x003E_k__BackingField>Ok</_x003C_ErrorCodeTranslation_x003E_k__BackingField>
<_x003C_ErrorCode_x003E_k__BackingField>0</_x003C_ErrorCode_x003E_k__BackingField>
<_x003C_GroupType_x003E_k__BackingField>System</_x003C_GroupType_x003E_k__BackingField>
<_x003C_LogType_x003E_k__BackingField z:Id="13">1</_x003C_LogType_x003E_k__BackingField>
<_x003C_Parameter_x003E_k__BackingField z:Ref="5" i:nil="true" />
<_x003C_TimeStampOff_x003E_k__BackingField i:nil="true" />
<_x003C_TimeStamp_x003E_k__BackingField>2014-05-10T03:10:09Z</_x003C_TimeStamp_x003E_k__BackingField>
<_x003C_Unit_x003E_k__BackingField z:Id="14">100001</_x003C_Unit_x003E_k__BackingField>
<_x003C_UserName_x003E_k__BackingField z:Id="15">e2_fælles</_x003C_UserName_x003E_k__BackingField>
<_x003C_Value_x003E_k__BackingField z:Id="16">50100</_x003C_Value_x003E_k__BackingField>
<_x003C_WindFarm_x003E_k__BackingField z:Ref="11" i:nil="true" />
</a:anyType>
</a:_items>
</Messages>
</MessageContainer>
I am particularly interested in those Xml-chunks that have a specific value in the Xml-field called _x003C_Unit_x003E_k__BackingField. There may be many <a:anytype>-fragments, and I am interested in a result with the complete <MessagesContainer>-fragments with at least one <a:anyType> matching my criteria.
Can you help here? I cannot seem to get the namespace declarations in place in the query.
Thank you :-)
In the query below, replace "100001" with the required value. You can use sql:variable() to make this value dynamic if required.
select #x.query('
declare namespace d3a="http://schemas.datacontract.org/2004/07/D3A.Messages";
declare namespace a="http://schemas.microsoft.com/2003/10/Serialization/Arrays";
/d3a:MessageContainer[
d3a:Messages[
a:_items[
a:anyType[d3a:_x003C_Unit_x003E_k__BackingField/text() = "100001"]
]
]
]'
);
See this article for more details on how to handle namespaces in XQuery.

Skippable Exception

I am trying to skip all the exceptions during the batch run using the following config:
<chunk reader="aaaFileReader" writer="aaaDBWriter"
commit-interval="100" skip-limit="100000">
<skippable-exception-classes>
<include class="java.lang.Exception" />
<exclude
class="org.springframework.jdbc.CannotGetJdbcConnectionException" />
</skippable-exception-classes>
</chunk>
<listeners>
<listener ref="aaabatchFailureListener" />
</listeners>
And I handle the exception in my listener. But when Spring Batch actually encounters an exception its not being skipped and the batch run ends with a failed state. The actual exception is a FlatFileParse Exception. How do I skip the FlatFileParseException?
Here is the log :
:18:21.257 [main] DEBUG o.s.b.repeat.support.RepeatTemplate - Handling fatal exception explicitly (rethrowing first of 1): org.springframework.batch.core.step.skip.NonSkippableReadException: Non-skippable exception during read
15:18:21.257 [main] ERROR o.s.batch.core.step.AbstractStep - Encountered an error executing the step
org.springframework.batch.core.step.skip.NonSkippableReadException: Non-skippable exception during read
at org.springframework.batch.core.step.item.FaultTolerantChunkProvider.read(FaultTolerantChunkProvider.java:81) ~[spring-batch-core.jar:na]
at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:106) ~[spring-batch-core.jar:na]
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367) ~[spring-batch-infrastructure.jar:na]
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) ~[spring-batch-infr
Caused by: org.springframework.batch.item.file.FlatFileParseException: Parsing error at line: 5, input=[0254285458908060150983101150983 AK00055002035201401081044000804CK5861 00Twist,Oliver AT&T 20121208 ]
at org.springframework.batch.
You can add the FlatFileParseException class on your batch job config, for example:
<batch:chunk reader="customImportReader" writer="customImporter" processor="customProcessor" commit-interval="1" skip-limit="10">
<batch:skippable-exception-classes>
<batch:include class="org.springframework.batch.item.file.FlatFileParseException" />
</batch:skippable-exception-classes>
</batch:chunk>
As per Spring Batch Documentation some of the exceptions are not qualified as skippable.
In your case its clear from logs that org.springframework.batch.item.file.FlatFileParseException is not a skippable excepotion hence re throwing org.springframework.batch.core.step.skip.NonSkippableReadException.
Read more about Configuring Skip Logic section that says:
For any exception encountered, the skippability will be determined by the nearest superclass in the class hierarchy. Any unclassifed exception will be treated as 'fatal'.
Read more about NonSkippableReadException that says:
Fatal exception to be thrown when a read operation could not be skipped.
Create a custom fileReader and Override the doRead() method to always throw you CustomException.
public class CustomFlatFileItemReader extends FlatFileItemReader {
#Override
protected T doRead() throws Exception {
T itemRead=null;
try {
itemRead= super.doRead();
} catch (FlatFileParseException e) {
throw new MyException(e.getMessage(), e);
}
return itemRead;}
}
Override your job skip policy to always skip your custom exception as below:
.skipPolicy((Throwable T, int skipCount) -> {
if (T instanceof BatchServiceException)
return true;
else
return false;

How can i resolve this MULE_ERROR-109

I am performing a transformation and getting the following error:
ERROR 2013-10-02 12:38:19,763 [[vistaesb].VistaESBFlow1.stage1.04] org.mule.exception.DefaultMessagingExceptionStrategy:
Message : Failed to transform from "json" to "personal_information"
Code : MULE_ERROR-109
Exception stack is:
1. Unrecognized field "phone_number" (Class personal_information), not marked as ignorable
at [Source: java.io.InputStreamReader#ac7e4af; line: 2, column: 21] (through reference chain: personal_information["phone_number"]) (org.codehaus.jackson.map.exc.UnrecognizedPropertyException)
org.codehaus.jackson.map.exc.UnrecognizedPropertyException:53 (null)
2. Failed to transform from "json" to "personal_information" (org.mule.api.transformer.TransformerException)
org.mule.module.json.transformers.JsonToObject:136 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
MY configuration is simple enough:
<flow name="VistaESBFlow1" doc:name="VistaESBFlow1">
<jdbc-ee:inbound-endpoint queryKey="personal_information" responseTimeout="1000" encoding="UTF-8" mimeType="text/plain" queryTimeout="-1" pollingFrequency="10000" connector-ref="applyVista_dev" doc:name="Data Entry Point">
</jdbc-ee:inbound-endpoint>
<json:object-to-json-transformer doc:name="Object to JSON"/>
<data-mapper:transform config-ref="new_mapping_grf" doc:name="DataMapper"/>
<json:json-to-object-transformer doc:name="JSON to Object" encoding="utf8" returnClass="personal_information" mimeType="text/plain"/>
<file:outbound-endpoint path="C:\Users\abrowning\Desktop\test" responseTimeout="10000" doc:name="File" encoding="utf8" mimeType="text/plain"/>
</flow>
There is a link to a similar problem here, 109 Error, but i don't think this has to do with my endpoint.
I'm guessing a 109 is a bush-league error, so nay help is appreciated.
The source of my issue was that I had a data mismatch in my get/set methods and after having written a lot of PHP over the last year, I over looked that.

Invoking a WCF method that takes a List of objects. Consumed via an iPhone application

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 )
at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
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)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.ServiceModel.Dispatcher.NetDispatcherFaultException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>
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:
Implement WCF message inspector(IDispatchMessageInspector).
Implement endpoint behavior (IEndpointBehavior).
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:
Declare new behavior extension (Make sure that the correct full type name is used in type attribute).
Use the declared behavior extension in an endpoint behavior.
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>