It's all very fuzzy now...can make web request(?) but definately can't get web response from web service

Alas...trying to get a web service response from a web service that is part of the web site in Visual Studio.Net 3.5 appears to be impossible.  Infact, I've been ALL over the internet over the past couple of days looking at all types of fragmentory examples in all types of Microsoft languages to no avail.

=========
QUESTION:
=========

1.  How do I call a web service (the function to call is "WebService_BulkData") so that my aspx page will send it a SOAP request and print out the web service response data to the page?  The aspx page AND the web service are part of the SAME web site project.  The web site project is being developed on a beta server (not locally stored on a computer and then uploaded).

Man, that sure sounds simple, doesn't it?

=======================================================
Here is the latest code-behind page_load() for the default.aspx page which calls the web service, gets its response and then just dumps it to the page so it can be determined that we are getting somewhere:
=======================================================

Dim objRequest As WebRequest = HttpWebRequest.Create("http://betasite.com/WebService_BulkData.asmx")
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
Dim soapBody As String = ""
soapBody = "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
soapBody = "<soap:Body>"
soapBody = "<XMLServiceData xmlns=""http://betasite.com"" />"
soapBody = "</soap:Body>"
soapBody = "</soap:Envelope>"
objRequest.Method = "POST"
objRequest.ContentType = "text/xml; charset=utf-8"
objRequest.ContentLength = soapBody.Length
objRequest.Headers.Add("SOAPAction", "XMLServiceData")

Dim myRequest As System.IO.StreamWriter = New System.IO.StreamWriter(objRequest.GetRequestStream())
myRequest.Write(soapBody)
myRequest.Close() ' App hangs if close is not here

' 500 Error is generated when viewing default.aspx in browser at the following line.  Why?  Not even sure if this is the best way.
Dim webResponse As System.IO.StreamReader = New System.IO.StreamReader(objRequest.GetResponse().GetResponseStream())
Dim receiveStream As String = ""
While Not webResponse.EndOfStream
receiveStream += webResponse.ReadLine()
End While
webResponse.Close()
Response.Write(receiveStream)

=====================
Here is the web service itself:
=====================

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Description
Imports System.Web.Services.Discovery
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://betasite.com")> _
<System.Web.Script.Services.ScriptService()> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService_BulkData
    Inherits System.Web.Services.WebService

    <WebMethod(EnableSession:=True)> _
    Public Function XMLServiceData() As XMLDataBlock
 ' Prepopulate with values to send something back by default and keep it simple
        Return New XMLDataBlock With {.DBstoryid = 1, .DBstoryimagesmall = "/somefolder/default_thumb.jpg", .DBstoryimagelarge = "2big.gif", .DBstoryurl = "http://www.site2.com/", .DBstoryemail = "none yet", .DBstoryphone = "111-456-7890", .DBstorywriter = "The pollman 2", .DBstoryinstitution = "ABC 2", .DBstorytitle = "2 - Session Detected", .DBstorycontent = "2 - Serving Custom Data.", .DBstoryfullcontent = "2- The entire text of the content."}
    End Function

End Class

Public Class XMLDataBlock
    Private _DBstoryid As Integer
    Private _DBstoryimagesmall As String
    Private _DBstoryimagelarge As String
    Private _DBstoryurl As String
    Private _DBstoryemail As String
    Private _DBstoryphone As String
    Private _DBstorywriter As String
    Private _DBstoryinstitution As String
    Private _DBstorytitle As String
    Private _DBstorycontent As String
    Private _DBstoryfullcontent As String

    Public Property DBstoryid() As Integer
        Get
            Return _DBstoryid
        End Get
        Set(ByVal value As Integer)
            _DBstoryid = value
        End Set
    End Property
    Public Property DBstoryimagesmall() As String
        Get
            Return _DBstoryimagesmall
        End Get
        Set(ByVal value As String)
            _DBstoryimagesmall = value
        End Set
    End Property
    Public Property DBstoryimagelarge() As String
        Get
            Return _DBstoryimagelarge
        End Get
        Set(ByVal value As String)
            _DBstoryimagelarge = value
        End Set
    End Property
    Public Property DBstoryurl() As String
        Get
            Return _DBstoryurl
        End Get
        Set(ByVal value As String)
            _DBstoryurl = value
        End Set
    End Property
    Public Property DBstoryemail() As String
        Get
            Return _DBstoryemail
        End Get
        Set(ByVal value As String)
            _DBstoryemail = value
        End Set
    End Property
    Public Property DBstoryphone() As String
        Get
            Return _DBstoryphone
        End Get
        Set(ByVal value As String)
            _DBstoryphone = value
        End Set
    End Property
    Public Property DBstorywriter() As String
        Get
            Return _DBstorywriter
        End Get
        Set(ByVal value As String)
            _DBstorywriter = value
        End Set
    End Property
    Public Property DBstoryinstitution() As String
        Get
            Return _DBstoryinstitution
        End Get
        Set(ByVal value As String)
            _DBstoryinstitution = value
        End Set
    End Property
    Public Property DBstorytitle() As String
        Get
            Return _DBstorytitle
        End Get
        Set(ByVal value As String)
            _DBstorytitle = value
        End Set
    End Property
    Public Property DBstorycontent() As String
        Get
            Return _DBstorycontent
        End Get
        Set(ByVal value As String)
            _DBstorycontent = value
        End Set
    End Property
    Public Property DBstoryfullcontent() As String
        Get
            Return _DBstoryfullcontent
        End Get
        Set(ByVal value As String)
            _DBstoryfullcontent = value
        End Set
    End Property
