Question : VB.Net Web Services - xmlns attributes are not put inside tags

I am creating a web services provider to be used with a customer's web service.  They gave me their wsdl and xsd files and I used wsdl.exe in order to generate the vb code to include in my Visual Studio project.  I then used Wireshark in order to capture the actual SOAP request being made so I could make sure its formed correctly and discovered that its not.  Here is an excerpt:

   
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       
           
                xmlns="http://www.w3.org/2005/08/addressing"
                urn:services-qad-com::dev
               


Notice that the xmlns attributes are not being put inside the xml tags.  Does anyone know why Microsoft is doing this?

Here is the top of the code showing the declaration of the class which was generated by the wsdl.exe app:

eneratedCodeAttribute("wsdl", "2.0.50727.42"),  _
 System.Diagnostics.DebuggerStepThroughAttribute(),  _
 System.ComponentModel.DesignerCategoryAttribute("code"),  _
 System.Web.Services.WebServiceBindingAttribute(Name:="SoapBinding", [Namespace]:="urn:schemas-qad-com:xml-services")>  _
Partial Public Class QdocWebService
    Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
   
Here is the function that the wsdl.exe app created which is called in order to invoke the call:

    cols.SoapHeaderAttribute("Action", Direction:=System.Web.Services.Protocols.SoapHeaderDirection.InOut),  _
     System.Web.Services.Protocols.SoapHeaderAttribute("RelatesTo", Direction:=System.Web.Services.Protocols.SoapHeaderDirection.Out),  _
     System.Web.Services.Protocols.SoapHeaderAttribute("ReferenceParameters"),  _
     System.Web.Services.Protocols.SoapHeaderAttribute("To", Direction:=System.Web.Services.Protocols.SoapHeaderDirection.InOut),  _
     System.Web.Services.Protocols.SoapHeaderAttribute("MessageID", Direction:=System.Web.Services.Protocols.SoapHeaderDirection.InOut),  _
     System.Web.Services.Protocols.SoapHeaderAttribute("ReplyTo"),  _
     System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)>  _
    Public Function processQdocMessage(.Xml.Serialization.XmlElementAttribute([Namespace]:="urn:schemas-qad-com:xml-services")> ByVal queryCatswebPrh1 As QueryServiceRequestType) As XmlElementAttribute("queryCatswebPrh1Response", [Namespace]:="urn:schemas-qad-com:xml-services")> QueryServiceResponseType
        Dim results() As Object = Me.Invoke("processQdocMessage", New Object() {queryCatswebPrh1})
        Return CType(results(0),QueryServiceResponseType)
    End Function

Answer : VB.Net Web Services - xmlns attributes are not put inside tags

No, I'm not confident of the wsdl itself.  I've built a few before, but have never seen something as complicated as this one - to me it looks overcomplicated - they've put repeating elements in places where they've got a static number...so why they need to overcomplicate the xml is beyond me.  I was also told by the consultant who gave me the wsdl that he was told it wasn't that great.

One thing I did find, though, is that Wireshark isn't actually displaying the packet in the format that its streamed.  When I took a  look at the actual TCP stream it had the xmlns attributes inside the nodes like they should be.....not sure why Wireshark does that.  I haven't been able to test with the customer yet, though, so I'm still not confident that the request is in the format they need.  The way that .Net generates the code for you is really annoying to me - I realize that many think this is great and that its easier, but it gives you less control over the code - hence the problem I've had till now.
Random Solutions  
 
programming4us programming4us