CURLing orbeon

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

CURLing orbeon

Colin Seaman
Hi,

I'm running a PHP app on one server and Orbeon on a seperate Tomcat
server (port 8080).  I'm trying to use CURL to request an XFORM from the
Orbeon server and have it work as if it was running directly on the
server.  Receiving the XFORM back is fine, and everything looks right in
the page (I set the base url in the HTML header to that of the Orbeon
server).

When I try to use the XForm however I get the message "Unexpected
response received from server" appear as a standard XForm error message.

Are there any other parameters I need to change on Orbeon to get this
route working?

FYI, my PHP code is:

function convert_body($string)
{
    $string = str_replace("<html>",'<html><base
href="http://myserver.com:8080">',$string);
    return $string;
}

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,
"http://myserver.com:8080/ops/goto-example/xforms-todo");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);

curl_close ($ch);

echo convert_body($result);

--
Colin Seaman
Senior Developer
 
Tradocs Ltd,
Tower Point,
44 North Road,
Brighton,
BN1 1YR

email:     [hidden email]
telephone: 0870-1417031
website:   http://www.tradocs.net

This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom they are addressed. If you have received this email in
error please contact Tradocs. Please note that any views or
opinions presented in this email are solely those of the author
and do not necessarily represent those of the company. Finally,
the recipient should check this email and any attachments for
the presence of viruses. The company accepts no liability for
any damage caused by any virus transmitted by this email.
This content of this email is without prejudice.




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: CURLing orbeon

Erik Bruchez
Administrator
Colin,

I doubt changing <base> will do much for anything besides static links
in HTML. The error you are seeing probably means that an Ajax request
failed to contact the server, probably because it was attempted to the
wrong URL. Currently, the JS code naively looks at the URL of the first
script loaded (I think) to determine the URL of the XForms server (the
target of the Ajax requests).

We have a bug entered about doing this better:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=305808&group_id=168&atid=350207

When that is fixed, you should be able to rewrite that more easily. In
the meanwhile, instead or in addition to <base>, you may want to try to
rewrite the script URLs.

-Erik

Colin Seaman wrote:

> Hi,
>
> I'm running a PHP app on one server and Orbeon on a seperate Tomcat
> server (port 8080).  I'm trying to use CURL to request an XFORM from the
> Orbeon server and have it work as if it was running directly on the
> server.  Receiving the XFORM back is fine, and everything looks right in
> the page (I set the base url in the HTML header to that of the Orbeon
> server).
>
> When I try to use the XForm however I get the message "Unexpected
> response received from server" appear as a standard XForm error message.
>
> Are there any other parameters I need to change on Orbeon to get this
> route working?
>
> FYI, my PHP code is:
>
> function convert_body($string)
> {
>    $string = str_replace("<html>",'<html><base
> href="http://myserver.com:8080">',$string);
>    return $string;
> }
>
> $ch = curl_init();
> curl_setopt ($ch, CURLOPT_URL,
> "http://myserver.com:8080/ops/goto-example/xforms-todo");
> curl_setopt ($ch, CURLOPT_HEADER, 0);
> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
> $result = curl_exec ($ch);
>
> curl_close ($ch);
>
> echo convert_body($result);
--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: CURLing orbeon

Colin Seaman
Hi Guys,

If anyone's ineterested...

We've finally managed to deploy a sufficient proxy implementation of Orbeon.  This allows us to use our PHP server (apache) to serve our app, and keep Orbeon running on it's own separate server to manage our XFORMS (apache tomcat port 8080).

This allows us to mask the Orbeon server from the address bar (and code) but keep the full functionality of Orbeon (ie: real time XFORMS).

To do this we:
created a .htaccess file and put it in our root of our PHP app server.  The contents is as follow:
RewriteEngine on
RewriteRule ^call/(.*)$ http://myopsserver.com:8080/ops/goto-example/$1 [P]

And enable mod_proxy and modproxyhttp

Hope this helps someone! :-)

Colin Seaman
Senior Developer
 
Tradocs Ltd,
Tower Point,
44 North Road,
Brighton,
BN1 1YR

email:     [hidden email]
telephone: 0870-1417031
website:   http://www.tradocs.net

This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to 
whom they are addressed. If you have received this email in 
error please contact Tradocs. Please note that any views or 
opinions presented in this email are solely those of the author 
and do not necessarily represent those of the company. Finally, 
the recipient should check this email and any attachments for 
the presence of viruses. The company accepts no liability for 
any damage caused by any virus transmitted by this email.
This content of this email is without prejudice.


Erik Bruchez wrote:
Colin,

I doubt changing <base> will do much for anything besides static links in HTML. The error you are seeing probably means that an Ajax request failed to contact the server, probably because it was attempted to the wrong URL. Currently, the JS code naively looks at the URL of the first script loaded (I think) to determine the URL of the XForms server (the target of the Ajax requests).