End Class

=============
Web Site Solution:
=============

I had VS.Net 3.5 generate the .discomap, .disco, .wsdl, .svcinfo, .svcmap files for me by using it to locate the services available to the project.  Here is a break-down of what was auto-added:
/App_Code
---> WebService_BulkData.vb (the web service code you saw above)
/App_Data
/App_WebReferences
---> /localhost
--------> WebService_BulkData.discomap
--------> WebService_BulkData.disco
--------> WebService_BulkData.wsdl
---> /ServiceReference
--------> Reference.svcmap
--------> configuration.svcinfo
--------> WebService_BulkData.disco
--------> WebService_BulkData.wsdl
Default.aspx
Web.Config
WebService_BulkData.asmx

=====================================================
Here's the question I had again (so you don't have to scroll all the way up):
=====================================================

1.  How do I call a web service (the function to call is "WebService_BulkData") so that my aspx page will send it a SOAP request and print out the web service response data to the page?  The aspx page AND the web service are part of the SAME web site project.  The web site project is being developed on a beta server (not locally stored on a computer and then uploaded).

Man, that sure sounds simple, doesn't it?

 

0
gigasviking
11/28/2007 9:38:01 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

1 Replies
1091 Views

Similar Articles

[PageSpeed] 5

Is there a reason that you don't simply put the contents of the web method in an assembly and reference it from the web page and the web service?

 

 

0
RogerRabbit
11/29/2007 5:13:45 PM
Reply:

Similar Artilces:

