|
Hi,
I have created a SOAP Web Service client (as a proxy class). I am able to successfully send and receive a SOAP message to the SOAP Server. Here's where my hickup is though: when i receive back the response from the SOAP server, I can access most of its elements but the one called "errors". Here's the raw XML that is sent from the soap server:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<pxb2b:register-user-reply xmlns:pxb2b="something">
<pxb2b:datetime>2010-03-31T18:08:55.938</pxb2b:datetime>
<pxb2b:px-transaction-id>0</pxb2b:px-transaction-id>
<pxb2b:response-code>400</pxb2b:response-code>
<pxb2b:errors>
<pxb2b:error code="already_registered" field="error">This card is already registered</pxb2b:error>
</pxb2b:errors>
</pxb2b:register-user-reply>
</soap-env:Body>
</soap-env:Envelope>
Here's how I try to do it:
First I get the response object (which is part of the proxy class)
Dim pxRegUserReply As registeruserreply
pxRegUserReply = pxRegUserBinding.registeruser(pxRegUserRequest)
Through this pxRegUserReply object I can access all of the XML elements, e.g. pxRegUserReply.responsecode, pxRegUserReply.pxtransactionid and so on.
The problem is that when i try to do this pxRegUserReply.errors, I get a zero length element.
and pxRegUserReply.errors.Length returns 0.
Can somebody explain what I am doing wrong? I am kinda new to VB, so it may be something very simple.
Thank you for your input!
|
|
|
|
|
Hello,
I am just fresh new learner of Test Driven Development in ASP.NET with Visual Studio 2008. So far everything looks ok, but I have a question regarding the following snippet:
[TestMethod]
[HostType("ASP.NET")]
[UrlToTest("http://localhost:49161/Default.aspx?demoParam=Hello")]
[AspNetDevelopmentServerHost(@"D:\My Projects\AspNetTDD1\AspNetTDD1", "/AspNetTDD1")]
public void CheckQueryStringParsingAtLoad()
{
Page page = TestContext.RequestedPage;
PrivateObject po = new PrivateObject(page);
po.Invoke("Page_Load", page, EventArgs.Empty);
Label label = page.FindControl("Label1") as Label;
if (label != null)
Assert.AreEqual("Hello", label.Text);
}
As you can see, the port number 49161 after the localhost, it changes every time I build the application or if I restart the server. So, if I have 100 test cases, I will have to change the url to every method every time it changes. Is not there any other way to set that url programmatically ? Also, I have a complain about the attribute AspNetDevelopmentServerHost. Why should I Hard Code the path to the application folder ? I want it to be portable so that I can change the folder structure any time? So, I would like to set that Application folder programmatically too.
Can you give me any idea please ?
Regards
|
|
|
|
|
I haven't used it, but I think you should use test run configuration file[^]. It allows you to specify all the settings rather than using attributes and hard coding it.
BTW, what are you testing in the example provided? Just verifying a label exist?
Best wishes,
Navaneeth
|
|
|
|
|
Hi,
Thanks for the reply. Looks like, I need to read a lot to set the attribute dynamically. I have no idea why Microsoft made it so hard. I found another library named, NUnitASP which could allow me to do test driven development where I can set the url dynamically. but unfortunately, the library is so old, it does not work anymore, but Microsoft can learn from this small open source library.. it is frustrating anyway.
By the way, I was testing a label value shows an expected value after a button click. Yeah, it is a simple test for demonstration.
|
|
|
|
|
In TDD, views are usually not tested as you test other parts. You have to create your view as thin as possible. This will allow you to test all other business logic totally isolated from view and view will have just few getters and setters. Read up on patterns like MVP to know more about doing so.
Just a word of warning
BTW, all these TDD concepts has got a tendency to trap you into excessive layering and abstractions. You will end up with creating new abstractions just for the sake of testing it and the output will be code which is tough to debug and will have full of obscure bugs. Finding a balance between what to test and what not to test is bit tough and can be learned from practice. So I'd suggest you to maintain simplicity and avoid unnecessary abstractions just for testing.
Best wishes,
Navaneeth
|
|
|
|
|
Hi Navaneeth,
Yes, thats what I see. In order to test, I need to add many layers of complexity. Maybe we need to switch to ASP.NET MVC. But, so far I found in MVC, I will have to forget the Designer, rather I will have to use a bunch of HtmlHelper static methods to generate my page. What a yakeee idea. To my point of view, a Website is really UI driven. I like to use ASP.NET Controls in Design time, add property values and handle Events from the VS designer. Anyway, my brain is getting cluttered with so many technology clumsiness I think, within next few years, ASP.NET MVC will have much designer support and I am jealous with those developers who will start learning ASP.NET at that time and get readymade stuffs
|
|
|
|
|
Emran Hussain wrote: I found another library named, NUnitASP which could allow me to do test driven development where I can set the url dynamically. but unfortunately, the library is so old, it does not work anymore
Try WatiN[^]instead.
If you want to get going quickly I would also download WatiN Test Recorder. The latter is a bit buggy but it's good for giving you a rough starting point. Plus you should combine with IE dev tools. to get control IDs.
Although Watin 1.0 has been out for ages and Watin 2 has been in beta for ages the mailing list is very active and very responsive. WatiN is a solid library.
Selenium[^]is another possibility but I've not tried it.
Kevin
|
|
|
|
|
Emran Hussain wrote: As you can see, the port number 49161 after the localhost, it changes every time I build the application
Have a look at the ASP.NET project properties. There's a setting for fixing the port number.
Kevin
|
|
|
|
|
Hi.
How can I create virtual subdomain with asp.net 1.1?
for exmaple I want convert : http://www.dirtourist.com/User/index.aspx?Uid=1004 To http://www.Hakhamanesh.dirtourist.com
|
|
|
|
|
HI i have successfully created a connection string
and the rest of the commands are as follows
Dim cmd As New SqlCommand(sql, SQLConn)
cmd.Connection.Open()
Repeater1.DataSource = cmd.ExecuteReader()
Repeater1.DataBind()
cmd.Connection.Close()
The above code works fine..
My doubt is that how to i get to store all rows of a column returned by a Repeater in a session variable....
Can do tht using a SQldatareader as:
Session("SessionName")=readerobj("uid")
|
|
|
|
|
lionelcyril wrote: My doubt is that how to i get to store all rows of a column returned by a Repeater
Repeater doesn't have rows or columns.
lionelcyril wrote: Can do tht using a SQldatareader as:
Session("SessionName")=readerobj("uid")
What are you trying to achieve? Why do you want to keep the repeater generated code in session? Are you trying to do some sort of caching?
Best wishes,
Navaneeth
|
|
|
|
|
I figured out another way...
i wanted to store a particular value from a database column into a session variable..
Anyways thanks..
|
|
|
|
|
Hi... im trying to emulate a simple captcha control. I wanted to distort a text generated by Graphics.DrawText() method. Or is there a better way to make this? Thanks a lot.
|
|
|
|
|
Rue Leonheart wrote: is there a better way to make this?
Without using GDI+? I don't think so.
Best wishes,
Navaneeth
|
|
|
|
|
|
Can you post me a link for a tutorial on how to use scripts in an ASP.NET page? Thanks for the help.
|
|
|
|
|
I have not used that specific captcha technique I mentioned, but I do use ImageMagick (IM) with ASP.NET. I have a pretty basic article on COde Project about generating previews from uploaded images with IM, Using ImageMagick to Create Previews and Thumbnails from Uploaded Images[^]. This is similar to what you are trying to do by creating a dynamic image and return it to the browser. The key method is CallImageMagick(string fileArgs) . You pass your argument, such as the captcha command, which defines the distortions and the output path of the file. The random string used to create the captcha using IM would be stored and used to verify the user response to the captcha challenge.
IM is easy to download and install. The latest update which I just installed on our server was "ImageMagick-6.6.0-7-Q16-windows-dll.exe". Make sure to check the last install option - "Install ImageMagickObject OLE Control...", so that MagickCMD.exe will be installed. You will need to provide the path to this file in your code; see my article.
There are several other good articles on CodeProject about using IM with ASP.NET. That is where I learned about it.
Regards,
Gary
|
|
|
|
|
i've databound a gridview through configure datasource wizard....but i'm unable to re-bind it through that wizard only.....can anyone tell me how can we rebind gridview using configure datasource wizard or using any other method except writing code in .cs file???
|
|
|
|
|
Please help me with this assignment.
Use ASP.NET to write a web page with a form for ordering pizza. When loaded, the page should appear as shown in appendix 1. To avoid clutter, use only 3 options for each select element (for example, use only months 07, 08, and 09 for the expiry date). Be sure to preserve alignment of items. The Submit button sends all the user inputs to URL http://www.pizzapronto.com/orders. The Reset button resets the form.
Appendix 1
Your browser may not support display of this image.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<!— Put your code here ………… -->
</html>
|
|
|
|
|
We're not here to do your homework for you. If you can't even manage this then you've picked the wrong course/degree/career.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
www.rentacoder.com, this is what you want
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
hi all......
i've created a page and want user to select some buttons....now i want that if one user selects some of the buttons that those buttons should be disabled for rest of the users till the person clicks on submit buuton on the next page.....if he cancels his selection from there than those buttons should become enabled for other users.
can anyone guide me what to do???
|
|
|
|
|
hi iam using asp.net with c#
in my gridview 1st column is checkbox control
select productname price quantity total
() rose 124 6 124*6
() biscuits 345 89 345*89
() choclate 670 45 670*45
=======
when user click next button then which ever row is checked then data is transfer to other page and displayed in gridview
please can you give some example for this ...
|
|
|
|
|
Hi, you can create a temp table to insert the Selected Rows and when you redirect to the other page
select thoses rows for Db and put them in the datatable to be a datasource for the GridView.
Good luck
|
|
|
|
|
You can maintain the data in DataTable or Collection. Assign the values to the Session object and retrieve it in the next page.
|
|
|
|