title: Webservice Namespace problem
body: <p>I have a ASP.NET webservice which is called by a Java client. The client sends a SOAP message as input but the problem is that it never reaches my webservice method. I always get null input. I used TraceListener and saw this warning which may cause the problem:</p>
  
  <p><em><strong>The element was not expected in this context: ... Expected elements: <a href="http://client.ns.url/:ListenerInput" rel="nofollow">http://client.ns.url/:ListenerInput</a>.</em></strong></p>
  
  <p>This is what the client sends:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;S:Envelope xmlns:S = "http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;S:Body&gt;
          &lt;ns2:Listener xmlns:ns2 = "http://client.ns.url/"&gt;
              &lt;ListenerInput&gt;
                  &lt;errorCode&gt;0&lt;/errorCode&gt;
                  &lt;errorDescription&gt;Success&lt;/errorDescription&gt;
                  &lt;firstPrice xsi:nil = "true" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"/&gt;
              &lt;/ListenerInput&gt;
          &lt;/ns2:Listener&gt;
      &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>And here's my webmethod:</p>
  
  <pre><code>[System.Web.Services.WebServiceAttribute(Namespace = "http://client.ns.url/")]
  [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
  [System.Web.Services.WebServiceBindingAttribute(Name = "ListenerWebServicePortSoapBinding", Namespace = "http://client.ns.url/")]
  public partial class ListenerService : System.Web.Services.WebService
  {
  
      [System.Web.Services.WebMethodAttribute()]
      [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://client.different.url/services/action/ListenerService/Listener", RequestElementName = "Listener", RequestNamespace = "http://client.ns.url/", ResponseNamespace = "http://client.ns.url/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
      [return: System.Xml.Serialization.XmlElementAttribute("return")] 
      public ListenerResponse Listener([System.Xml.Serialization.XmlElementAttribute("ListenerInput")]ListenerInput listenerInput)
      {
  ..
  </code></pre>
  
  <p>This is the input class:</p>
  
  <pre><code>[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://client.ns.url")]
  [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  public partial class ListenerInput
  {
      public int errorCode;
      public string errorDescription;
      public float? firstPrice;
  }
  </code></pre>
  
  <p>What should I do to solve this? Here's the some of the trace log:</p>
  
  <pre><code>Calling IHttpHandler.ProcessRequest
      Caller: System.Web.Services.Protocols.SyncSessionlessHandler#47754503::ProcessRequest()
      Request Host Address: xxx
      Request Url: [POST] http:/my.website/Listener.asmx
  ..
  Calling XmlSerializer [Read Request]
      Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer#53218107::Deserialize(System.Web.Services.Protocols.SoapServerProtocol+SoapEnvelopeReader#4153573=.., (null))
      Caller: System.Web.Services.Protocols.SoapServerProtocol#51389704::ReadParameters()
  ...
  The element was not expected in this context: &lt;ListenerInput&gt;..&lt;/ListenerInput&gt;. Expected elements: http://client.ns.url/:ListenerInput.
  ...
  Return from XmlSerializer [Read Request]
      Caller: System.Web.Services.Protocols.SoapServerProtocol#51389704::ReadParameters()
  ...
   Calling ListenerResponse Listener(ListenerInput)
      Method: ListenerService#64693151::Listener((null))
      Caller: System.Web.Services.Protocols.SyncSessionlessHandler#47754503::Invoke()
  </code></pre>