Invoke of webservice fails with HTTP status 400 Bad Request










0















I'm getting a failure in my web application calling a webservice:



Server Error in '/zVersion2a' Application.
The request failed with HTTP status 400: Bad Request.



Here is a link to the webservice itself (this works):



http://www.zipeee.com/Zipeeewebservice/



Here is a link to the [production] web app that calls the WS on the first page load:



http://www.zipeee.com/Zipeee/



Here is a link to the [newVersion] web app that fails calling this same WS:



http://www.zipeee.com/zVersion2/



Here is the source in the calling page:



Imports System.Data
Partial Class frmZipeee
Inherits System.Web.UI.Page
Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee
Dim dsStandardMsg As DataSet
Dim dtStandardMsg As DataTable
Dim dsRandomMsg As DataSet
Dim dtRandomMsg As DataTable
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
LoadMessage()
End If
End Sub
Private Sub LoadMessage()
Dim iCnt As Integer
Dim iValue As Integer

dsStandardMsg = Nothing
dsStandardMsg = wsZipeee.GetMessageByType(BizConstants.MsgType.Standard)
iCnt = dsStandardMsg.Tables(0).Rows.Count
If iCnt = 0 Then
Me.btnEnter.Text = "Click Here to Enter."
Else
Me.btnEnter.Text = dsStandardMsg.Tables(0).Rows(0).Item("MessageContent")
End If
dsStandardMsg.Dispose()
End Sub
End Class


Here is the code from Reference.vb in the proxy:



<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ZipeeeWebService/Zipeee/Get Message By Type", RequestElementName:="Get Message By Type", RequestNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", ResponseElementName:="Get Message By TypeResponse", ResponseNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function GetMessageByType(ByVal iMsgType As Integer) As <System.Xml.Serialization.XmlElementAttribute("Get Message By TypeResult")> System.Data.DataSet
Dim results() As Object = Me.Invoke("GetMessageByType", New Object() iMsgType)
Return CType(results(0),System.Data.DataSet)
End Function


Finally, here is the code in the webservice:



 <WebMethod(MessageName:="Get Message By Type")> _
Public Function GetMessageByType(ByVal iMsgType As Integer) As DataSet
Try
'create a connection...
con = New SqlConnection(sConnZipeee)
con.Open()
command = New SqlCommand("spGetMessageByType", con)
command.CommandType = CommandType.StoredProcedure
AppendParm(command, "@MessageType", SqlDbType.Int, iMsgType)
Dim adp As SqlDataAdapter = New SqlDataAdapter(command)
Dim ds As New DataSet
adp.Fill(ds, "TableMsg")
adp.Dispose()
command.Dispose()
con.Close()
Return ds
Catch ex As SqlException
...etc. 'As I read the trace output (below) we never got here nor to SQL


On this production webserver running IIS 6.0 Windows 2003, there are 3 virtual directories within the default web site (Zipeee,zVersion2,ZipeeeWebService).



Each virtual directory points to a separate physical dir on the c drive of the webserver. Both the production Zipeee and the newVersion zVersion2 make use of proxy class called ProxyZipeeeService.dll. I've taken great care in the publishing of the main project Zipeee and the webservices it needs. For example, on a developement server using Visual Studio2008, I've built and tested all 5 projects (webservice1, webservice2, primarywebapp (i.e.zipeee), proxyclassforWS1, proxyclassforWS2). The newest versions of all of these DLLs was tagged with an assembly version chosen to be 1.6. They all work on my dev machine and I published WS1,WS2 and zipeee to a staging server (IIS 6.0) and they all work there too. Then I publish to the public server hosting the URLs above. The new version of the web app goes into separate folders on the c drive and pointed to by vDir zVersion2. It should work but fails to render even the first page because of this WS error.



I traced the failure of zVersion2 (it calls webmethod GetMessageByType in page load event and fails right away). Here it is (not very long but formatting in SO here is a bit messy):



