cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Iframe to show HTML

Former Member
0 Kudos

Hi,

I have a requiremtn that I need to show data which comes from the Share point portal to by web service, so I would like to use an IFrame here but once I consumed the web service how can I can show the daya to Ifrmae,can any one give an example to achive this it would he really nice

Regards

Raj

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear rajluck

It might be better to choose a different UI element instead, since the IFrame will be discontinued by SAP.

Kind Regards

/Ricardo Quintas

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>It might be better to choose a different UI element instead, since the IFrame will be discontinued by SAP.

Actually that isn't accurate any longer. The iFrame was planned to be discontinued, but that decision has since been reversed. The iFrame is back to full support in 7.02 and even has some improvements.

To the original question: What kind of content are your receiving via the web service call? Is it fully formated HTML already? Or is it just raw data that you could then put into the content and bind to WDA UI elements?

Former Member
0 Kudos

Hi Thomas,

Thank you for the clarification.

... and for the good news. ;o)

/Ricardo Quintas

Former Member
0 Kudos

Hi Thomas,

Its not a formatted HTML content ,web service will retiun XML stream which needs to format to show up as a HTML content,

suggest me the approach how can I do this.And let me know the alternate for the Iframe to this requirment

Regards

Rajesh

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I would think you would want to parse the XML and bind the resulting data to the context so that it can be displayed like any other data processed by Web Dynpro. This works if the format of the contents is pretty consistent.

If you want to display the raw return from the service in an iFrame you can do that as well. You can take the content and place into the ICM cache. This will generate a temporary URL for the content which can be bound to the source property of the iFrame.

****Create the cached response object that we will insert our content into
  data: cached_response type ref to if_http_response.
  create object cached_response
    type
      cl_http_response
    exporting
      add_c_msg        = 1.
*  cached_response->set_compression( options = cached_response->IF_HTTP_ENTITY~CO_COMPRESS_IN_ALL_CASES ).
  try. " ignore, if compression can not be switched on
      call method cached_response->set_compression
        exporting
          options = cached_response->co_compress_based_on_mime_type
        exceptions
          others  = 1.
    catch cx_root.
  endtry.
****set the data and the headers
  data: l_app_type type string.

      cached_response->set_cdata( lv_html_text ).
      l_app_type = 'text/html'.

 cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                     value = l_app_type ).

  cached_response->set_status( code = 200 reason = 'OK' ).
  cached_response->server_cache_expire_rel( expires_rel = 60 ).
  data: guid type guid_32.
  call function 'GUID_CREATE'
    importing
      ev_guid_32 = guid.
  concatenate '/sap/public' '/' guid '.' 'html' into lv_iframe_url.

****Cache the URL
  cl_http_server=>server_cache_upload( url      = lv_iframe_url
                                       response = cached_response ).


  wd_context->get_element( )->set_attribute(
    name =  `IFRAME_URL`
    value = lv_iframe_url ).

Former Member
0 Kudos

Hi Thomas,

Thanks for the reply seems it would work for sure because of the issue with web service I couldn't able to implement this , here I have another question we got a URL not WSDL from shre point team when I use the URL in browser am able to see the XML data,and when try to consume that in WDP ABAP am followinig the link below to consume

http://www.sapdev.co.uk/sap-webapps/sap-webservices/ws_abapproxy.htm

according to step 2 in the blog Create ABAP proxy when i give the web service URL am getting the folowing error

HTTP error (return code 500, message "Native SSL error")

when I use the URL in browser it showing up XML

kindly advise me how can I reslove this

even am folowing link

because we do have the cookie requirment as we need to send the cookie to web service as a response,even I struck up at the proxy create.

Regards

Rajesh

Answers (0)