This discussion is archived
7 Replies Latest reply: Mar 12, 2012 11:50 AM by 923295 RSS

Creating a gateway URL for a SOAP endpoint URL

923295 Newbie
Currently Being Moderated
Hello All,
I am working on an implementation, where in when a user logs in I would check for his/her profile in an external LDAP and display a message if their password is expiring soon. For this, I am taking an approach to create a java api which takes user id as input parameter and performs the check, and expose this api as a webservice (soap/ restful). I am deploying the java project to the same server where portal.war is deployed. When I hit the endpoint url for the webservice directly with no gateway involved I can see my solution working, example
http://<ip>:<port>/WS_Server_Web/greeting
but, when I create a gateway url using a remote portlet by creating a server and web service url
https://<domain>/portal/server.pt/gateway/PTARGS_0_0_244_201_0_47/WS_Server_Web/greeting,
I get
Error - Gateway was not able to access requested content. If the error persists, contact your portal administrator.

My understanding is the portal reads the response and implement into a frame (like IFrame), in the layout page and at this point it is not able to read/ transform the response.
I am pretty sure, some of you might have implemented a call to external soap webservice, any guidance here will be highly appreciated.

p.s : I would modify the portal page / header.html to make a call to webservice using jquery/ajax
  • 1. Re: Creating a gateway URL for a SOAP endpoint URL
    Robert Herrera Explorer
    Currently Being Moderated
    you can add gateway urls to your web service configuration screen to enable gatewaying of your solution. this way the portal calls your portlet and not the individuals browswer. let me know if that does not work.
  • 2. Re: Creating a gateway URL for a SOAP endpoint URL
    923295 Newbie
    Currently Being Moderated
    Robert,
    I do have a webservice setup for gateway, we have this setup working for many other pages but the problem I am facing is that I am not trying to configure a webpage URL, instead it is a SOAP endpoint URL where the WSDL can be found.
    http://<ip>:<port>/WS_Server_Web/greeting, will have information about WSDl and operations, something like this..


    Web Services
    Endpoint Information
    Service Name: {http://<package>/}GreetingImplService
    Port Name: {http://<package>/}GreetingImplPort
    Address: http://<ip>:<port>/WS_Server_Web/greeting
    WSDL: http://<ip>:<port>/WS_Server_Web/greeting?wsdl
    Implementation class: <package>.GreetingImpl
  • 3. Re: Creating a gateway URL for a SOAP endpoint URL
    Robert Herrera Explorer
    Currently Being Moderated
    I would imagine that you would want to have a simple html snippet with a js include that would make the call via ajax and display the results in that portlet vs just pointing to the wsdl. I don't think pointing to the wsdl does any invoking upon rendering. you would need the mechanism to invoke that endpoint such as an ajax call. am i missing something else?
  • 4. Re: Creating a gateway URL for a SOAP endpoint URL
    Robert Herrera Explorer
    Currently Being Moderated
    you can also turn on ptspy while the request is being made to see if there are additional errors presented to PTSpy.
  • 5. Re: Creating a gateway URL for a SOAP endpoint URL
    923295 Newbie
    Currently Being Moderated
    You said it right, pasting my ajax implementation here, which I think I should have done to start with, btw, I appreciate all your responses...

    var url = 'http://<ip>:<port>/WS_Server_Web/greeting';

    function callWebservice() {

    //Example of a xml request probably put this is the parameter
    var soapMessage = "<?xml version='1.0' encoding='utf-8'?>";
    soapMessage += "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' ....> ";
    soapMessage += "<soapenv:Header/>";
    soapMessage += "<soapenv:Body>";
    ....
    ....     
    soapMessage += "</soapenv:Body>";
    soapMessage += "</soapenv:Envelope>";

    $.ajax({
    type: 'POST',
    url: url,
    cache: false,
    success: function(data){
              
         
    //do something
    },
    error: function(data){
    //do something
    },
    contentType: 'text/xml',
    data: soapMessage
    });
    }
    $(document).ready( function(){
         callWebservice();
    });

    The above implementation works for
    url = http://<ip>:<port>/WS_Server_Web/greeting
    but fails for
    url = https://<domain>/portal/server.pt/gateway/PTARGS_0_0_244_201_0_47/WS_Server_Web/greeting (This URL I generated by defining a remote portlet in portal administration using remote server and web service)..
    Let me see if I can get ptspy logs in the mean time..
  • 6. Re: Creating a gateway URL for a SOAP endpoint URL
    Robert Herrera Explorer
    Currently Being Moderated
    and have you tried placing the portlet to your html endpoint on a page? i'm not sure that invoking the ptargs url as a test always yields the expected results. if you place the html file location created as a remote portlet on a page and then render the page the portal should gateway the invocation and also the resulting ajax call.
  • 7. Re: Creating a gateway URL for a SOAP endpoint URL
    923295 Newbie
    Currently Being Moderated
    I think I am missing something here.. What do you mean by " have you tried placing the portlet to your html endpoint on a page?" Can you please elaborate? Maybe an example?
    " if you place the html file location created as a remote portlet on a page" where is the html file location created?
    Also, is creating a remote portlet to access an external endpoint service soap url, the prefered way ?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points