Web Forms :: Display Output From Xml Service
Nov 10, 2010I am hoping that someone can show me how to display my data I am retreiving from a web service onto plain aspx screen. My code is as follows:
[Code]....
I am hoping that someone can show me how to display my data I am retreiving from a web service onto plain aspx screen. My code is as follows:
[Code]....
I have a webform which inserts data into a sql table successfully (form is bound to SqlDataSource1). The problem I have is that I need to populate a number of the DataFields based on an entered Ref number from a button click. The Ref is passed into a Stored Procedure as the only input parameter, all other params are output params. The procedure seems to run fine, but I can not seem to display any of the output params in my form. Here is my sproc:
PROC AUMS_RETURN_LOOKUP
(
@REF
@COMPANY
@SALUTATION
@FORENAME
@SURNAME
@ADDRESS1
@ADDRESS2
@ADDRESS3
@ADDRESS4
@ADDRESS5
@ADDRESS6
@CITY
@COUNTRY
@POSTCODE
BIGINT,
char(10)
OUTPUT,
char(20)
OUTPUT,
char(50)
OUTPUT,
char(50)
OUTPUT,
char(50)
OUTPUT,
char(50)
OUTPUT,
char(50)
OUTPUT,
char(50)
OUTPUT,
char(50)
OUTPUT,
char(50)
OUTPUT,
char(30)
OUTPUT,
char(30)
OUTPUT,
char(20)
OUTPUT
)
AS
SET
NOCOUNT ON
SELECT
@SALUTATION
@FORENAME
@SURNAME
@ADDRESS1
@COMPANY =
rtrim([COMPANY]),
=
RTRIM([SALUTATION]),
=
RTRIM([FORENAME]),
=
RTRIM([SURNAME]),
=
RTRIM([ADDRESS1]),
@ADDRESS2 =
RTRIM([ADDRESS2]),
@ADDRESS3 =
RTRIM([ADDRESS3]),
@ADDRESS4 =
RTRIM([ADDRESS4]),
@ADDRESS5 =
RTRIM([ADDRESS5]),
@ADDRESS6 =
RTRIM([ADDRESS6]),
@CITY =
RTRIM([CITY]),
@COUNTRY =
RTRIM[COUNTRY]), @POSTCODE
=
RTRIM([ZIP])
FROM
HEADER
WHERE
REF = REF
Here is my code:
Protected
Sub Button1_Click1(ByVal sender
As
Object,
ByVal e
As System.EventArgs)
Dim Company
As TextBox =
DirectCast(FormView1.FindControl("TextBox9"), TextBox)
Dim Forename
As TextBox =
DirectCast(FormView1.FindControl("TextBox10"), TextBox)
Dim Surname
As TextBox =
DirectCast(FormView1.FindControl("TextBox8"), TextBox)
Dim TESTREFTextBox
As TextBox =
DirectCast(FormView1.FindControl("TxtBox_ref"), TextBox)
Dim TESTREF = Convert.ToInt64(TESTREFTextBox.Text)
Dim CompanyText = Company.Text
Dim strCon
As
String = ConfigurationManager.ConnectionStrings("ConnString").ConnectionString
Dim Con
As
New SqlConnection(strCon)
Dim Cmd
As SqlCommand
Con.Open()
Cmd = New SqlCommand
Cmd.CommandText = "RETURN_LOOKUP"
Cmd.CommandType = CommandType.StoredProcedure
Cmd.Parameters.Add("@REF", SqlDbType.Int)
Cmd.Parameters("@REF").Value = TESTREF
Cmd.Parameters.Add("@COMPANY", SqlDbType.VarChar, 15)
Cmd.Parameters("@COMPANY").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@SALUTATION", SqlDbType.VarChar, 20)
Cmd.Parameters("@SALUTATION").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@FORENAME", SqlDbType.VarChar, 50)
Cmd.Parameters("@FORENAME").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@SURNAME", SqlDbType.VarChar, 50)
Cmd.Parameters("@SURNAME").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@ADDRESS1", SqlDbType.VarChar, 50)
Cmd.Parameters("@ADDRESS1").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@ADDRESS2", SqlDbType.VarChar, 50)
Cmd.Parameters("@ADDRESS2").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@ADDRESS3", SqlDbType.VarChar, 50)
Cmd.Parameters("@ADDRESS3").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@ADDRESS4", SqlDbType.VarChar, 50)
Cmd.Parameters("@ADDRESS4").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@ADDRESS5", SqlDbType.VarChar, 50)
Cmd.Parameters("@ADDRESS5").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@ADDRESS6", SqlDbType.VarChar, 50)
Cmd.Parameters("@ADDRESS6").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@CITY", SqlDbType.VarChar, 30)
Cmd.Parameters("@CITY").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@COUNTRY", SqlDbType.VarChar, 30)
Cmd.Parameters("@COUNTRY").Direction = ParameterDirection.Output
Cmd.Parameters.Add("@POSTCODE", SqlDbType.VarChar, 20)
Cmd.Parameters("@POSTCODE").Direction = ParameterDirection.Output
Cmd.Connection = Con
"@REF", SqlDbType.Int)"@REF").Value = REF"@COMPANY",
SqlDbType.VarChar, 15)"@COMPANY").Direction = ParameterDirection.Output"@SALUTATION",
SqlDbType.VarChar, 20)"@SALUTATION").Direction = ParameterDirection.Output"@FORENAME",
SqlDbType.VarChar, 50)"@FORENAME").Direction = ParameterDirection.Output"@SURNAME",
SqlDbType.VarChar, 50)"@SURNAME").Direction = ParameterDirection.Output"@ADDRESS1",
SqlDbType.VarChar, 50)"@ADDRESS1").Direction = ParameterDirection.Output"@ADDRESS2",
SqlDbType.VarChar, 50)"@ADDRESS2").Direction = ParameterDirection.Output"@ADDRESS3",
SqlDbType.VarChar, 50)"@ADDRESS3").Direction = ParameterDirection.Output"@ADDRESS4",
SqlDbType.VarChar, 50)"@ADDRESS4").Direction = ParameterDirection.Output"@ADDRESS5",
SqlDbType.VarChar, 50)"@ADDRESS5").Direction = ParameterDirection.Output"@ADDRESS6",
SqlDbType.VarChar, 50)"@ADDRESS6").Direction = ParameterDirection.Output"@CITY",
SqlDbType.VarChar, 30)"@CITY").Direction = ParameterDirection.Output"@COUNTRY",
SqlDbType.VarChar, 30)"@COUNTRY").Direction = ParameterDirection.Output"@POSTCODE",
SqlDbType.VarChar, 20)"@POSTCODE").Direction = ParameterDirection.OutputDim
result As
String
Cmd.ExecuteNonQuery()
result = Cmd.Parameters("@COMPANY").Value
CompanyText = result
I am attempting to parse the XML output from a REST web service and have been pointed in the direction of using Linq2Xml to query the XML for the attributes that I am after. The XML output is as follows:
<?xml version="1.0" encoding="UTF-8"standalone="yes" ?>
<Response Status="OK">
<Item Name="NumberZones">2</Item>
[code]...
The returned datatable is empty, I have confirmed that result does have the XML assigned, and result.value is the string version of the XML file (200Westralia0{81C56183-31DA-45C2-90C3-81609F01B38B}Lounge10001{eac0109e-0090-a992-7fba-dc67fe29e6e7})Is anyone able to provide assistance in how I can read from the REST XML example above the name (ZoneName%) and the attribute value (Westralia and Lounge)?
I need to write an asmx service that takes the xml file as input and also gives an xml as output which are validated using an xsd..
I was trying to read about the services that accept xml inputs and return xml outputs.. but all in vain, I couldn't find a proper tutorial and sample codes to work on..
Can anyone give some links to some nice tutorials and samples with asmx services accepting xml data and returning xml data..
i have designed a web service which would create 2 csv files on the system. I want to send the links to the location of the files as an url attachment over the aspx page.
like : http://myserver/download.aspx?file1=C: empimage1.png&file2=C: empimage2.png
the output from the asmx web service is : [Code]....
where xx.xx.xxx.xxx is the ipaddress. this is the whole output i get from the webservice.
how do i get the aspx page to send the attachment in the format i mentioned above? I have added an asp website to the project and added the webservice as a web reference to this but i do not know how to get the location from the xml output file of the webservice result.
How can we consume a web service using asp.net out put in json formate?
View 1 RepliesFirst off, suggest better ways if you want rather than patch up this code. I am just starting this project and it is first time I have tried to code a web site so anything you suggest is very much welcomed. I have spent the last 2 and 1/2 days trying to find workable answers to this but none I have found and tried seem to fit. If needed I can email screens shots or code. I am trying to construct a website that will have the same main theme throughout as far as the header, navbars sitemap, and footer go. Naturally the content will vary from page to page. I want to use a single master page and css stylesheet for this main theme and I will change the content format as needed per page because each page may vary somewhat.
However, about 15 of the pages will all use the same format for their content and this format will differ from the rest of the site but the format of the main theme will stay the same. So I am trying to create a nested master page to use to format the just the content area for all these pages while retaining the main theme for the header, etc.. I believe I should use a separate css file with the nested master page to handle the formatting of the content areas for these 15 pages. I have code that looks like it works when viewed in web developer but design view but does not work when viewd through a browser (IE, Chrome, Firefox). So far I have the following done in web developer.
If it helps the code and screen shots follow. Master Page called "Parent.master". For all theme throughout site Nested Master Page called "Lab.master". For the 15 like pages Primary stylesheet file for main theme called "StylesheetNew.css" For site theme Secondary stylesheet file to syle the 15 like formatted pages. It is called Labmaster.css Labs.apsx file to use as first of the 15 like pages.
Finally screens shots from web developer and browser. Sorry try as I might I could not capture screenshots and put them into this post. The problem is that web developer shows all the area (many lines high) with gray background and with the XXX text that I want to allocate for content in the 15 pages. Yet all the browser show is one line of text o a white background followed by the footer. It looks like the LabStyleSheet works in Web Developer but not in a browser.
Parent.master
<%@ Master Language="VB" CodeFile="Parent.master.vb" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]">
<head id="ParentHeader" runat="server">
<title>HX5</title>
<asp:ContentPlaceHolder runat="server" id="headerPlaceHolder" />
<link href="~/StyleSheetNew.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="wrapper" >
<div id="Header" >
<table class="hdrtbl1" >
<tr>
<td id="hdrtd1" style="width:175px; height:100px;" >
<img id="logo" alt="Logo" src="../Images/logo.png" style="width: 136px; height: 87px" />
</td>
</tr>
</table >
<table class="hdrtbl2" >
<tr><td id="hdrtbl2td1"><b> Providing Professional Technical, Manangement and Business Solution</b></td></tr>
<tr><td id="hdrtbl2td2"> <b> Services since 2004 </b></td></tr>
<tr> <td id="hdrtbl2td3" align="center" ><img id="rdln" alt="RedLine" style=" height:3px;" src="../Images/RedLine.png" /></td></tr>
<tr><td id="hdrtbl2td4" > <b>Committed to Excellence In All We Do</b></td></tr>
</table>
</div>
<div id="navbardiv">
<ul id="topnav">
<li><a href="../pages/about.aspx" >About Us <img style=" border: none; " src="../Images/arrow-down.gif" /></a>
<!--Subnav Starts Here-->
<span>
<a style="font-weight:lighter; " href="#" >Who We Are </a> |
<a href="#">Locations</a> |
<a href="#">Business Classifications</a> |
<a href="#">Contact Us</a> |
</span>
</li>
<!--Subnav Ends Here-->
<li><a href="../pages/services.aspx">Services <img alt="arrow" style="border: none; " src="../Images/arrow-down.gif" /></a>
<!--Subnav Starts Here-->
<span>
<a style="font-weight:lighter; " href="#" >Capabilities</a> |
</span>
<!--Subnav Ends Here-->
</li>
<li><a href="#">Customers <img style=" border: none; " src="../Images/arrow-down.gif" /></a>
<span>
<a style="font-weight:lighter; " href="#" >Subnav Link</a> |
<a href="#">Customer Locations</a> |
<a href="../pages/labs.aspx">Labs</a> |
</span>
</li>
<li><a href="#">Careers <img style=" border: none; " src="../Images/arrow-down.gif" /></a>
<!--Subnav Starts Here-->
<span>
<a style="font-weight:lighter; " href="#" >Joining the HX5 Team</a> |
<a href="#">Current Opportunities</a> |
</span>
</li>
</ul>
</div>
<div id="subnavbar" >
<!-- <asp:SiteMapPath ID="SiteMapPath" runat="server">
</asp:SiteMapPath> -->
</div>
<div id="topContent" style="border-bottom:solid 1px #191970;">
<table>
<tr><td style="height:30px; width:900px;" >
<asp:ContentPlaceHolder id="TopPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</div>
<!-- <div id="mainContent"> -->
<asp:ContentPlaceHolder id="MainPlaceHolder" runat="server" />
<!-- </div> -->
<!-- <div id="lowerContent"> -->
<asp:ContentPlaceHolder id="LowerPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
<!-- </div> -->
<div id="footerContent" style=" height:50px; width:900px; text-align: right; background-color: #ccc; ">
<span style=" font-family: Arial, Helvetica, sans-serif; font-size: xx-small; font-weight: bold; color: #000080; margin: 30px 20px 0px 0px;"> Copyright 2010 HX5, LLC All rights reserved</span></div>
</div>
</form>
</body>
</html>
i am now think of how to get all the output for all the combination
eg.
given : 1234
output = 1234,1243,2143......and so on.....all 24 possible output
if given : 123
output = all 12 output
if given 12345 , all 120 output...
can someone provide me the algorithm or formula for that ?
I would like to display an output on an external website by including a javascript on that external website.
On my aspx-site i did:
[Code]....
I only get a white page on my external site :(
I'm trying display data from a sqldatasource but I need to customize fonts, sizes and layouts. What would be the best way to do this. There's not much data only 8 rows and 3 cloums.
It's for a display screen that will show workers how much product they have produced.
I was looking at binding the data to lables and laying out the lables in a table but that process looks intense and streching my knowledge.
I have some javascript code that processes json output from asp.net web services built with framework 2.0. Now I need to support data returned from framework 3.5 web services. My javascript code assumes a list of objects as return value, which works fine in 2.0. However In framework 3.5, the list is wrapped in a "d" object. Is there any way I can remove the "d" wrapper and just return the list?
View 1 RepliesHow would I display the following code into a GridView. First, I need the application to write the xml file somewhere on my harddrive and then I need it to read it to populate a gridview.
protected void Page_Load(object sender, EventArgs e)
{
var xmlRequest =
new XElement("GetTicketAction",
new XAttribute(XNamespace.Xmlns + "xsi",[URL] "
new XAttribute(XNamespace.Xmlns + "xsd", "[URL]"),
new XElement("CompanyName", Setup.Company),
new XElement("IntegrationLoginId", Setup.Username ),
new XElement("IntegrationPassword", Setup.Password),
new XElement("SrServiceRecid", Setup.SrServiceRecid))
.ToString();
var proxy = new MyWebService.integration_io();
var xmlResponse = proxy.ProcessClientAction(xmlRequest);
var parsedXmlResponse = XElement.Parse(xmlResponse);......................
I've been given this existing web service [URL] and I need to use the GetQuoteDataSet method to display the dataset in a Grid View control on my aspx page, anyone got any clue as to how I could do this?
View 3 Replies Can a query output made in MS ACCESS be accessed as a database in Visual Studio 2008?
I have a Parent and Child Table in MS Access with a one-to-many relationship. I created a query in Access that would produce a result table and I want the contents of this Query to be displayed in a Data Grid in Visual Studio 2008.
I've tried google up the answer and found none..I just want to load an xml file from anywhere to my webservice and display it..I just know this method:
Copy xml file sctructure,
Loadxml
Return as XmlDocument
response = service.getInfo(request);
How can I display an image while my response object is being populated? Service is a web service located on another server that I have no control over.
Is there a way I can see the list of operations that are exposed by a WCF service same as we can with a asmx service?
View 1 RepliesMy code below
BtnClick
YahooSample();
public void YahooSample()
{
HttpWebRequest request = WebRequest.Create("http://developer.yahoo.com/yui/") as HttpWebRequest;
[Code]....
I am trying to post data from vb.net application to web service asmx that is located on server! For posting data from vb.net application I am using this code:
Public Function Post(ByVal url As String, ByVal data As String) As String
Dim vystup As String = Nothing
Try
'Our postvars
Dim buffer As Byte() = Encoding.ASCII.GetBytes(data)
'Initialisation, we use localhost, change if appliable
Dim WebReq As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
'Our method is post, otherwise the buffer (postvars) would be useless
WebReq.Method = "POST"
'We use form contentType, for the postvars.
WebReq.ContentType = "application/x-www-form-urlencoded"
'The length of the buffer (postvars) is used as contentlength.
WebReq.ContentLength = buffer.Length
'We open a stream for writing the postvars
Dim PostData As Stream = WebReq.GetRequestStream()
'Now we write, and afterwards, we close. Closing is always important!
PostData.Write(buffer, 0, buffer.Length)
PostData.Close()
'Get the response handle, we have no true response yet!
Dim WebResp As HttpWebResponse = DirectCast(WebReq.GetResponse(), HttpWebResponse)
'Let's show some information about the response
Console.WriteLine(WebResp.StatusCode)
Console.WriteLine(WebResp.Server)
'Now, we read the response (the string), and output it.
Dim Answer As Stream = WebResp.GetResponseStream()
Dim _Answer As New StreamReader(Answer)
'Congratulations, you just requested your first POST page, you
'can now start logging into most login forms, with your application
'Or other examples.
vystup = _Answer.ReadToEnd()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return vystup.Trim() & vbLf
End Function
I am building a page with databound list control. For each row I want to display piece of info retrieved from web service call. This could be time demanding so I want to render page first and retrieved additional info asynchronously and in parallel later on. Anyone has some tips how to make it? Just to have a more detailed picture it is a product list in e-shop which I want to render so customers can use it (go to product detail/add goods to shopping cart...) but meantime there will be a placeholder displaying info that informations are retrieving which after completion of call will be replaced by result data.
View 2 RepliesI have a stored procedure that works fine for classic asp, but how can I get my output parameters data back from in /MVC 2 / linq/ entities framework model . I have inported the function also, but when i try to code it i dont get results ...i know this is a matter of lack of / knowledge or exmple because i have been scouring the web for it and cannnot find into that accually works.
here is the stored proc.
[Code]....
Here was the one of the few tries I did:
[Code]....
but it executes fine does not give me an error, but also does not return the info i need to the viewmodel
I keep seeing stuff about "ref" on the net but "ref" shows " arbument # should not be passed with the ref keyword.
So i am not sure if there is a problem with the model, or with my understanding this, Now for your info I can do the same step with returning a dataset from a stored procedure fine, but I dont want a data set I just want excatly the data in the output parameters from the stored procedure.
I have <asp: listbox control in the page and I have binded it with sql table below data
1 India
2 USA
3 China
4 Japan
5 Australia
Selected values 2 or 3, I am inserting in to the tblworld and after inserting when I come back for editing then showing as selected values, here user can changed the selected values. When user selected or deselect the list box checking with the below code as
[Code]....
I am not getting expected output from the above code, get the proper output?
I have a web user control and I want to run it in a page.
but the problem is that I want to have just the out put of user control and not whole HTML page.
I want this because I load the page output in another page and if the first page generates a complete html file, in the second page I have 2 HTML,Head,Body ,..
i'm new to asp i'm doing a simple project registration and login pages but when i'm trying to open them i'm getting a download dialog box and no output i installed IIS for vista?
View 6 RepliesI have asp.net form(index.aspx) with an asp:Button. When I click asp:Button , button method in buttonSubmit.aspx.cs is called and some calculations are done.Now what I want to do is to print the output from "buttonSubmit.aspx.cs" to "index.aspx"
View 3 Replies