Hi, David,

Whew! If I understand you correctly, I'm not sure that's doable, and if it is, would require a greater network knowledge than my own. So, here's your requirement as I infer it:

From a WebObjects application at www.xxx.com, you created and sent out a response to John Smith's browser with the following page:

WOComponent
   Form
      Field1
      Field2
      Field3
      Field4
      ...
      SubmitButton

If Field3 contains a domain name that John Smith entered into the form, say "www.yyy.com", you want the browser containing the above page to send the form values from that page as a standard HTTP request to www.yyy.com rather than back to your WOApp.

You want some application there (a WO app?) to parse the request from John Smith's browser for its form values, and to generate a response that it will somehow smush into a pseudo-request containing the form values (or some transformation of them) which it will send directly to your WOApp at www.xxx.com.

Your WOApp (the one which generated the original page to which John Smith is responding) will accept this pseudo-request from www.yyy.com, parse the form values therein and send its response back, not to www.yyy.com, but to John Smith's browser as if it were responding to the request the browser sent to www.yyy.com.

I'm presuming that you have some control over the application at www.yyy.com, else how would you get it to take a request from John Smith's browser and return its response to your app?

If this is a reasonable interpretation of your requirement, then, if it's doable at all, it's solution will require a grievous distortion of the standard HTTP network protocols on the part two web applications and some JavaScript hacking (in the page you originally sent out) on John Smith's web browser.

Again, if this is your requirement, may I suggest an alternative approach which will avoid all these distortions?

I suggest that the form be returned to your original WOApp (as every party in this chain expects), and that your WOApp engage in a Web Services transaction with the application at www.yyy.com to send the form values and obtain its parsing services before returning the expected response to John Smith's browser. Web Services is set up for exactly this kind of interaction.

If you have no control over the application at www.yyy.com, and it will only respond to HTTP requests containing standard HTML forms, it's possible to jimmy up what Web Services can send out from your WOApp to look like an HTTP request, but I'm not sure how you would get your WOApp to accept it's response. I'm not that much of a Web Services guru.

If you have the control over the two web apps to use this approach, it would work with network protocols appropriately rather than trying to violate them, and would probably provide you with a good deal more flexibility in your parsing and response. Additionally, down the line, when the requirements change, you can address the changed requirements immediately within the architecture rather than taking a long backwards step to figure out what the H*** was going on here between this browser and these two systems before even looking at the changes requested. And if you're not the one making the changes, you might save your own skin from the enmity of the programmer who follows you into this mine field.

Sorry I couldn't provide more direct help to your question.

Regards,
Jerry


On Jul 27, 2006, at 10:40 AM, David Griffith wrote:

Hi Jerry,

Thanks for the detailed response. Actually I am already aware of all of this and no I don't find the answer patronising as it is great to see someone answer any question in such detail!

However, what I am trying to do is this:

On a WOComponent that already exists and contains a domain name in one of the form fields, I want to have a button that when clicked will take the domain name from the existing field (or variable) on the WOComponent, construct a page that can be submitted transparently to another server (not the WO server) and receive a response from that server which I can then parse and display the relevant pieces of information on the original WOComponent.

Kind regards,
David.


On 27 Jul 2006, at 16:00, Jerry W. Walker wrote:

Hi, David,

Are you asking how to submit a form to a WOApplication from one of its WOComponents? Or are you asking for something much more involved?

If your question is the former, then do the following:

  * Create a WOForm in your WOComponent.

* Embed all the WOForm elements that take form values (WOTextField, WOTextArea, WOCheckBox, etc.) within that form along with at least one WOSubmitButton or WOImageButton. This is most easily done using WebObjects Builder.

* If you are using multiple submit and/or image buttons, be sure to set the multipleSubmit binding on your WOForm to true.

* Bind each of your WOForm elements to keys (iVar or method names) in your WOComponent's Java file.

* Bind each of your submit and/or image buttons to an action method in your Java file (a method that takes no arguments and returns a WOComponent value representing the page you want displayed when that button is clicked).

  * Vend the page (WOComponent containing your WOForm).

When the user fills out your form fields and clicks on the submit button, the browser sends the page with an HTML POST request. The WOAdaptor turns the HTML request into a WORequest and sends it to your application in the first two of the following three messages of the Request/Response cycle:

* takeValuesFromRequest - which WO uses to extract the values from any of the form elements (contained in the form that also contains the button that was clicked) and automatically inserts them into the bound elements of your code.

* invokeAction - which WO uses to identify the submit button element that was clicked and messages the action method which you've bound to that submit button.

* appendToResponse - which WO uses to build a WOResponse that the WOAdaptor translates into HTML and sends out through the web server to render the next page.

The next page is determined by which page your action method returns. You can put anything you want on that next page, including only the values of the form elements of the previous page containing the WOForm.

All of this automatic behavior is built into WO and you don't have to do anything explicit like creating a WOHTTPConnection or a WORequest. These are done for you. If this answers your question, then I strongly urge you to go through the WO tutorials and introductory material, otherwise you will end up misusing WO and hating it.

If you are asking for something much more sophisticated than that (like sending the page to a different server dynamically chosen at the time the button is clicked, or something), then you will have to be much more explicit about what you're trying to do when you ask the question.

I hope that you didn't find the above information patronizing, but if yours was a simple question, then that should answer it without another round of "What are you really trying to do?" If it wasn't a simple question, hit us again.

Regards,
Jerry

On Jul 27, 2006, at 9:29 AM, David Griffith wrote:

Hi Paul,

Because ultimately I will be submitting values that are already part of the WO app and will be parsing the response to get the various values I need. I do not want the user to see the actual response page, only the pieces that I will extract from the response.

Kind regards,
David.

On 27 Jul 2006, at 14:50, Paul Suh wrote:

On Jul 27, 2006, at 7:36 AM, David Griffith wrote:
Hi all,

I want to allow a user to enter details into a HTML Form (in a WOComponent) and when they click the Submit button, I would like to open a connection to a standard HTTP server with a specific URL and pass it the form values that the user entered. Can someone tell me an easy way to do this? I can create the WOHTTPConnection but I think I need a WORequest to send to it and I can't figure out how to get the form values into that request. It's probably easy I'm sure :-)

David,

Stupid question, but is there a particular reason why you need to send it through your WO app? Why not point your form's URL straight to the other HTTP server?


--Paul


Paul Suh http://www.ps-enable.com/
[EMAIL PROTECTED]                           (240) 672-4212





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jerrywwalker %40gmail.com

This email sent to [EMAIL PROTECTED]


--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems

    [EMAIL PROTECTED]
    203 278-4085        office








--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems

    [EMAIL PROTECTED]
    203 278-4085        office



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to