We have a bug entered about doing this better:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=305808&group_id=168&atid=350207

When that is fixed, you should be able to rewrite that more easily. In the meanwhile, instead or in addition to <base>, you may want to try to rewrite the script URLs.

-Erik

Colin Seaman wrote:
Hi,

I'm running a PHP app on one server and Orbeon on a seperate Tomcat server (port 8080).  I'm trying to use CURL to request an XFORM from the Orbeon server and have it work as if it was running directly on the server.  Receiving the XFORM back is fine, and everything looks right in the page (I set the base url in the HTML header to that of the Orbeon server).

When I try to use the XForm however I get the message "Unexpected response received from server" appear as a standard XForm error message.

Are there any other parameters I need to change on Orbeon to get this route working?

FYI, my PHP code is:

function convert_body($string)
{
   $string = str_replace("<html>",'<html><base href="http://myserver.com:8080">',$string);
   return $string;
}

$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "http://myserver.com:8080/ops/goto-example/xforms-todo");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);

curl_close ($ch);

echo convert_body($result);


-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: CURLing orbeon

Erik Bruchez
Administrator
Colin,

Thanks a lot for this tip!

-Erik

Colin Seaman wrote:

> Hi Guys,
>
> If anyone's ineterested...
>
> We've finally managed to deploy a sufficient proxy implementation of
> Orbeon.  This allows us to use our PHP server (apache) to serve our app,
> and keep Orbeon running on it's own separate server to manage our XFORMS
> (apache tomcat port 8080).
>
> This allows us to mask the Orbeon server from the address bar (and code)
> but keep the full functionality of Orbeon (ie: real time XFORMS).
>
> To do this we:
> created a .htaccess file and put it in our root of our PHP app server.  
> The contents is as follow:
> RewriteEngine on
> RewriteRule ^call/(.*)$ http://myopsserver.com:8080/ops/goto-example/$1 [P]
>
> And enable mod_proxy and modproxyhttp
>
> Hope this helps someone! :-)
>
> Colin Seaman
> Senior Developer
>  
> Tradocs Ltd,
> Tower Point,
> 44 North Road,
> Brighton,
> BN1 1YR
>
> email:     [hidden email]
> telephone: 0870-1417031
> website:   http://www.tradocs.net
>
> This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity to
> whom they are addressed. If you have received this email in
> error please contact Tradocs. Please note that any views or
> opinions presented in this email are solely those of the author
> and do not necessarily represent those of the company. Finally,
> the recipient should check this email and any attachments for
> the presence of viruses. The company accepts no liability for
> any damage caused by any virus transmitted by this email.
> This content of this email is without prejudice.
>
>
>
> Erik Bruchez wrote:
>> Colin,
>>
>> I doubt changing <base> will do much for anything besides static links
>> in HTML. The error you are seeing probably means that an Ajax request
>> failed to contact the server, probably because it was attempted to the
>> wrong URL. Currently, the JS code naively looks at the URL of the
>> first script loaded (I think) to determine the URL of the XForms
>> server (the target of the Ajax requests).
>>
>> We have a bug entered about doing this better:
>>
>> http://forge.objectweb.org/tracker/index.php?func=detail&aid=305808&group_id=168&atid=350207 
>>
>>
>> When that is fixed, you should be able to rewrite that more easily. In
>> the meanwhile, instead or in addition to <base>, you may want to try
>> to rewrite the script URLs.
>>
>> -Erik
>>
>> Colin Seaman wrote:
>>> Hi,
>>>
>>> I'm running a PHP app on one server and Orbeon on a seperate Tomcat
>>> server (port 8080).  I'm trying to use CURL to request an XFORM from
>>> the Orbeon server and have it work as if it was running directly on
>>> the server.  Receiving the XFORM back is fine, and everything looks
>>> right in the page (I set the base url in the HTML header to that of
>>> the Orbeon server).
>>>
>>> When I try to use the XForm however I get the message "Unexpected
>>> response received from server" appear as a standard XForm error message.
>>>
>>> Are there any other parameters I need to change on Orbeon to get this
>>> route working?
>>>
>>> FYI, my PHP code is:
>>>
>>> function convert_body($string)
>>> {
>>>    $string = str_replace("<html>",'<html><base
>>> href="http://myserver.com:8080">',$string);
>>>    return $string;
>>> }
>>>
>>> $ch = curl_init();
>>> curl_setopt ($ch, CURLOPT_URL,
>>> "http://myserver.com:8080/ops/goto-example/xforms-todo");
>>> curl_setopt ($ch, CURLOPT_HEADER, 0);
>>> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
>>> $result = curl_exec ($ch);
>>>
>>> curl_close ($ch);
>>>
>>> echo convert_body($result);
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email] mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>  
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

--
Orbeon - XForms Everywhere:
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws