ASMX service parameter (type string) has null value when invoked from WCF client

I am trying to consume an existing ASMX service using WCF with a BasicHttpBinding. I used SvcUtil to get me started and just extracted the contract definition interface and the config in to my project leaving all default configuration values as generated by SvcUtil. The following is what I have currently:

Contract:

<ServiceContract()> _
<XmlSerializerFormat()> _
Public Interface IOrderProcessor

    <OperationContract(Action:="***************/SendOrder", _
                        ReplyAction:="*")> _
    Function SendOrder(ByVal strOrder As String) As String

    <OperationContract(Action:="***************/GetAnswerback", _
                        ReplyAction:="*")> _
    Function GetAnswerback(ByVal strAnswerbackGuid As String) As String

And Config:

<basicHttpBinding>
    <binding name="OrderProcessor" closeTimeout="00:01:00" openTimeout="00:01:00"
        receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>

The problem I am having is that the parameter value for strOrder of SendOrder service received by the asmx service is always null (I am definitely not providing null at my end :)

Am I missing something obvious? Where is a good place to start to debug this?

EDIT Used XMLSerializer for the serializer switch to SvcUtil

13.10.2009 22:19:13
1 ОТВЕТ
РЕШЕНИЕ

OK found the answer, I missed the Namespace property on the ServiceContract attribute. Ooopsy!! Should have been:

<ServiceContract([Namespace]:="***************")> _
<XmlSerializerFormat()> _
Public Interface IOrderProcessor

<OperationContract(Action:="***************/SendOrder", _
                    ReplyAction:="*")> _
Function SendOrder(ByVal strOrder As String) As String

<OperationContract(Action:="***************/GetAnswerback", _
                    ReplyAction:="*")> _
Function GetAnswerback(ByVal strAnswerbackGuid As String) As String

Why is this the resulting behaviour though? i.e. the service is invoked fine but the parameter value is not passed on...I assume it worked out the namespace from the Action property on the OperationContract attributes.

1
13.10.2009 23:01:43
The name of an XML element consists of the local name (SendOrder, for instance), plus the namespace. The same local name with two different namespaces is two different elements. Perhaps when you didn't specify the namespace, WCF and ASMX differed on which namespace to use "by default".
John Saunders 14.10.2009 01:15:01