Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Hervé Ménage
SOAP calls from PHP app + nuSOAP : data types
January 13, 2009 5:30 AM
Answer

Hervé Ménage

Rank: Junior Member

Posts: 50

Join Date: March 1, 2007

Recent Posts

Hello,

I am trying to make SOAP calls to Liferay from a PHP application. I am using nuSOAP (PHP equivalent to Axis), and it looks to work fine.
However, I am facing a data type conversion problem: Liferay SOAP services expect "long" data for all IDs. This data type does not exist in PHP. the existing int, double and float PHP types are not automatically converted to java long.
As a consequence, I cannot call Liferay SOAP services from my PHP application...

Help appreciated
Thank you in advance

Hervé
Hervé Ménage
[RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 13, 2009 6:43 AM
Answer

Hervé Ménage

Rank: Junior Member

Posts: 50

Join Date: March 1, 2007

Recent Posts

Hi,

I implemented a workaround in the "nusoap.php" file, which serialize data.

I modified the "serialize_val" function:

 1            case (is_string($val) || $type == 'string'):
 2            // HME - Add Java long type support
 3                $nb = sscanf($val, "java.long.%d", $javalong);
 4                if ($nb == 1 && is_long($javalong)) {
 5                    $xml .= "<$name$xmlns xsi:type=\"xsd:long\"$atts>$javalong</$name>";
 6                } else {
 7            // end HME
 8                    $val = $this->expandEntities($val);
 9                    if ($use == 'literal') {
10                        $xml .= "<$name$xmlns $atts>$val</$name>";
11                    } else {
12                        $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
13                    }
14                } // HME - if
15                break;


Usage: to "send" a PHP int as a Java long, convert the integer to a string, which must start with "java.long.".
Example:
To send the int 1 as a long:
soapclient->call('mysoapoperation', array('java.long.1');


Regards
Hervé
Prabhpreet Singh
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 15, 2009 10:21 AM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Hi Herve,

Do you mind reviwing my following and reply to it please?

https://www.liferay.com/web/guest/community/forums/-/message_boards/message/1940759

Regards,
Prabhpreet
Hervé Ménage
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 15, 2009 10:58 PM
Answer

Hervé Ménage

Rank: Junior Member

Posts: 50

Join Date: March 1, 2007

Recent Posts

Hi Prabhpreet,

Done :-)

Regards
Hervé
Prabhpreet Singh
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 17, 2009 8:03 AM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Thanks Herve,

One more question, do you have any idea about how we can directly integrate Liferay's internal portlets in non-Liferay based web applications?

Regards,
Prabhpreet
Hervé Ménage
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 18, 2009 10:35 PM
Answer

Hervé Ménage

Rank: Junior Member

Posts: 50

Join Date: March 1, 2007

Recent Posts

Hi,

Interesting question! I do not have any answer...
The simplest solution would be:
- Deploy the Liferay portlet in a Liferay page, with a "blank" theme (no decoration) and the 1-column page layout. Remove the borders.
- Configure a friendly name
- Use an Iframe in your web application with correct attributes to make a seamless integration.
- If needed, implement a SSO solution: CAS or Tomcat mechanisms can do the job. Make sure the users are identified under the same identity in both apps (access control), or use impersonation if sufficient.

Regards
Hervé
Prabhpreet Singh
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 19, 2009 5:39 AM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Thanks Herve,

Since I am very new to Liferay, Do you mind telling me how can I configure SSO on Liferay and above all what is the purpose of using SSO here? What is CAS?

As you mentioned, that I should use IFrame in my web application to display internal portlet but for that, I would need the URL of that internal portlet from Liferay. How can I get that URL and what is the use of friendly name?

Sorry for asking multiple questions.

Regards,
Prabhpreet
Hervé Ménage
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 19, 2009 5:59 AM
Answer

Hervé Ménage

Rank: Junior Member

Posts: 50

Join Date: March 1, 2007

Recent Posts

Hi,

You should find all the information you need about CAS in the forums and in the wiki (http://wiki.liferay.com/index.php/Main_Page). And of course on their official web site (http://www.ja-sig.org/products/cas/)

To your second question: create a page in Liferay, and set a friendly URL (You can do that in "Manage pages").
In this page, add your portlet.
Your URL should be similar to this one: https://www.liferay.com/web/guest/community/forums
Without the friendly name, it would be: https://www.liferay.com/web/guest/community/11
Where '11' is the page ID...

As you can see, the message board portlet is displayed. Just imagine you configure your page with a blank theme and no border, and the integration into an Iframe should be ok.

Simply write this code in any HTML file, and you will see the result.
 1<html>
 2<head><title>Demo Iframe - portlet</title></head>
 3<body>
 4<h1>Below is the iframe</h1>
 5<iframe scrolling="auto" frameborder="0" width="100%" height="800" src="https://www.liferay.com/web/guest/community/forums">
 6<h2>Your broser does not support IFRAMEs</h2>
 7</iframe>
 8</body>
 9</html>


Regards
Hervé
Prabhpreet Singh
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 19, 2009 6:56 AM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Thanks Herve,

But why do you think we would need SSO for this?

Regards,
Prabhpreet
Hervé Ménage
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 19, 2009 7:16 AM
Answer

Hervé Ménage

Rank: Junior Member

Posts: 50

Join Date: March 1, 2007

Recent Posts

In my example, you do not need SSO to view the information as soon as it is "public".
But if you want to post a message (or to perform any action which requires authenticaion), either you authenticate in the ifram (not very nice though it works), or you implement SSO for a nice integration in your web app.
I do not say it is required.

Regards
Hervé
Prabhpreet Singh
RE: [RESOLVED]: SOAP calls from PHP app + nuSOAP : data types
January 19, 2009 7:20 AM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Yes, makes sense now,

For articles, they are normally public pages, which anyone can view but yes for viewing liferay forums, we need authentication and in that authentication will be required.

Thanks for your prompt replies.

Regards,
Prabhpreet