Can "Add Web Reference" if web service deployed to new web site, Can't add ref if deployed to Virt Server under Default web site (Sharepoint)
I have created a web service wich I can deploy successfully to a new IIS Web, but of course I have to set the port to something other than 80 (and I'd rather just use a virtual server under the Default web). If I try to deploy my web service under the Default Web as a new virtual server, and then try to "Add a web Reference" to the service, it fails with a 404: not found error. Notes: WServer 2003 My IIS server is running Sharepoint Portal Server (SPPS)sp2.  VS2005 Any ideas? /Bob C in GRR In Sharepoint Portal Admin I had to add a Path Exclusion.  Took me a whi...

Can't 'Add Web Reference' of Java AXIS Web Service!
Hi All, I'm trying to consume a web service written in AXIS, but am having serious issues. Namely, when I try to add it as web reference, I get to a web page that displays: "MyWebServiceName, Hi there, this is an AXIS service!, Perhaps there will be a form for invoking the service here... "  I do have wsdl file of the web service, however when I try to manually create the proxy I get several binding errors and the process fails. Also, the web service does not seem to accept POST as I always seem to be getting http 500 errors. At this point I have no idea what else to t...

Can´t make a web site with a toolkit's component work in Godaddy's hosting service
When trying to reach a page with a toolkit's component I get the following Parser Error Message: "Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The module was expected to contain an assembly manifest."Please somebody tell me if is there anything I must add to the web.config file to make it work. Many thanks in advance.  Have a look at this thread it will help you to solve this issue.http://forums.asp.net/p/1043427/1802895.aspx ...

Ubuntu Install: The local XML file './data/bugzilla-update.xml' cannot be created. Please make sure the web server can write in this directory and that you can access the web. If you are behind a prox
Hello list, I found the fix for this on SELinux via http://web.archiveorange.com/archive/v/lRMFnx3hwvEaH6nROdxg but I cannot find the way to adapt its findings to my Ubuntu install. /public_html/bugzilla# uname -a Linux hfs 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux drwxrwx--- 7 root www-data 4096 May 22 17:45 data Thanks! -- Ryan ...

How do I merge web services' app.config with web app's web.config? Help!!
I have a web application project that uses a separate class library containing web service references (service layer). I want to be able to configure the web reference URLs dynamically and I know you can set this up by setting the URL behavior to  'Dynamic', etc, etc. The problem is VS2005 puts the URLs in the project's app.config file. When the class library becomes a DLL component, I have no way of accessing the app.config file.Is there a way to make the web reference project to look for the URLs in the web.config instead of its app.config? Or is there a way to merge this app.config w...

Problem in web service's web method's parameters.
Hello All,I am tring to consume a Java web service in ASP.NET(c#) application.In the web service, the web method 'checklogin' accepts 2 string parameters only, with return type a boolean variable. But, when I use that method in my ASP.NET application it shows me 4 parameters in the definition namely 2 string parameters(which should be there) and extra 2  boolean type OUT parameters. Out of these 2 extra OUT parameters, in the 1st parameter I get the return variable of the web method which I called/used and in the 2nd parameter, its showing nothing (means its showing default...

Can you call a web service from a web service?
I am trying to create a web service that itself consumes a 3rd party web service outside of our corporate firewall - so basically a web service consuming another web service.  I can consume this outside web service directly in an ASP.NET application without a problem.  But because the code is long and cumbersome, I wanted to provide our GUI developers an easy way to get all of the data they need from one source.  So I thought I could create an internal web service that would do a lot of things (query internal systems, for example) as well as consuming this external service.&nb...

Web Site Project: How to configure web service URL in web.config (web service defined in a referenced DLL)
I have a web site that references a business logic DLL project. In the business logic project, there is a web service defined in its app.config file something like this: <applicationSettings>  <MyNamespace.BLL.Properties.Settings>    <setting name="MyNamespace_BLL_MyServer_ServiceName" serializeAs="String">    <value>http://blah.blah.blah.asmx</value>  </setting>  </MyNamespace.BLL.Properties.Settings></applicationSettings> When the web site is published, the web ...

'Can't save web pages, Ctrl+S. 'Can save same pages from I.E
Name: Del Dyreson Email: drdyreson_at_earthlink.net Product: Firefox Summary: 'Can't save web pages, Ctrl+S. 'Can save same pages from I.E Comments: 'Can't save web pages, Ctrl+S. 'Can save same pages from I.E. I'm running Win2000Pro, Ver 5.0 (Build 2195, Service Pack 4). Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 ...

'web service call failed: 500' using ajax hovermenu and web service
Hi there, I'm using a hovermenuextender attached to a templatefield of a gridview, and everything seemed to work fine.. however I've moved on to add dynamic attributes to the hovermenu. Now I get the error "web service call failed: 500" in place of the output I want (on the hovermenu's panel). When accessing the web service I created (directly through the browser) everything works fine.. here's my hovermenuextender dynamic attributes DynamicContextKey='<%=eval("refnumber") %>' DynamicServiceMethod="GetS...

'System.Web.Services.Protocols.SoapException' occurred in system.web.services.dll
HI, I am trying to call a webservice that is running at another server and the webservice accesses data from the database on the same server. I have checked the database permissions and stuff, but I am getting this error.. I am not sure why the user name is displayed as 'null' ???? An unhandled exception of type 'System.Web.Services.Protocols.SoapException' occurred in system.web.services.dll Additional information: Server was unable to process request. --> Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. You're accesing a S...

web web web
Name: bahadir Email: sensiz_olmuyor_t1_at_hotmail.com Product: Firefox 2 Beta 2 Summary: web web web Comments: web sayfası yapmak Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2 ...

cascading dropdown set it's value only once but not on subsequent postbacks,web service recieve the value but can't set in dropdown
i have a dropdown named uxcommunity which is a dropdown and contain text in format ##-####-#### . and 2 more dropdowns province and district where province filters district. i get the first 2 characters ##  for session("province") and #### for session("District") and i have button to do the postback. first when the form loads and i click the button it get the value and select appropraite items in to dropdown province and district. but when i change the province dropdown content and district dropdown content and click the button , session will take correct...

how to make refer to a remote Web Service? : ServiceReference can only refer to local web service.
Hi Folks, Since  ServiceReference can only refer to local web service, how can I refer to web service in the remote machine?  Thanks for your suggestion.   Sun You can make a local web service that collect data from the remote web service.Hope this can helo ;)Stefano ...

Web resources about - It's all very fuzzy now...can make web request(?) but definately can't get web response from web service - asp.net.xml-web-services

Mos Def Most Definately NOT Being Exiled From U.S.​
I don't know why Yasiin Bey, fka Mos Def, had to cancel his U.S. tour. A note on his website says that he cannot re-enter the United States, ...

Definately not data
Kevin Drum last week summarized the most recent monthly jobs’ report: The headline unemployment rate ticked down to 5.9 percent, due to a combination ...

Portia And Ellen Definately Don't Want Kids, Want To Remain Childfree
Portia and Ellen don't want kids. in keeping with other reports, Portia says that she and Ellen plan to expand their family exactly never. Childfree ...

“I heard you’re idea’s and their definately good.”
Despite the less than elegant rhetorical flourish, this is pretty funny. From XKCD . I am reminded of how liberals insist that conservatives ...

Mujjo (@MujjoStore) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Countdown to 2012 - The Clueless Generation - YouTube
We are definately living in the Last Days. The end is not near, it's Here. For more info go to www.itshisstory.com

Kingdom Hearts II - Wikipedia, the free encyclopedia
) is an action role-playing game developed by Square Enix and published by Buena Vista Games and Square Enix in 2005 for the Sony PlayStation ...

Kentucky Derby Betting - Bet the Derby
Kentucky Derby Betting - Place your bets on the Kentucky Derby!

Fishpond.com.au
SmartSell TM - The New Way to Sell Online Shop over 300,000 Toys in our Huge New Range Search All Products Books Movies Toys Music Games Lifestyle ...

Management Line
Worst job in the world?

Resources last updated: 12/22/2015 7:50:45 PM