System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#40041277=[356], ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:45.6541439Z
Timestamp=47298006836
System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:45.7791255Z
Timestamp=47298376293
System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#64844482=[160], ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:45.8572390Z
Timestamp=47298680452
System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:45.9353525Z
Timestamp=47298924420
System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#52203868=.., System.Object#72766=[1], (null), (null))
Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:46.0915795Z
Timestamp=47299598906
System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Write Request]
Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:46.0915795Z
Timestamp=47299606361
System.Web.Services.Asmx Information: 0 : Calling WebRequest.GetResponse
Method: System.Net.HttpWebRequest#5894079::GetResponse()
Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse()
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:46.0915795Z
Timestamp=47299607492
System.Web.Services.Asmx Error: 0 : Exception caught in ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse.
System.Net.WebException: The remote server returned an error: (400) Bad Request.
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:46.0915795Z
Timestamp=47299629487
System.Web.Services.Asmx Error: 0 : Exception Details:
System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:46.0915795Z
Timestamp=47299654807
System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#53046711=.., System.Object#7658356=[1], (null), (null))
Caller: ProxyZipeeeService.WSZipeee.Zipeee#1816341::Serialize()
ProcessId=1456
LogicalOperationStack=
ThreadId=1
DateTime=2010-08-06T01:58:56.9024879Z
Timestamp=47338202360










