Webservice URL

swteam

Newcomer
Joined
Jun 23, 2008
Messages
9
Hai all,

i developed a webservice which will take the data and update the database here my doubt which url i will provide to the client when i run my service my URL Looks like this http://localhost:2412/test/Service.asmx in the browser it shows two links named as helloworld and response i wrote code in response. so here i am unabe find which url i have to provide to the client please guide me here i am giving link after clicking the response link my url look like this http://localhost:2412/test/Service.asmx?op=response please help me its urgent
 
Browser vs code

Viewing your web service in a browser is quite different from using it in code. When your web service is accessed in code, the request will be posted to the Service.asmx URL whether the client is calling 'helloworld' or 'response'. The details of which web method the client is calling, along with any parameters being passed in, are contained in the HTTP POST data which is sent to the web server.

Basically, you only need to use the URL of the Service.asmx page, and from that clients will be able to access all the functions provided by that service.

Good luck :cool:
 
Re: Browser vs code

thank you,
But is there any way we can test it by me that my service is working fine & Responding properly
 
You could add a WinForms app to your solution and add a "web reference" to the web service, and then in your WinForms app you could consume the web service to ensure that it is working as expected.
 
Hai i have developed an web service and i am testing it by calling like this
it is giving an Error 500 Remoteserver returned an error the calling code as follows please help how to solve

Visual Basic:
Dim Request As WebRequest = WebRequest.Create("http://156.11.127.18/test/Service.asmx")
Request.Method = "POST"
        Dim PostData As String = "<response><TransactionId>12</TransactionId><VendorTransactionId>13</VendorTransactionId></response>"
 Dim ByteArray As Byte() = Encoding.UTF8.GetBytes(PostData)
        Dim Instance As New WebException
        Dim Value As WebExceptionStatus
Request.ContentType = "application/x-www-form-urlencoded"
        'Request.ContentType = "XML"
        ' Set the ContentLength property of the WebRequest.
        Request.ContentLength = ByteArray.Length
        ' Get the Request stream.
        Dim dataStream As Stream = Request.GetRequestStream()
        ' Write the data to the Request stream.
        dataStream.Write(ByteArray, 0, ByteArray.Length)
        ' Close the Stream object.
        dataStream.Close()
        ' Get the response.
        Value = Instance.Status
        Dim response As WebResponse = Request.GetResponse()
        ' Display the status.
        Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
        ' Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream()
        ' Open the stream using a StreamReader for easy access.
        Dim reader As New StreamReader(dataStream)
' Read the content.
        Dim responseFromServer As String = reader.ReadToEnd()

        TextBox1.Text += responseFromServer

        ' Clean up the streams.
        reader.Close()
        dataStream.Close()
 
Last edited by a moderator:
Off the top of my head it looks as though you are sending the request to the webservice without specifying which web method should handle it.

Did you try adding a web reference though like Nate Bross suggested? It would be far easier to do it that way...
 
Ya i tried by adding the webmethod it is working fine but the string i provided is TramsactionID=string&VendorID=string& and so on, but i want to send data as<TransactionID>string</TransactionID><VendorID>string</vendorID> like this i want to send if i am trying this i am getting an protocolvoilation error
my webmoethod is as follows

<webmethod()>public function resp(Byval TransactionID as String,Byval VendorID as String) as string

dim a as string = TransactionID
dim b as string = VendorID

after this databaseupdation coding

so any changes in my webmethod to accept the data as xmlString format
please guide me if it works with the .NET Client then i have to test with JAVA Client
 
If you have added a web method to your client project, you do not need to pass the values as XML -- the framework will serialize your method call and send it to the web service.

If this is your WebService
Visual Basic:
<webmethod()>public function resp(Byval TransactionID as String,Byval VendorID as String) as string

dim a as string = TransactionID
dim b as string = VendorID


return x
end function

After adding the WebService as a "Web Reference" to your client project, you can call it like this. After you import the namespace and define the object

Visual Basic:
Sub Button_Click(Sender as Object, e as EventArgs)
   Dim objWebService = new com.site.webservice.YourWebServiceClass()
   MessageBox.Show(objWebService.resp("myTransID", "myVendorID"))
End Sub

What does your client code look like?
 
thank you i did testing by adding the webreference to my windowsform and try your cod it is working fine. but when i have this url for testing wiht java client, i don't know what is theire code but they said that they are sending the data by using post method. while they are testing they are getting error like this (500 Request format is invalid: text/xml) what should i suggest to clear this error please guide me. they can see my webserive in theire browser and if they are trying by post the data using invoke method it is working fine. the data they providing like this (<TransactionId>123456</TransactionId><VendorTransactionId>110</VendorTransactionId>) so please tell me what to do i struck up my work because of this
 
Back
Top