Re: WOHTTPConnection & WORequest

2006-07-28 Thread David Griffith

Interesting, thanks!

Dave.
On 28 Jul 2006, at 14:50, Alex Cone wrote:

just do a GET style form submit:  formAction?arg1=foo&arg2=bar -  
This is like submitting a form whose action is formAction, with two  
fields named arg1 and arg2 with values in those fields of foo and bar.


don't forget to urlEncode if you have spaces or special characters

for more complex stuff, use /Developer/Examples/TCPMonitor.  You  
can capture the content of the form submission from a web browser  
to see exactly how it is composed...


abc

On Jul 28, 2006, at 4:09 AM, David Griffith wrote:

Thanks, I had actually figured out that much, the problem is how  
to specify the form values in the request that is sent...  The  
'content' part is the bit I can't figure out.


Regards,
David.

On 27 Jul 2006, at 20:00, Alex Cone wrote:



On Jul 27, 2006, at 12:44 PM, webobjects-dev- 
[EMAIL PROTECTED] wrote:



Subject: Re: WOHTTPConnection & WORequest
To: "Jerry W. Walker" <[EMAIL PROTECTED]>

Hi Jerry,

Well, I have no control over the other website.  What I need to  
do is

this:

In my own WO App, I have a page which displays some information  
from

the database about a domain name and who it is associated with.



Before you guys get too carried away...

sounds like what you want to do is submit a "GET" style form  
request like:


http://www.someDomain.com/doSomething?arg1=foo&arg2=bar

trivial example off the top of my head...

public String sendUrlToHostOnPort(String urlString, String host,  
int port) {

NSData content = null;

WOHTTPConnection connection = new WOHTTPConnection(host,  
port));
NSDictionary headers = new NSDictionary(new Object[]  
{"text/html", "text/html"},
new Object[]  
{"Accept", "Content-Type"});
WORequest request = new WORequest("GET", urlString,   
"HTTP/1.0", headers, content, null);


connection.sendRequest(request);
WOResponse response = connection.readResponse();

if (response == null) {
System.out.println("WOResponse object is null");
return null;
}

NSData contentData = = response.content();
if (contentData == null) {
System.out.println("No content in the WOResponse  
object");

return null;
}

   return new String(contentData.bytes(0, contentData.length 
()));

}


HTH!

abc

__alex cone
ceo  c o d e f a b  inc
[EMAIL PROTECTED]
212.465.8484 x101
http://www.codefab.com

If you are not living on the edge, you are taking up too much space.



___
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/david% 
40infinityspain.com


This email sent to [EMAIL PROTECTED]










___
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


Re: WOHTTPConnection & WORequest

2006-07-28 Thread Robert Walker
David,If you are interested send me a request "off-list" and I can provide you with example code that does exactly what your are trying to do.  My sample code uses some Apache commons libraries, to make it more flexible, and to provide support for submitting the request to secured (SSL, TLS) forms.On Jul 27, 2006, at 12:43 PM, David Griffith wrote:Hi Jerry,Well, I have no control over the other website.  What I need to do is this:In my own WO App, I have a page which displays some information from the database about a domain name and who it is associated with.I would like to have a button on that page that can be clicked which will then send a request to the 3rd party web site (which is just a standard website).  I want to submit a form to it as if I had gone to the page, entered my details in the form and clicked submit.  Except I don't want to manually enter my details, I want to submit the form without going to the actual webpage itself (so effectively I want to create a page that emulates the actual page on that webserver and submit it with form values filled in already (rather than anyone having to manually enter them).Obviously that webserver will return a normal HTTP response page (HTML page) which is the page that I want to get back to my original WO App whereupon I will parse it for the information I need and place that information on my WOComponent as necessary.I have done this with another programming tool in the past and built Google's language tools into my own application.  I am trying to do something similar with WebObjects but just can't find the correct way to do it.  Perhaps WebServices is what I need.  I will look into it further.To give a more step-by-step idea of what I am trying to do:User looks up a record in my app which contains a variable called 'domainname'.They click the button that says 'Lookup'.My WOApp then needs to generate  a HTML form that can be submitted with some form field values to a URL that I specify, but with no user interaction of any kind.I need to get the response page (HTML) from that URL back into my WO App.From there I have no problem as I can parse it and get the info I need.Regards,David.On 27 Jul 2006, at 17:55, Jerry W. Walker wrote: 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      ...      SubmitButtonIf 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 prob

Re: WOHTTPConnection & WORequest

2006-07-28 Thread Alex Cone
just do a GET style form submit:  formAction?arg1=foo&arg2=bar - This  
is like submitting a form whose action is formAction, with two fields  
named arg1 and arg2 with values in those fields of foo and bar.