share|improve this question


























    0















    I'm getting a failure in my web application calling a webservice:



    Server Error in '/zVersion2a' Application.
    The request failed with HTTP status 400: Bad Request.



    Here is a link to the webservice itself (this works):



    http://www.zipeee.com/Zipeeewebservice/



    Here is a link to the [production] web app that calls the WS on the first page load:



    http://www.zipeee.com/Zipeee/



    Here is a link to the [newVersion] web app that fails calling this same WS:



    http://www.zipeee.com/zVersion2/



    Here is the source in the calling page:



    Imports System.Data
    Partial Class frmZipeee
    Inherits System.Web.UI.Page
    Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee
    Dim dsStandardMsg As DataSet
    Dim dtStandardMsg As DataTable
    Dim dsRandomMsg As DataSet
    Dim dtRandomMsg As DataTable
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If Not Page.IsPostBack Then
    LoadMessage()
    End If
    End Sub
    Private Sub LoadMessage()
    Dim iCnt As Integer
    Dim iValue As Integer

    dsStandardMsg = Nothing
    dsStandardMsg = wsZipeee.GetMessageByType(BizConstants.MsgType.Standard)
    iCnt = dsStandardMsg.Tables(0).Rows.Count
    If iCnt = 0 Then
    Me.btnEnter.Text = "Click Here to Enter."
    Else
    Me.btnEnter.Text = dsStandardMsg.Tables(0).Rows(0).Item("MessageContent")
    End If
    dsStandardMsg.Dispose()
    End Sub
    End Class


    Here is the code from Reference.vb in the proxy:



    <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ZipeeeWebService/Zipeee/Get Message By Type", RequestElementName:="Get Message By Type", RequestNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", ResponseElementName:="Get Message By TypeResponse", ResponseNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
    Public Function GetMessageByType(ByVal iMsgType As Integer) As <System.Xml.Serialization.XmlElementAttribute("Get Message By TypeResult")> System.Data.DataSet
    Dim results() As Object = Me.Invoke("GetMessageByType", New Object() iMsgType)
    Return CType(results(0),System.Data.DataSet)
    End Function


    Finally, here is the code in the webservice:



     <WebMethod(MessageName:="Get Message By Type")> _
    Public Function GetMessageByType(ByVal iMsgType As Integer) As DataSet
    Try
    'create a connection...
    con = New SqlConnection(sConnZipeee)
    con.Open()
    command = New SqlCommand("spGetMessageByType", con)
    command.CommandType = CommandType.StoredProcedure
    AppendParm(command, "@MessageType", SqlDbType.Int, iMsgType)
    Dim adp As SqlDataAdapter = New SqlDataAdapter(command)
    Dim ds As New DataSet
    adp.Fill(ds, "TableMsg")
    adp.Dispose()
    command.Dispose()
    con.Close()
    Return ds
    Catch ex As SqlException
    ...etc. 'As I read the trace output (below) we never got here nor to SQL


    On this production webserver running IIS 6.0 Windows 2003, there are 3 virtual directories within the default web site (Zipeee,zVersion2,ZipeeeWebService).



    Each virtual directory points to a separate physical dir on the c drive of the webserver. Both the production Zipeee and the newVersion zVersion2 make use of proxy class called ProxyZipeeeService.dll. I've taken great care in the publishing of the main project Zipeee and the webservices it needs. For example, on a developement server using Visual Studio2008, I've built and tested all 5 projects (webservice1, webservice2, primarywebapp (i.e.zipeee), proxyclassforWS1, proxyclassforWS2). The newest versions of all of these DLLs was tagged with an assembly version chosen to be 1.6. They all work on my dev machine and I published WS1,WS2 and zipeee to a staging server (IIS 6.0) and they all work there too. Then I publish to the public server hosting the URLs above. The new version of the web app goes into separate folders on the c drive and pointed to by vDir zVersion2. It should work but fails to render even the first page because of this WS error.



    I traced the failure of zVersion2 (it calls webmethod GetMessageByType in page load event and fails right away). Here it is (not very long but formatting in SO here is a bit messy):



    System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
    Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#40041277=[356], ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
    Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:45.6541439Z
    Timestamp=47298006836
    System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
    Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:45.7791255Z
    Timestamp=47298376293
    System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
    Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#64844482=[160], ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
    Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:45.8572390Z
    Timestamp=47298680452
    System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
    Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:45.9353525Z
    Timestamp=47298924420
    System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
    Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#52203868=.., System.Object#72766=[1], (null), (null))
    Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:46.0915795Z
    Timestamp=47299598906
    System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Write Request]
    Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:46.0915795Z
    Timestamp=47299606361
    System.Web.Services.Asmx Information: 0 : Calling WebRequest.GetResponse
    Method: System.Net.HttpWebRequest#5894079::GetResponse()
    Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse()
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:46.0915795Z
    Timestamp=47299607492
    System.Web.Services.Asmx Error: 0 : Exception caught in ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse.
    System.Net.WebException: The remote server returned an error: (400) Bad Request.
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:46.0915795Z
    Timestamp=47299629487
    System.Web.Services.Asmx Error: 0 : Exception Details:
    System.Net.WebException: The remote server returned an error: (400) Bad Request.
    at System.Net.HttpWebRequest.GetResponse()
    at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:46.0915795Z
    Timestamp=47299654807
    System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
    Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#53046711=.., System.Object#7658356=[1], (null), (null))
    Caller: ProxyZipeeeService.WSZipeee.Zipeee#1816341::Serialize()
    ProcessId=1456
    LogicalOperationStack=
    ThreadId=1
    DateTime=2010-08-06T01:58:56.9024879Z
    Timestamp=47338202360










    share|improve this question
























      0












      0








      0








      I'm getting a failure in my web application calling a webservice:



      Server Error in '/zVersion2a' Application.
      The request failed with HTTP status 400: Bad Request.



      Here is a link to the webservice itself (this works):



      http://www.zipeee.com/Zipeeewebservice/



      Here is a link to the [production] web app that calls the WS on the first page load:



      http://www.zipeee.com/Zipeee/



      Here is a link to the [newVersion] web app that fails calling this same WS:



      http://www.zipeee.com/zVersion2/



      Here is the source in the calling page:



      Imports System.Data
      Partial Class frmZipeee
      Inherits System.Web.UI.Page
      Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee
      Dim dsStandardMsg As DataSet
      Dim dtStandardMsg As DataTable
      Dim dsRandomMsg As DataSet
      Dim dtRandomMsg As DataTable
      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      If Not Page.IsPostBack Then
      LoadMessage()
      End If
      End Sub
      Private Sub LoadMessage()
      Dim iCnt As Integer
      Dim iValue As Integer

      dsStandardMsg = Nothing
      dsStandardMsg = wsZipeee.GetMessageByType(BizConstants.MsgType.Standard)
      iCnt = dsStandardMsg.Tables(0).Rows.Count
      If iCnt = 0 Then
      Me.btnEnter.Text = "Click Here to Enter."
      Else
      Me.btnEnter.Text = dsStandardMsg.Tables(0).Rows(0).Item("MessageContent")
      End If
      dsStandardMsg.Dispose()
      End Sub
      End Class


      Here is the code from Reference.vb in the proxy:



      <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ZipeeeWebService/Zipeee/Get Message By Type", RequestElementName:="Get Message By Type", RequestNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", ResponseElementName:="Get Message By TypeResponse", ResponseNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
      Public Function GetMessageByType(ByVal iMsgType As Integer) As <System.Xml.Serialization.XmlElementAttribute("Get Message By TypeResult")> System.Data.DataSet
      Dim results() As Object = Me.Invoke("GetMessageByType", New Object() iMsgType)
      Return CType(results(0),System.Data.DataSet)
      End Function


      Finally, here is the code in the webservice:



       <WebMethod(MessageName:="Get Message By Type")> _
      Public Function GetMessageByType(ByVal iMsgType As Integer) As DataSet
      Try
      'create a connection...
      con = New SqlConnection(sConnZipeee)
      con.Open()
      command = New SqlCommand("spGetMessageByType", con)
      command.CommandType = CommandType.StoredProcedure
      AppendParm(command, "@MessageType", SqlDbType.Int, iMsgType)
      Dim adp As SqlDataAdapter = New SqlDataAdapter(command)
      Dim ds As New DataSet
      adp.Fill(ds, "TableMsg")
      adp.Dispose()
      command.Dispose()
      con.Close()
      Return ds
      Catch ex As SqlException
      ...etc. 'As I read the trace output (below) we never got here nor to SQL


      On this production webserver running IIS 6.0 Windows 2003, there are 3 virtual directories within the default web site (Zipeee,zVersion2,ZipeeeWebService).



      Each virtual directory points to a separate physical dir on the c drive of the webserver. Both the production Zipeee and the newVersion zVersion2 make use of proxy class called ProxyZipeeeService.dll. I've taken great care in the publishing of the main project Zipeee and the webservices it needs. For example, on a developement server using Visual Studio2008, I've built and tested all 5 projects (webservice1, webservice2, primarywebapp (i.e.zipeee), proxyclassforWS1, proxyclassforWS2). The newest versions of all of these DLLs was tagged with an assembly version chosen to be 1.6. They all work on my dev machine and I published WS1,WS2 and zipeee to a staging server (IIS 6.0) and they all work there too. Then I publish to the public server hosting the URLs above. The new version of the web app goes into separate folders on the c drive and pointed to by vDir zVersion2. It should work but fails to render even the first page because of this WS error.



      I traced the failure of zVersion2 (it calls webmethod GetMessageByType in page load event and fails right away). Here it is (not very long but formatting in SO here is a bit messy):



      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
      Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#40041277=[356], ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
      Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.6541439Z
      Timestamp=47298006836
      System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
      Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.7791255Z
      Timestamp=47298376293
      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
      Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#64844482=[160], ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
      Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.8572390Z
      Timestamp=47298680452
      System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
      Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.9353525Z
      Timestamp=47298924420
      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
      Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#52203868=.., System.Object#72766=[1], (null), (null))
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299598906
      System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Write Request]
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299606361
      System.Web.Services.Asmx Information: 0 : Calling WebRequest.GetResponse
      Method: System.Net.HttpWebRequest#5894079::GetResponse()
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299607492
      System.Web.Services.Asmx Error: 0 : Exception caught in ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse.
      System.Net.WebException: The remote server returned an error: (400) Bad Request.
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299629487
      System.Web.Services.Asmx Error: 0 : Exception Details:
      System.Net.WebException: The remote server returned an error: (400) Bad Request.
      at System.Net.HttpWebRequest.GetResponse()
      at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299654807
      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
      Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#53046711=.., System.Object#7658356=[1], (null), (null))
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#1816341::Serialize()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:56.9024879Z
      Timestamp=47338202360










      share|improve this question














      I'm getting a failure in my web application calling a webservice:



      Server Error in '/zVersion2a' Application.
      The request failed with HTTP status 400: Bad Request.



      Here is a link to the webservice itself (this works):



      http://www.zipeee.com/Zipeeewebservice/



      Here is a link to the [production] web app that calls the WS on the first page load:



      http://www.zipeee.com/Zipeee/



      Here is a link to the [newVersion] web app that fails calling this same WS:



      http://www.zipeee.com/zVersion2/



      Here is the source in the calling page:



      Imports System.Data
      Partial Class frmZipeee
      Inherits System.Web.UI.Page
      Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee
      Dim dsStandardMsg As DataSet
      Dim dtStandardMsg As DataTable
      Dim dsRandomMsg As DataSet
      Dim dtRandomMsg As DataTable
      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      If Not Page.IsPostBack Then
      LoadMessage()
      End If
      End Sub
      Private Sub LoadMessage()
      Dim iCnt As Integer
      Dim iValue As Integer

      dsStandardMsg = Nothing
      dsStandardMsg = wsZipeee.GetMessageByType(BizConstants.MsgType.Standard)
      iCnt = dsStandardMsg.Tables(0).Rows.Count
      If iCnt = 0 Then
      Me.btnEnter.Text = "Click Here to Enter."
      Else
      Me.btnEnter.Text = dsStandardMsg.Tables(0).Rows(0).Item("MessageContent")
      End If
      dsStandardMsg.Dispose()
      End Sub
      End Class


      Here is the code from Reference.vb in the proxy:



      <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ZipeeeWebService/Zipeee/Get Message By Type", RequestElementName:="Get Message By Type", RequestNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", ResponseElementName:="Get Message By TypeResponse", ResponseNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
      Public Function GetMessageByType(ByVal iMsgType As Integer) As <System.Xml.Serialization.XmlElementAttribute("Get Message By TypeResult")> System.Data.DataSet
      Dim results() As Object = Me.Invoke("GetMessageByType", New Object() iMsgType)
      Return CType(results(0),System.Data.DataSet)
      End Function


      Finally, here is the code in the webservice:



       <WebMethod(MessageName:="Get Message By Type")> _
      Public Function GetMessageByType(ByVal iMsgType As Integer) As DataSet
      Try
      'create a connection...
      con = New SqlConnection(sConnZipeee)
      con.Open()
      command = New SqlCommand("spGetMessageByType", con)
      command.CommandType = CommandType.StoredProcedure
      AppendParm(command, "@MessageType", SqlDbType.Int, iMsgType)
      Dim adp As SqlDataAdapter = New SqlDataAdapter(command)
      Dim ds As New DataSet
      adp.Fill(ds, "TableMsg")
      adp.Dispose()
      command.Dispose()
      con.Close()
      Return ds
      Catch ex As SqlException
      ...etc. 'As I read the trace output (below) we never got here nor to SQL


      On this production webserver running IIS 6.0 Windows 2003, there are 3 virtual directories within the default web site (Zipeee,zVersion2,ZipeeeWebService).



      Each virtual directory points to a separate physical dir on the c drive of the webserver. Both the production Zipeee and the newVersion zVersion2 make use of proxy class called ProxyZipeeeService.dll. I've taken great care in the publishing of the main project Zipeee and the webservices it needs. For example, on a developement server using Visual Studio2008, I've built and tested all 5 projects (webservice1, webservice2, primarywebapp (i.e.zipeee), proxyclassforWS1, proxyclassforWS2). The newest versions of all of these DLLs was tagged with an assembly version chosen to be 1.6. They all work on my dev machine and I published WS1,WS2 and zipeee to a staging server (IIS 6.0) and they all work there too. Then I publish to the public server hosting the URLs above. The new version of the web app goes into separate folders on the c drive and pointed to by vDir zVersion2. It should work but fails to render even the first page because of this WS error.



      I traced the failure of zVersion2 (it calls webmethod GetMessageByType in page load event and fails right away). Here it is (not very long but formatting in SO here is a bit messy):



      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
      Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#40041277=[356], ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
      Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.6541439Z
      Timestamp=47298006836
      System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
      Caller: System.Web.Services.Protocols.SoapClientType#24827179::.ctor(ProxyZipeeeService.WSZipeee.Zipeee#50200644=ProxyZipeeeService.WSZipeee.Zipeee)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.7791255Z
      Timestamp=47298376293
      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Create XmlSerializer]
      Method: System.Xml.Serialization.XmlSerializer#1669721556::FromMappings(System.Xml.Serialization.XmlMapping#64844482=[160], ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
      Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.8572390Z
      Timestamp=47298680452
      System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Create XmlSerializer]
      Caller: System.Web.Services.Protocols.SoapClientType#46729429::.ctor(ProxyEmergencyService.WSEmergency.Emergency#88831384=ProxyEmergencyService.WSEmergency.Emergency)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:45.9353525Z
      Timestamp=47298924420
      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
      Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#52203868=.., System.Object#72766=[1], (null), (null))
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299598906
      System.Web.Services.Asmx Information: 0 : Return from XmlSerializer [Write Request]
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::Serialize()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299606361
      System.Web.Services.Asmx Information: 0 : Calling WebRequest.GetResponse
      Method: System.Net.HttpWebRequest#5894079::GetResponse()
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299607492
      System.Web.Services.Asmx Error: 0 : Exception caught in ProxyZipeeeService.WSZipeee.Zipeee#654897::GetWebResponse.
      System.Net.WebException: The remote server returned an error: (400) Bad Request.
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299629487
      System.Web.Services.Asmx Error: 0 : Exception Details:
      System.Net.WebException: The remote server returned an error: (400) Bad Request.
      at System.Net.HttpWebRequest.GetResponse()
      at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:46.0915795Z
      Timestamp=47299654807
      System.Web.Services.Asmx Information: 0 : Calling XmlSerializer [Write Request]
      Method: Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer192#13256970::Serialize(System.Xml.XmlTextWriter#53046711=.., System.Object#7658356=[1], (null), (null))
      Caller: ProxyZipeeeService.WSZipeee.Zipeee#1816341::Serialize()
      ProcessId=1456
      LogicalOperationStack=
      ThreadId=1
      DateTime=2010-08-06T01:58:56.9024879Z
      Timestamp=47338202360







      asp.net iis-6 asmx webservices-client






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 6 '10 at 20:01









      John AdamsJohn Adams

      2,0252377119




      2,0252377119






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Try to do the following:
          1. Add a new Service Reference named wsZipeee pointing to the Web Service
          2. From the Calling location (another Web App, Winform, et al):



          Dim ws as New wsZipeee.ZipeeeSoapClient()
          Dim dsStandardMsg As DataSet
          dsStandardMsg = ws.GetMessageByType(BizConstants.MsgType.Standard)


          By creating a new Service Reference, this will handle the proxy and allow you to cleanly call it. I am assuming the name of the service reference, web service, and method you want to call






          share|improve this answer























          • Thanks very much for the suggestion. Service Reference and ZipeeeSoapClient suggests to me WCF. I am using ASMX and cannot convert at this point. WS1 is my shorthand for ZipeeeWebService and the call to that is the one that seems to be failing. WS2 is simply shorthand for another webservice (not a problem here). Perhaps I've misunderstood your idea ??

            – John Adams
            Aug 7 '10 at 2:24


















          0














          As noted above, the main site used Proxy DLLs to communicate to the web service(s). In Visual Studio each Proxy project had a Web Reference (.wsdl file, etc.) and a generated app.config file. In one of these 2 proxy projects, the app.config file retained the original settings (which of course worked on my desktop dev machine and my staging web server):



          <applicationSettings>
          <ProxyZipeeeService.My.MySettings>
          <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
          <value>http://localhost/ZipeeeWebService/Zipeee.asmx</value>
          </setting>
          </ProxyZipeeeService.My.MySettings>
          </applicationSettings>


          Note the localhost value above.



          It turns out that when deployed to the production server, there is a host header value for the default web site and another web site on the same IIS machine. Later I discovered more about the fallout from this setup and came to realize that when the main site tried to access the web service via localhost it failed because localhost is not found amoung the 2 host header values. Therefore going back to Vstudio and changing the web reference as follows fixed the problem:



          <applicationSettings>
          <ProxyZipeeeService.My.MySettings>
          <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
          <value>http://www.zipeee.com/ZipeeeWebService/Zipeee.asmx</value>
          </setting>
          </ProxyZipeeeService.My.MySettings>
          </applicationSettings>





          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3427331%2finvoke-of-webservice-fails-with-http-status-400-bad-request%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Try to do the following:
            1. Add a new Service Reference named wsZipeee pointing to the Web Service
            2. From the Calling location (another Web App, Winform, et al):



            Dim ws as New wsZipeee.ZipeeeSoapClient()
            Dim dsStandardMsg As DataSet
            dsStandardMsg = ws.GetMessageByType(BizConstants.MsgType.Standard)


            By creating a new Service Reference, this will handle the proxy and allow you to cleanly call it. I am assuming the name of the service reference, web service, and method you want to call






            share|improve this answer























            • Thanks very much for the suggestion. Service Reference and ZipeeeSoapClient suggests to me WCF. I am using ASMX and cannot convert at this point. WS1 is my shorthand for ZipeeeWebService and the call to that is the one that seems to be failing. WS2 is simply shorthand for another webservice (not a problem here). Perhaps I've misunderstood your idea ??

              – John Adams
              Aug 7 '10 at 2:24















            0














            Try to do the following:
            1. Add a new Service Reference named wsZipeee pointing to the Web Service
            2. From the Calling location (another Web App, Winform, et al):



            Dim ws as New wsZipeee.ZipeeeSoapClient()
            Dim dsStandardMsg As DataSet
            dsStandardMsg = ws.GetMessageByType(BizConstants.MsgType.Standard)


            By creating a new Service Reference, this will handle the proxy and allow you to cleanly call it. I am assuming the name of the service reference, web service, and method you want to call






            share|improve this answer























            • Thanks very much for the suggestion. Service Reference and ZipeeeSoapClient suggests to me WCF. I am using ASMX and cannot convert at this point. WS1 is my shorthand for ZipeeeWebService and the call to that is the one that seems to be failing. WS2 is simply shorthand for another webservice (not a problem here). Perhaps I've misunderstood your idea ??

              – John Adams
              Aug 7 '10 at 2:24













            0












            0








            0







            Try to do the following:
            1. Add a new Service Reference named wsZipeee pointing to the Web Service
            2. From the Calling location (another Web App, Winform, et al):



            Dim ws as New wsZipeee.ZipeeeSoapClient()
            Dim dsStandardMsg As DataSet
            dsStandardMsg = ws.GetMessageByType(BizConstants.MsgType.Standard)


            By creating a new Service Reference, this will handle the proxy and allow you to cleanly call it. I am assuming the name of the service reference, web service, and method you want to call






            share|improve this answer













            Try to do the following:
            1. Add a new Service Reference named wsZipeee pointing to the Web Service
            2. From the Calling location (another Web App, Winform, et al):



            Dim ws as New wsZipeee.ZipeeeSoapClient()
            Dim dsStandardMsg As DataSet
            dsStandardMsg = ws.GetMessageByType(BizConstants.MsgType.Standard)


            By creating a new Service Reference, this will handle the proxy and allow you to cleanly call it. I am assuming the name of the service reference, web service, and method you want to call







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 6 '10 at 20:17









            websch01arwebsch01ar

            1,78111121




            1,78111121












            • Thanks very much for the suggestion. Service Reference and ZipeeeSoapClient suggests to me WCF. I am using ASMX and cannot convert at this point. WS1 is my shorthand for ZipeeeWebService and the call to that is the one that seems to be failing. WS2 is simply shorthand for another webservice (not a problem here). Perhaps I've misunderstood your idea ??

              – John Adams
              Aug 7 '10 at 2:24

















            • Thanks very much for the suggestion. Service Reference and ZipeeeSoapClient suggests to me WCF. I am using ASMX and cannot convert at this point. WS1 is my shorthand for ZipeeeWebService and the call to that is the one that seems to be failing. WS2 is simply shorthand for another webservice (not a problem here). Perhaps I've misunderstood your idea ??

              – John Adams
              Aug 7 '10 at 2:24
















            Thanks very much for the suggestion. Service Reference and ZipeeeSoapClient suggests to me WCF. I am using ASMX and cannot convert at this point. WS1 is my shorthand for ZipeeeWebService and the call to that is the one that seems to be failing. WS2 is simply shorthand for another webservice (not a problem here). Perhaps I've misunderstood your idea ??

            – John Adams
            Aug 7 '10 at 2:24





            Thanks very much for the suggestion. Service Reference and ZipeeeSoapClient suggests to me WCF. I am using ASMX and cannot convert at this point. WS1 is my shorthand for ZipeeeWebService and the call to that is the one that seems to be failing. WS2 is simply shorthand for another webservice (not a problem here). Perhaps I've misunderstood your idea ??

            – John Adams
            Aug 7 '10 at 2:24













            0














            As noted above, the main site used Proxy DLLs to communicate to the web service(s). In Visual Studio each Proxy project had a Web Reference (.wsdl file, etc.) and a generated app.config file. In one of these 2 proxy projects, the app.config file retained the original settings (which of course worked on my desktop dev machine and my staging web server):



            <applicationSettings>
            <ProxyZipeeeService.My.MySettings>
            <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
            <value>http://localhost/ZipeeeWebService/Zipeee.asmx</value>
            </setting>
            </ProxyZipeeeService.My.MySettings>
            </applicationSettings>


            Note the localhost value above.



            It turns out that when deployed to the production server, there is a host header value for the default web site and another web site on the same IIS machine. Later I discovered more about the fallout from this setup and came to realize that when the main site tried to access the web service via localhost it failed because localhost is not found amoung the 2 host header values. Therefore going back to Vstudio and changing the web reference as follows fixed the problem:



            <applicationSettings>
            <ProxyZipeeeService.My.MySettings>
            <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
            <value>http://www.zipeee.com/ZipeeeWebService/Zipeee.asmx</value>
            </setting>
            </ProxyZipeeeService.My.MySettings>
            </applicationSettings>





            share|improve this answer



























              0














              As noted above, the main site used Proxy DLLs to communicate to the web service(s). In Visual Studio each Proxy project had a Web Reference (.wsdl file, etc.) and a generated app.config file. In one of these 2 proxy projects, the app.config file retained the original settings (which of course worked on my desktop dev machine and my staging web server):



              <applicationSettings>
              <ProxyZipeeeService.My.MySettings>
              <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
              <value>http://localhost/ZipeeeWebService/Zipeee.asmx</value>
              </setting>
              </ProxyZipeeeService.My.MySettings>
              </applicationSettings>


              Note the localhost value above.



              It turns out that when deployed to the production server, there is a host header value for the default web site and another web site on the same IIS machine. Later I discovered more about the fallout from this setup and came to realize that when the main site tried to access the web service via localhost it failed because localhost is not found amoung the 2 host header values. Therefore going back to Vstudio and changing the web reference as follows fixed the problem:



              <applicationSettings>
              <ProxyZipeeeService.My.MySettings>
              <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
              <value>http://www.zipeee.com/ZipeeeWebService/Zipeee.asmx</value>
              </setting>
              </ProxyZipeeeService.My.MySettings>
              </applicationSettings>





              share|improve this answer

























                0












                0








                0







                As noted above, the main site used Proxy DLLs to communicate to the web service(s). In Visual Studio each Proxy project had a Web Reference (.wsdl file, etc.) and a generated app.config file. In one of these 2 proxy projects, the app.config file retained the original settings (which of course worked on my desktop dev machine and my staging web server):



                <applicationSettings>
                <ProxyZipeeeService.My.MySettings>
                <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
                <value>http://localhost/ZipeeeWebService/Zipeee.asmx</value>
                </setting>
                </ProxyZipeeeService.My.MySettings>
                </applicationSettings>


                Note the localhost value above.



                It turns out that when deployed to the production server, there is a host header value for the default web site and another web site on the same IIS machine. Later I discovered more about the fallout from this setup and came to realize that when the main site tried to access the web service via localhost it failed because localhost is not found amoung the 2 host header values. Therefore going back to Vstudio and changing the web reference as follows fixed the problem:



                <applicationSettings>
                <ProxyZipeeeService.My.MySettings>
                <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
                <value>http://www.zipeee.com/ZipeeeWebService/Zipeee.asmx</value>
                </setting>
                </ProxyZipeeeService.My.MySettings>
                </applicationSettings>





                share|improve this answer













                As noted above, the main site used Proxy DLLs to communicate to the web service(s). In Visual Studio each Proxy project had a Web Reference (.wsdl file, etc.) and a generated app.config file. In one of these 2 proxy projects, the app.config file retained the original settings (which of course worked on my desktop dev machine and my staging web server):



                <applicationSettings>
                <ProxyZipeeeService.My.MySettings>
                <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
                <value>http://localhost/ZipeeeWebService/Zipeee.asmx</value>
                </setting>
                </ProxyZipeeeService.My.MySettings>
                </applicationSettings>


                Note the localhost value above.



                It turns out that when deployed to the production server, there is a host header value for the default web site and another web site on the same IIS machine. Later I discovered more about the fallout from this setup and came to realize that when the main site tried to access the web service via localhost it failed because localhost is not found amoung the 2 host header values. Therefore going back to Vstudio and changing the web reference as follows fixed the problem:



                <applicationSettings>
                <ProxyZipeeeService.My.MySettings>
                <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String">
                <value>http://www.zipeee.com/ZipeeeWebService/Zipeee.asmx</value>
                </setting>
                </ProxyZipeeeService.My.MySettings>
                </applicationSettings>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 19 '10 at 15:54









                John AdamsJohn Adams

                2,0252377119




                2,0252377119



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3427331%2finvoke-of-webservice-fails-with-http-status-400-bad-request%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Use pre created SQLite database for Android project in kotlin

                    Darth Vader #20

                    Ondo