cancel
Showing results for 
Search instead for 
Did you mean: 

Using EPCF in an external HTML

Former Member
0 Kudos

Hi,

I am importing an external Web content as an URL iView in Enterprise Portal 6.0. The ideal situation is the external content, after being created as an iView through portal's URL iView template, can raise an event to other iView created in either PDK or Web Dynpro. So, my question is, can EPCF be included in the external source and be understood by the Portal?

Thanks.

- Teecheu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Teecheu,

As correctly pointed by Anoop the EPCF works on the "behind-first-dot" rule. It makes cross-frame scripting possible when the content comes from different servers BUT in one domain. Thus it will not be possible to pass data across servers that are in different domain.

Regards, Akhilesh

PS: Please consider awarding points for helpful answers just by pressing the yellow star button on the reply in question and choosing the corresponding amount of points. Thanks in advance!

detlev_beutner
Active Contributor
0 Kudos

Hi Akhilesh,

> Thus it will not be possible to pass data

> across servers that are in different domain.

That's half of the truth.

A common workaround is just to set the IP of the "totally diversing domain" locally to a compliant domain (server is on server.company.com, external content is on some.where.else with IP 1.2.3.4, so map locally IP 1.2.3.4 to external.company.com). Then use domain relaxing, and everything works fine.

There are some situations when this does not work, but in reality, most time it's sufficient.

> Please consider awarding points for helpful answers [...]

Nice that my text found the way into your postings Anyhow, the questioner already has rewarded points, and the addtional answers didn't add more than what is mentioned in the link with the pages given (there the domain problem with relaxing is discussed).

Hope it helps

Detlev

Former Member
0 Kudos

HI Detlev,

" so map locally IP 1.2.3.4 to external.company.com"

Can you explain how to do this?

regs

anoop

detlev_beutner
Active Contributor
0 Kudos

Hi Anoop,

I only now this for Windows, but for Unix systems it will be something similar:

Under \[WINDOWS]\SYSTEM32\DRIVERS\ETC edit file HOSTS and add the line

1.2.3.4 external.company.com

That's all.

Hope it helps

Detlev

Former Member
0 Kudos

Hi Detlev,

I have added the following Java Scripts in my HTML for testing. The JavaScript try/catch block is to avoid error when the user is viewing the content outside of Portal.

...

<SCRIPT src="epcfproxy.js"> </SCRIPT>

<SCRIPT>

function func(){

try{

alert(EPCMPROXY.getUAType());

}

catch(e){

alert("EPCMPROXY object not found");

}

}

</SCRIPT>

...

The HTML is sitting in the Web server in my local machine, and the Portal is in another machine within the same domain. I have also added the following mapping in the HOSTS file,

127.0.0.1 myserver.company.com

1.2.3.4 portal.company.com

Then, in the Portal, I created a URL iView to refer to the content in myserver.company.com. I also set the isolation method of the page that contains this URL iView to "URL."

Everything works fine except that the JavaScript alert message "EPCMPROXY object not found" is displayed everytime I trigger an event on the page. It seems that the Portal does not understand the JavaScript file "epcfproxy.js" in my HTML.

Any idea what could be wrong? My application is neither an ITS-based nor BSP; it is a simple static HTML webpage. Is this a problem? I have exausted all the resources I have, but could not find the answer. Any input from you will be very much appreciated.

Thanks,

- Teecheu

detlev_beutner
Active Contributor
0 Kudos

Hi Teecheu,

see page 21 of the doc given:

var lnDotPos = document.domain.indexOf( "." );
if (lnDotPos > = 0) {
  document.domain =
    document.domain.substr( lnDotPos + 1 );
}

Your case is described on page 41, example #2:

> site1.mydomain.com

> site2.yourdomain.com

> Scripting permitted: No

That's the reason.

The message you print (EPCMPROXY object not found) is also not really describing the situation. EPCMPROXY of course is found, it is part of the included JS file. But it is not allowed to communicate with the surrounding EPCF outside it's frame.

Hope it helps (for sure it will solve(!!!) your problem)

Detlev

Former Member
0 Kudos

Hi Detlev,

Thanks for the prompt reply. I have modified the code accordingly such as the following,

...

<SCRIPT src="epcfproxy.js"></SCRIPT>

<SCRIPT language="JavaScript">

var pos = document.domain.indexOf(".");

if(pos >= 0 ){ document.domain = document.domain.substr(pos + 1); }

function openPage(){

try{

if(EPCMPROXY){ alert("print sth"); }

}

catch(e){ alert(e); }

}

</SCRIPT>

...

At Portal runtime, Mozilla throws an "ReferenceError: EPCMPROXY is not defined", whereas IE gives me the "object Error." It seems like the portal does not even access the JS file, not to mention about interacting with the surrounding EPCF.

So, the problem could be, like you mentioned, at the JavaScript Origin Policy. The two development servers I have are sitting on the LAN, I am sure they are in the same domain. The problem is we have not assigned a proper domain name to the development servers. So, I faked the domain names in the HOSTS file such as,

10.40.97.91 www.mydomain.com

10.40.97.92 portal.mydomain.com

previously, they were

10.40.97.91 www

10.40.97.92 portal

Unfortunately, it still does not work. Is there anything wrong with the fake domain? What could be a better solution?

I understand that you are not a fulltime problem solver with SDN. So, I will appreciate if you can give me another pointer whenever you are free.

Thanks,

- Teecheu

detlev_beutner
Active Contributor
0 Kudos

Hi Teecheu,

OK, I think we have to begin at the beginning

> I faked the domain names in the HOSTS file such as

That looks good, and is needed. But also be sure that these domain names are used! For example, use HTTPWatch, a tool which offers fine grained information about eacht http request, so you can see what happens between client and server. (There are several tools doing this, it's only one of the more well known; but it's not for free.)

> It seems like the portal does not even access the JS file

Ooops, a big misunderstanding

If you have got an URL iView, the html page with the JavaScript is not processed by the portal (portal.mydomain.com) but by the server from which the page is imported (www.mydomain.com). So www.mydomain.com is asked for the JS, and it is your task to deliver the JS to the server (if you write <SCRIPT src="epcfproxy.js">, then it has to be within the same folder as the page requested).

Maybe HTTPWatch helps also to understand the flow who requests what from where...

I hope that we at least get closer...

Best regards

Detlev

Former Member
0 Kudos

Hi Detlev,

At last, it works! I added the JS file in the Web server, and everything fell in place! Now, I can concentrate on the communication between the URL iView and my other iViews. Nevertheless, you have already solved my problem. Thank you very much.

P/S: HTTPWatch is a neat tool. It showed that the Portal was not interpreting the external content and gave the HTTP 404 error while the external application was trying to access the JS file that did not exist.

Thanks again

- Teecheu

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Teecheu,

The EPCM object is automatically included to all

the iviews that are displayed inside the portal even if they are external content, provided the epcm is activated.

Unfortunately, this wonderful option is very much limited by the javascript's limitation on running across different domains. So if this external content what you

mention is right within your enterprise then it should work without much trouble.

HTH

Anoop

detlev_beutner
Active Contributor
0 Kudos

Hi Teecheu,

the answer is "most of it", see https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/enterpris... portal client.pdf pages 20-22 and if the server with the included stuff differs in the domain, pages 40-41.

Hope it helps

Detlev