The underlying connection was closed: Unable to connect to the rem

G

Guest

Hello,

When using VB.Net to connect ot a web service, I am getting the error

The underlying connection was closed: Unable to connect to the remote server

What could be causing this?

Thanks!
 
S

steve

| The underlying connection was closed: Unable to connect to the remote
server
|
| What could be causing this?

a plethura of reasons. catch the specific exception and see if you can get
more details. for us to better help you, it would be in your best interest
to show your code that communicates with the ws and to know other details
about the ws provider...is it a ws that you created or is it something we
can all hit to diagnose this for you...etc.

details posted here will most likely give you more detailed answers to your
delima.
 
G

Guest

steve said:
| The underlying connection was closed: Unable to connect to the remote
server
|
| What could be causing this?

a plethura of reasons. catch the specific exception and see if you can get
more details. for us to better help you, it would be in your best interest
to show your code that communicates with the ws and to know other details
about the ws provider...is it a ws that you created or is it something we
can all hit to diagnose this for you...etc.

details posted here will most likely give you more detailed answers to your
delima.

Thanks. Here is my code:


I can't seem to get any more details on the exception. Here's my code
followed by the contents of the wsdl file.

*********************

Public Class Form1

Inherits System.Windows.Forms.Form

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim oClass As New Class1

Try

'Call oClass.GetMyCodeStatus("XXXXX", "YYYYY", 2005, 10)

'Call oClass.GerMyCodeProductionDetail("XXXXX", "YYYYY", "11/01/2005",
"11/30/2005", "all", "all", "date", True)

Call oClass.GetCommissionDetails("XXXXX", "YYYYY", "all", "01/01/2005",
"11/30/2005", True)

TextBox1.Text = oClass.XMLReturn

Catch oExc As Exception

MsgBox(oExc.ToString)

End Try

End Sub

End Class

****************************

Public Class Class1

Private MyDevelopment As New WebReference.MyWebServDemo Service

Private msXML As String

Public ReadOnly Property XMLReturn() As String

Get

Return msXML

End Get

End Property

Public Sub GetCommissionDetails(ByVal userid As String, ByVal password As
String, ByVal company As String, ByVal fromDate As String, ByVal toDate As
String, ByVal isRollup As Boolean)

'Dim oExc As Exception

Try

msXML = ""

MyDevelopment.BegingetCommissionDetails(userid, password, company, fromDate,
toDate, isRollup, AddressOf getCommissionDetailsString, Nothing)

Catch oExc As Exception

MsgBox(oExc.ToString)

End Try

End Sub

Private Sub getCommissionDetailsString(ByVal res As IAsyncResult)

Dim rawXml As String = MyDevelopment.EndgetCommissionDetails(res)

msXML = rawXml

End Sub

Public Sub GetMyCodeStatus(ByVal userid As String, ByVal password As String,
ByVal year As Integer, ByVal month As Integer)

msXML = ""

'moForm.Label1.Text = "Retrieving data from: " & vbCrLf & MyProduction.Url()

MyDevelopment.BegingetMyCodeStatus(userid, password, year, month, AddressOf
getMyCodeStatusString, Nothing)

'moForm.ShowDialog()

'Return msXML

End Sub

Private Sub getMyCodeStatusString(ByVal res As IAsyncResult)

Dim rawXml As String = MyDevelopment.EndgetMyCodeStatus(res)

msXML = rawXml

'moForm.Close()

End Sub

Public Sub GerMyCodeProductionDetail(ByVal userid As String, ByVal password
As String, ByVal fromDate As String, ByVal toDate As String, ByVal status As
String, ByVal company As String, ByVal sort As String, ByVal isRollup As
Boolean)

msXML = ""

MyDevelopment.BegingetMyCodeProductionDetails(userid, password, fromDate,
toDate, status, company, sort, isRollup, AddressOf getMyCodeProdDetailString,
Nothing)

End Sub

Private Sub getMyCodeProdDetailString(ByVal res As IAsyncResult)

Dim rawxml As String = MyDevelopment.EndgetMyCodeProductionDetails(res)

msXML = rawxml

End Sub

End Class

****************************

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions targetNamespace="http://service.MyCode.mywebsite.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://service.MyCode.mywebsite.com"
xmlns:intf="http://service.MyCode.mywebsite.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<wsdl:types>

<schema elementFormDefault="qualified"
targetNamespace="http://service.MyCode.mywebsite.com"
xmlns="http://www.w3.org/2001/XMLSchema">

<element name="getMyCodeStatus">

<complexType>

<sequence>

<element name="uid" nillable="true" type="xsd:string"/>

<element name="pw" nillable="true" type="xsd:string"/>

<element name="year" nillable="true" type="xsd:string"/>

<element name="month" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

</element>

<element name="getMyCodeStatusResponse">

<complexType>

<sequence>

<element name="getMyCodeStatusReturn" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

</element>

<element name="getMyCodeProductionDetails">