don't forget to urlEncode if you have spaces or special characters

for more complex stuff, use /Developer/Examples/TCPMonitor.  You can  
capture the content of the form submission from a web browser to see  
exactly how it is composed...


abc

On Jul 28, 2006, at 4:09 AM, David Griffith wrote:

Thanks, I had actually figured out that much, the problem is how to  
specify the form values in the request that is sent...  The  
'content' part is the bit I can't figure out.


Regards,
David.

On 27 Jul 2006, at 20:00, Alex Cone wrote:



On Jul 27, 2006, at 12:44 PM, webobjects-dev- 
[EMAIL PROTECTED] wrote:



Subject: Re: WOHTTPConnection & WORequest
To: "Jerry W. Walker" <[EMAIL PROTECTED]>

Hi Jerry,

Well, I have no control over the other website.  What I need to  
do is

this:

In my own WO App, I have a page which displays some information from
the database about a domain name and who it is associated with.



Before you guys get too carried away...

sounds like what you want to do is submit a "GET" style form  
request like:


http://www.someDomain.com/doSomething?arg1=foo&arg2=bar

trivial example off the top of my head...

public String sendUrlToHostOnPort(String urlString, String host,  
int port) {

NSData content = null;

WOHTTPConnection connection = new WOHTTPConnection(host,  
port));
NSDictionary headers = new NSDictionary(new Object[]  
{"text/html", "text/html"},
new Object[]  
{"Accept", "Content-Type"});
WORequest request = new WORequest("GET", urlString,  "HTTP/ 
1.0", headers, content, null);


connection.sendRequest(request);
WOResponse response = connection.readResponse();

if (response == null) {
System.out.println("WOResponse object is null");
return null;
}

NSData contentData = = response.content();
if (contentData == null) {
System.out.println("No content in the WOResponse  
object");

return null;
}

   return new String(contentData.bytes(0, contentData.length()));
}


HTH!

abc

__alex cone
ceo  c o d e f a b  inc
[EMAIL PROTECTED]
212.465.8484 x101
http://www.codefab.com

If you are not living on the edge, you are taking up too much space.



___
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/david% 
40infinityspain.com


This email sent to [EMAIL PROTECTED]






___
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


Re: WOHTTPConnection & WORequest

2006-07-28 Thread David Griffith
Great, sounds like the same idea as Robert... I'll look into it and  
hopefully have success!  Thanks for all the helpful replies..


Regards,
David.

On 27 Jul 2006, at 21:25, Kieran Kelleher wrote:


David,

I use Apache's HttpClient class for this. Here is an old article I  
wrote on it:
http://homepage.mac.com/kelleherk/iblog/C149402102/E773353034/ 
index.html


HTH,

Kieran


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 :-)


Thanks for any help,

Regards,
David.
___
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/kieran_lists% 
40mac.com


This email sent to [EMAIL PROTECTED]






___
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


Re: WOHTTPConnection & WORequest

2006-07-28 Thread David Griffith
Thanks, I had actually figured out that much, the problem is how to  
specify the form values in the request that is sent...  The 'content'  
part is the bit I can't figure out.


Regards,
David.

On 27 Jul 2006, at 20:00, Alex Cone wrote:



On Jul 27, 2006, at 12:44 PM, webobjects-dev- 
[EMAIL PROTECTED] wrote:



Subject: Re: WOHTTPConnection & WORequest
To: "Jerry W. Walker" <[EMAIL PROTECTED]>

Hi Jerry,

Well, I have no control over the other website.  What I need to do is
this:

In my own WO App, I have a page which displays some information from
the database about a domain name and who it is associated with.



Before you guys get too carried away...

sounds like what you want to do is submit a "GET" style form  
request like:


http://www.someDomain.com/doSomething?arg1=foo&arg2=bar

trivial example off the top of my head...

public String sendUrlToHostOnPort(String urlString, String host,  
int port) {

NSData content = null;

WOHTTPConnection connection = new WOHTTPConnection(host,  
port));
NSDictionary headers = new NSDictionary(new Object[] {"text/ 
html", "text/html"},
new Object[]  
{"Accept", "Content-Type"});
WORequest request = new WORequest("GET", urlString,  "HTTP/ 
1.0", headers, content, null);


connection.sendRequest(request);
WOResponse response = connection.readResponse();

if (response == null) {
System.out.println("WOResponse object is null");
return null;
}

NSData contentData = = response.content();
if (contentData == null) {
System.out.println("No content in the WOResponse object");
return null;
}

   return new String(contentData.bytes(0, contentData.length()));
}


HTH!

abc

__alex cone
ceo  c o d e f a b  inc
[EMAIL PROTECTED]
212.465.8484 x101
http://www.codefab.com

If you are not living on the edge, you are taking up too much space.



___
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/david% 
40infinityspain.com


This email sent to [EMAIL PROTECTED]




___
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


Re: WOHTTPConnection & WORequest

2006-07-27 Thread Kieran Kelleher

David,

I use Apache's HttpClient class for this. Here is an old article I  
wrote on it:

http://homepage.mac.com/kelleherk/iblog/C149402102/E773353034/index.html

HTH,

Kieran


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 :-)