<complexType>

<sequence>

<element name="uid" nillable="true" type="xsd:string"/>

<element name="pw" nillable="true" type="xsd:string"/>

<element name="fromDate" nillable="true" type="xsd:string"/>

<element name="toDate" nillable="true" type="xsd:string"/>

<element name="status" nillable="true" type="xsd:string"/>

<element name="company" nillable="true" type="xsd:string"/>

<element name="sort" nillable="true" type="xsd:string"/>

<element name="isRollup" type="xsd:boolean"/>

</sequence>

</complexType>

</element>

<element name="getMyCodeProductionDetailsResponse">

<complexType>

<sequence>

<element name="getMyCodeProductionDetailsReturn" nillable="true"
type="xsd:string"/>

</sequence>

</complexType>

</element>

<element name="getCommissionDetails">

<complexType>

<sequence>

<element name="uid" nillable="true" type="xsd:string"/>

<element name="pw" nillable="true" type="xsd:string"/>

<element name="company" nillable="true" type="xsd:string"/>

<element name="fromDate" nillable="true" type="xsd:string"/>

<element name="toDate" nillable="true" type="xsd:string"/>

<element name="isRollup" type="xsd:boolean"/>

</sequence>

</complexType>

</element>

<element name="getCommissionDetailsResponse">

<complexType>

<sequence>

<element name="getCommissionDetailsReturn" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

</element>

</schema>

</wsdl:types>

<wsdl:message name="getCommissionDetailsResponse">

<wsdl:part element="intf:getCommissionDetailsResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="getMyCodeProductionDetailsResponse">

<wsdl:part element="intf:getMyCodeProductionDetailsResponse"
name="parameters"/>

</wsdl:message>

<wsdl:message name="getMyCodeStatusRequest">

<wsdl:part element="intf:getMyCodeStatus" name="parameters"/>

</wsdl:message>

<wsdl:message name="getCommissionDetailsRequest">

<wsdl:part element="intf:getCommissionDetails" name="parameters"/>

</wsdl:message>

<wsdl:message name="getMyCodeStatusResponse">

<wsdl:part element="intf:getMyCodeStatusResponse" name="parameters"/>

</wsdl:message>

<wsdl:message name="getMyCodeProductionDetailsRequest">

<wsdl:part element="intf:getMyCodeProductionDetails" name="parameters"/>

</wsdl:message>

<wsdl:portType name="MyWebServDemo ">

<wsdl:blush:peration name="getMyCodeStatus">

<wsdl:input message="intf:getMyCodeStatusRequest"
name="getMyCodeStatusRequest"/>

<wsdl:blush:utput message="intf:getMyCodeStatusResponse"
name="getMyCodeStatusResponse"/>

</wsdl:blush:peration>

<wsdl:blush:peration name="getMyCodeProductionDetails">

<wsdl:input message="intf:getMyCodeProductionDetailsRequest"
name="getMyCodeProductionDetailsRequest"/>

<wsdl:blush:utput message="intf:getMyCodeProductionDetailsResponse"
name="getMyCodeProductionDetailsResponse"/>

</wsdl:blush:peration>

<wsdl:blush:peration name="getCommissionDetails">

<wsdl:input message="intf:getCommissionDetailsRequest"
name="getCommissionDetailsRequest"/>

<wsdl:blush:utput message="intf:getCommissionDetailsResponse"
name="getCommissionDetailsResponse"/>

</wsdl:blush:peration>

</wsdl:portType>

<wsdl:binding name="MyWebServDemo SoapBinding" type="intf:MyWebServDemo ">

<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:blush:peration name="getMyCodeStatus">

<wsdlsoap:blush:peration soapAction=""/>

<wsdl:input name="getMyCodeStatusRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:blush:utput name="getMyCodeStatusResponse">

<wsdlsoap:body use="literal"/>

</wsdl:blush:utput>

</wsdl:blush:peration>

<wsdl:blush:peration name="getMyCodeProductionDetails">

<wsdlsoap:blush:peration soapAction=""/>

<wsdl:input name="getMyCodeProductionDetailsRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:blush:utput name="getMyCodeProductionDetailsResponse">

<wsdlsoap:body use="literal"/>

</wsdl:blush:utput>

</wsdl:blush:peration>

<wsdl:blush:peration name="getCommissionDetails">

<wsdlsoap:blush:peration soapAction=""/>

<wsdl:input name="getCommissionDetailsRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:blush:utput name="getCommissionDetailsResponse">

<wsdlsoap:body use="literal"/>

</wsdl:blush:utput>

</wsdl:blush:peration>

</wsdl:binding>

<wsdl:service name="MyWebServDemo Service">

<wsdl:port binding="intf:MyWebServDemo SoapBinding" name="MyWebServDemo ">

<wsdlsoap:address
location="http://localhost:825/MyCode/services/MyWebServDemo "/>

</wsdl:port>

</wsdl:service>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top