Thanks for any help,

Regards,
David.
___
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/kieran_lists% 
40mac.com


This email sent to [EMAIL PROTECTED]


___
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


Re: WOHTTPConnection & WORequest

2006-07-27 Thread Alex Cone


On Jul 27, 2006, at 12:44 PM, [EMAIL PROTECTED]  
wrote:



Subject: Re: WOHTTPConnection & WORequest
To: "Jerry W. Walker" <[EMAIL PROTECTED]>

Hi Jerry,

Well, I have no control over the other website.  What I need to do is
this:

In my own WO App, I have a page which displays some information from
the database about a domain name and who it is associated with.



Before you guys get too carried away...

sounds like what you want to do is submit a "GET" style form request  
like:


http://www.someDomain.com/doSomething?arg1=foo&arg2=bar

trivial example off the top of my head...

public String sendUrlToHostOnPort(String urlString, String host, int  
port) {

NSData content = null;

WOHTTPConnection connection = new WOHTTPConnection(host,  
port));
NSDictionary headers = new NSDictionary(new Object[] {"text/ 
html", "text/html"},
new Object[]  
{"Accept", "Content-Type"});
WORequest request = new WORequest("GET", urlString,  "HTTP/ 
1.0", headers, content, null);


connection.sendRequest(request);
WOResponse response = connection.readResponse();

if (response == null) {
System.out.println("WOResponse object is null");
return null;
}

NSData contentData = = response.content();
if (contentData == null) {
System.out.println("No content in the WOResponse object");
return null;
}

   return new String(contentData.bytes(0, contentData.length()));
}


HTH!

abc

__alex cone
ceo  c o d e f a b  inc
[EMAIL PROTECTED]
212.465.8484 x101
http://www.codefab.com

If you are not living on the edge, you are taking up too much space.



___
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


Re: WOHTTPConnection & WORequest

2006-07-27 Thread Jerry W. Walker

Hi, David,

From the responses to your last post to this list, it sounds like  
Robert Walker has what you're looking for. I'll back out of the loop  
unless his code isn't what you're looking for. Though, since he's  
from the Walker clan, I don't see how it could fail to satisfy.  :-)


Regards,
Jerry (the other Walker)

On Jul 27, 2006, at 12:43 PM, David Griffith wrote:


Hi Jerry,

Well, I have no control over the other website.  What I need to do  
is this:


In my own WO App, I have a page which displays some information  
from the database about a domain name and who it is associated with.


I would like to have a button on that page that can be clicked  
which will then send a request to the 3rd party web site (which is  
just a standard website).  I want to submit a form to it as if I  
had gone to the page, entered my details in the form and clicked  
submit.  Except I don't want to manually enter my details, I want  
to submit the form without going to the actual webpage itself (so  
effectively I want to create a page that emulates the actual page  
on that webserver and submit it with form values filled in already  
(rather than anyone having to manually enter them).


Obviously that webserver will return a normal HTTP response page  
(HTML page) which is the page that I want to get back to my  
original WO App whereupon I will parse it for the information I  
need and place that information on my WOComponent as necessary.


I have done this with another programming tool in the past and  
built Google's language tools into my own application.  I am trying  
to do something similar with WebObjects but just can't find the  
correct way to do it.  Perhaps WebServices is what I need.  I will  
look into it further.


To give a more step-by-step idea of what I am trying to do:

User looks up a record in my app which contains a variable called  
'domainname'.


They click the button that says 'Lookup'.

My WOApp then needs to generate  a HTML form that can be submitted  
with some form field values to a URL that I specify, but with no  
user interaction of any kind.


I need to get the response page (HTML) from that URL back into my  
WO App.


From there I have no problem as I can parse it and get the info I  
need.


Regards,
David.

On 27 Jul 2006, at 17:55, Jerry W. Walker wrote:


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'

Re: WOHTTPConnection & WORequest

2006-07-27 Thread Robert Walker
David,If you are interested send me a request "off-list" and I can provide you with example code that does exactly what your are trying to do.  My sample code uses some Apache commons libraries, to make it more flexible, and to provide support for submitting the request to secured (SSL, TLS) forms.--Robert Walker[EMAIL PROTECTED]  ___
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

Re: WOHTTPConnection & WORequest

2006-07-27 Thread Patrick Middleton


On 27 Jul 2006, at 17:43, David Griffith wrote:


Hi Jerry,

Well, I have no control over the other website.  What I need to do  
is this:


In my own WO App, I have a page which displays some information  
from the database about a domain name and who it is associated with.


I would like to have a button on that page that can be clicked  
which will then send a request to the 3rd party web site (which is  
just a standard website).  I want to submit a form to it as if I  
had gone to the page, entered my details in the form and clicked  
submit.  Except I don't want to manually enter my details, I want  
to submit the form without going to the actual webpage itself (so  
effectively I want to create a page that emulates the actual page  
on that webserver and submit it with form values filled in already  
(rather than anyone having to manually enter them).


Obviously that webserver will return a normal HTTP response page  
(HTML page) which is the page that I want to get back to my  
original WO App whereupon I will parse it for the information I  
need and place that information on my WOComponent as necessary.


I have done this with another programming tool in the past and  
built Google's language tools into my own application.  I am trying  
to do something similar with WebObjects but just can't find the  
correct way to do it.  Perhaps WebServices is what I need.  I will  
look into it further.


To give a more step-by-step idea of what I am trying to do:

User looks up a record in my app which contains a variable called  
'domainname'.


They click the button that says 'Lookup'.

My WOApp then needs to generate  a HTML form that can be submitted  
with some form field values to a URL that I specify, but with no  
user interaction of any kind.


I need to get the response page (HTML) from that URL back into my  
WO App.


From there I have no problem as I can parse it and get the info I  
need.


Regards,
David.


Of course, if you were really devious, you could adapt AJAX  
technology to do what you need.


http://developer.apple.com/internet/webcontent/xmlhttpreq.html

'domainname' -- are you by chance getting someone to type in their  
email address, and then trying to validate an MX record to see if  
it's real or not?



---
Regards Patrick
OneStep Solutions Plc
www.onestep.co.uk

___
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


Re: WOHTTPConnection & WORequest

2006-07-27 Thread David Griffith

Hi Jerry,

Well, I have no control over the other website.  What I need to do is  
this:


In my own WO App, I have a page which displays some information from  
the database about a domain name and who it is associated with.


I would like to have a button on that page that can be clicked which  
will then send a request to the 3rd party web site (which is just a  
standard website).  I want to submit a form to it as if I had gone to  
the page, entered my details in the form and clicked submit.  Except  
I don't want to manually enter my details, I want to submit the form  
without going to the actual webpage itself (so effectively I want to  
create a page that emulates the actual page on that webserver and  
submit it with form values filled in already (rather than anyone  
having to manually enter them).


Obviously that webserver will return a normal HTTP response page  
(HTML page) which is the page that I want to get back to my original  
WO App whereupon I will parse it for the information I need and place  
that information on my WOComponent as necessary.


I have done this with another programming tool in the past and built  
Google's language tools into my own application.  I am trying to do  
something similar with WebObjects but just can't find the correct way  
to do it.  Perhaps WebServices is what I need.  I will look into it  
further.


To give a more step-by-step idea of what I am trying to do:

User looks up a record in my app which contains a variable called  
'domainname'.


They click the button that says 'Lookup'.

My WOApp then needs to generate  a HTML form that can be submitted  
with some form field values to a URL that I specify, but with no user  
interaction of any kind.


I need to get the response page (HTML) from that URL back into my WO  
App.


From there I have no problem as I can parse it and get the info I need.

Regards,
David.

On 27 Jul 2006, at 17:55, Jerry W. Walker wrote:


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  

Re: WOHTTPConnection & WORequest

2006-07-27 Thread Jerry W. Walker

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 eleme

Re: WOHTTPConnection & WORequest

2006-07-27 Thread David Griffith

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-ena

Re: WOHTTPConnection & WORequest

2006-07-27 Thread Jerry W. Walker

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-4085office



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Uns

Re: WOHTTPConnection & WORequest

2006-07-27 Thread David Griffith

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/archive%40mail-archive.com

This email sent to archive@mail-archive.com


Re: WOHTTPConnection & WORequest

2006-07-27 Thread Paul Suh

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






smime.p7s
Description: S/MIME cryptographic signature
 ___
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

WOHTTPConnection & WORequest

2006-07-27 Thread David Griffith

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 :-)


Thanks for any help,

Regards,
David.
___
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