HOW TO: Connect web service (remote application module) to existing model

Hello.
I have J2EE application which displays some data in an applet, which reads them by a web service. I'd like to use persistence and connect with a web service called by applet to my current model set within a session. I tried to pass a session id to web service (to a function of an application module implementation). I wanted to create a new SessionCookie instance with such a session id and application id which are used for web application session (by ApplicationPoolImpl.createSessionCookie() or with custom session cookie factory). But I don't know how to pass a session and application ids to a sessioncookie creation process (ApplicationPool environment). I tried to use custom EnvInfoProvider, which set my properties, but it passes the params after a SessionCookie instance is created.
Samples ... AppModuleServer - file generated to provide ws functionality. I changed code to use EnvInfoProvider:
public class AppModuleServer extends Object{
  public AppModuleServer(){}
  public SomeObject[] myCustomFunction(String sessionId){
    AppModuleImpl _am = null;
    String appId="someValue";
    CustomEnvInfoProvider envProvider=new CustomEnvInfoProvider(appId, sessionId);
    try{
      _am=(AppModuleImpl)Configuration.createRootApplicationModule("data.AppModule", "AppModuleLocal", envProvider);
      return _am.myCustomFunction(sSessionId);
    finally{
      if (_am != null)Configuration.releaseRootApplicationModule(_am, false);
}CustomEnvInfoProvider:
public class CustomEnvInfoProvider implements EnvInfoProvider{
  private String applicationId;
  private String sessionId;
  public CustomEnvInfoProvider(String applicationId, String sessionId){
    this.applicationId=applicationId;
    this.sessionId=aessionId;
  public Object getInfo(String info, Object environment){
    if(info==null)return null;
    return ((Hashtable)environment).get(info);
  public void modifyInitialContext(Object environment){
    if(applicationId!=null)((Hashtable)environment).put("CookieApplicationId", applicationId);
    if(sessionId!=null)((Hashtable)environment).put("SessionId", sessionId);
  public int getNumOfRetries(){
    return 2;
}Does anybody knows how to pass information from custom EnvInfoProvider just before a SessionCookie is created (e.g. how to run modifyInitialContext() function). Or another way how to pass these information from a web service base function into ApplicationPoolImpl instance. E.g., there is parameter "properties" whithin a createSessionCookie method of ApplicationPoolImpl, which is null during calling. Is it possible to pass there some additional information?
Thanks for any suggestions.

Use the Web Service Proxy wizard in JDeveloper to create a class that calls your Web service, and then call this class from code in your AM.
http://docs.oracle.com/cd/E16340_01/web.1111/b31974/web_services.htm#CJAHGIEF

Similar Messages

  • How To Access HTTPS Web Service  in Application Module

    I need to know how to access HTTPS web service in application module.
    If you can provide the tutorial or guidance to achieve this really appreciate.
    Thanks
    Sameera

    Use the Web Service Proxy wizard in JDeveloper to create a class that calls your Web service, and then call this class from code in your AM.
    http://docs.oracle.com/cd/E16340_01/web.1111/b31974/web_services.htm#CJAHGIEF

  • How to do web services between applications

    I have tried to get a complete example about how to do a web service between two applications
    but I saw all the put examples that describe only how to do a web service and test it in the same application.
    Please, I want to see a whole example that shows a web service between two applications.

    Hello,
    Are you looking for any specific JHeadstart webservice functionality? If not, can you please ask this question at the JDeveloper forum of OTN?
    Thanks!
    Evert-Jan de Bruin
    JHeadstart Team

  • Accessing Remote Data Over the Service-Enabled Application Module

    Hi,
    I am trying to access the service enabled module remotely(model project is deployed on different machine) deployed on Integrated WLS server. For that I have done the following step;
    1)     Created simple model project as producer.
    2)     Created the jar of model project(producer) .
    3)     Added the Bc_profileCommon.jar to the Consumer app.
    4)     Changed the connections.xml(Consumer) file accordingly (PFA).
    5)     Created the Entity Objects based on the wsdl in Consumer.
    6)     Created the JNDI on server and added the users with credentials.
    7)     I managed to access service enabled app module locally.
    But I am not able to understand following tags in the connections.xml(for remote access) file such as
    <StringRefAddr addrType="jndiProviderURL">
    <Contents>t3://10.180.190.214:7101</Contents>
    </StringRefAddr>
    <StringRefAddr addrType="jndiSecurityPrincipal">
    <Contents>weblogic</Contents>
    </StringRefAddr>
    <SecureRefAddr addrType="jndiSecurityCredentials">
    <Contents>kiran</Contents>
    </SecureRefAddr>
    Also I am getting a warning for the SecureRefAddr as “No grammer available for the absent namespace contents of element of Contents cannot be validated.”
    Please let me know the significance of the red word. And what value I should set so that it will access the service enabled application module remotely?
    ** I am using Jdev 11.1.1.3.0

    As Bob rightly says you may have a problem if the machine you are trying to access is on a corporate network as you will need the permission and help of the network administrator to achieve this.
    I assume from your post that there is not a VPN connection set up on the remote PC network. Assuming that you have access to the router on the remote network then you will need to set up portforwarding on it at some point so I suggest you go to this page and see if your router is listed as you will need some instructions if you don't use the software suggested by Bob.
    When accessing a remote machine, PC or Mac, I have always used a secure connection to do so and the alternative to a VPN is an SSH tunnel. Unfortunately unlike the Mac Windows doesn't come with SSH server software installed so if you want to go down this route you will have to install and configure this first. I haven't tried this on Windows 7 yet but I have been successful on Windows XP and there are plenty of sites with instructions on how to set this up like this one here. Once the SSH server is set up on the PC and port 22 on your remote router has been forwarded then you can set up a SSH tunnel in the same way as described in my post in this thread http://discussions.apple.com/thread.jspa?messageID=10847513&#10847513
    Message was edited by: Sean Dale1

  • How  to communicate with a remote application that uses http post to request connection

    Ok, I will try to make this simple as to avoid any
    confusion.
    I am trying to receive connection requests from remote applications installed on user pc's.
    The application uses POST method to send the request to connect to my database, and if required update some tables.
    The application is not a webpage. I have no access to the internal workings of the application nor do I have any specific information about how it sends its POST. I am sure of the following:
    The app will POST to my .cfm page
    "IsConnectionAllowed" = "yes"
    This is asking my cfm page if its ok to connect. I would need to use a <cfif> to verify the the first part of the POST is in fact
    "IsConnectionAllowed" = "yes"
    If this returns true, (the app also uses to POST to pass "username" and "password") my .cfm page will then perform a query and check the username and password against the database. If a matching record is found, the application expects my page to reply with
    "#Answer# OK- connected;"
    Once the answer is given the application will then respond with data to insert or update my tables.
    Now, I know how to do the queries and update tables etc, but I have never received data from an application before.
    I tried using the <cfform> tag with a mehod of GET, and then trying to send my reply with <cfoutput>, but that didn't work. The application doesn't give any feedback or error messages. It either connects or not.
    I also tried the <cfhttp> tag, but that didnt work either. I am not very experinced with coldfusion. I used it years ago and am just getting back into it.
    I am sure this is a pretty easy thing to do, but my methods arent working.
    Using the above information, can somone please show me how I would accomplish this communication? I can then use the same method to retrieve the data for my table updates and queries.
    Here is a sample of what I have already tried:
    <cfform method="get">
    <cfif>
    "IsConnectionAllowed" = "yes"
    <!-- I need to query a username or password. But for testing I will just give the OK to connect -->
    <cfoutput>#Answer# Ok - connected;</cfoutput>
    <cfelse>
    <!-- When I query username and password, if the query returns no records I deny the connection -->
    <cfoutput>#Answer# Not connected;</cfoutput>
    </cfif>
    </cfform>
    BTW, I have examples of this being done using .php and .asp. I need to do this using .cfm. I can post the either the .php or.asp code if it will be helpful in converting the function into a .cfm page.

    Thanks Fernis.
    That code allowed me to connect!
    I have an error on the remote application, but I think thats due to the fact that I commented out the database connection and query strings. As I am mostly concerned with connection at this point, I just wanted to test that my cfm page will recognise the POST request and send the right answer, In this case
    ##Answer## Ok - connected;
    That worked perfectly and the application received the ok to connect.
    I can now use your code as a base to carry on with my database connection and update query.
    I can't thank you enough. I wouldnt have figured that out in a million years of trial and error.
    I knew it was simple though. I was over thinking it.
    I do have one last question though... In the code you presented you have
    <cfif structKeyExists(Form,"isConnectionAllowed") AND form.isConnectionAllowed EQ "yes">
    Can you you explain this    structKeyExists(Form,"isConnectionAllowed")
    I have never seen this before. Why the Form followed by a comma? I am guessing you are asking if there is an element in the POST called "isConnectionAllowed". Is that correct?  If so, do I not need to do that for each POST'ed element such as username, password, and each of the other fields that will be updated in the session?

  • How to use web service consumer as a source to connect to Salesforce?

    I see a lot of articles and mapping xmls on how to use web service consumer but as a newbie I am not able to view the object schema from my salesforce enterprise WSDL after importing it in Informatica designer as a source. My enterprise wsdl has operations like create, retrieve, upsert, delete etc so if I want to read data from account then could someone guide me on how to use the web service consumer to view the fields after importing the wsdl.  After importing the wsdl and selecting the operation say create, the columns (ports) displayed shows different groups but it doesn't list the object fields? what am I missing here? And what is the operation to read data from Salesforce is it "retrieve" from the entripse wsdl? As a newbie on this, I appreciate any inputs on this topic.

    Magazinweg 7Taucherstraße 10Taucherstraße 10Av. Copacabana, 267Strada Provinciale 124Fauntleroy CircusAv. dos Lusíadas, 23Rua da Panificadora, 12Av. Inês de Castro, 414Avda. Azteca 123 I have the source table like this and i want to replace the character and sum up the numbers and how can i do it, I replace the character by reg_replace() function but I am not able to add the number because it is of not fixed length. My Output should be,71115705396

  • ALUI-Create Web Service - Remote Portlet Error 401:Unauthorized

    I have some problems during user ALUI(AquaLogic User Interaction 6.1).
    I created a Web Service - Remote Portlet,then set value of Basic Authentication Settings is "User's Basic Authentication Information". When related remote server refer to tomcat5.5,the Web Service - Remote Portlet is fine to run,but not when the related remote server refer to weblogic9.2.
    When value of Basic Authentication Settings is "Use Remote Server Basic Authentication Information", related remote server refer to weblogic9.2 or tomcate5.5, the portlet is fine.
    error detail:
    Error
    sso Portlet cannot be displayed because the remote server returned an invalid HTTP response code.
    We recommend:
    • Refresh sso Portlet
    • Accessing this portlet at a later time.
    • Contacting your portal administrator if problems persist.
    Detailed error information
    • Response status: 401
    • Response body:
    Error 401--Unauthorized
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.2 401 Unauthorized
    The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity MAY include relevant diagnostic information. HTTP access authentication is explained in section 11.

    How to configure remote server to accept authorization header?
    I set value of Basic Authentication Settings is "User's Basic Authentication Information" because the Web Service - Remote Portlet need to get the portal's login user infomation.If the value is "Use Remote Server Basic Authentication Information",the application is fine to run.
    The follow is the way to get login user infomation.
    IPortletContext portletContext = PortletContextFactory.createPortletContext(request, response);
    ICredentialProvider cProvider = portletContext.getCredentialProvider();
    String username = cProvider.getUsername();
    String password = cProvider.getPassword();
    Do you have other way to authenticate users?
    Thanks.
    Edited by: user2233298 on 2009-4-22 下午8:25

  • How to consume web service in Agentry in SMP 3.0

    Dear All , I am using web service in Agentry to retrive data but could not able to fetch it . I have made connection with HTTP-XML for consuming webservices. and also give proper information in Agentry.ini files Ex : [HTTPXML-2] name=HTTP-XML Back End authenticationCertificateStore=MY authenticationCertificateStorePassword= authenticationCertificateStorePasswordEncoded=false autoDequote=true ;baseURL=http://localhost:81 baseURL=http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/ basicAuthenticationPassword=123456 basicAuthenticationPasswordEncoded=false basicAuthenticationUserID=P1466405733 constantsFile=httpxml_sd.ini enableAuthentication=false enablePreviousUserAuthentication=false httpConnectTimeout=300 httpReceiveTimeout=300 httpResolveTimeout=300 httpSendTimeout=300 listenOn= timeout=300 timeZoneName= useSSL=false xmlAllowXSLTScript=true xmlNamespaces= xmlResolveExternals=true xmlValidateOnParse=true for more information i have attached agentry XML screen shot as well . Can you please guide me how to consume web services in Agentry correct way ? Note : Currently i am using standard netweaver demo web services . Thanks & Regards ,   Kunal Varaiya
    Tags edited by: Michael Appleby

    The XML Steps URL will be added to the Agentry.ini BaseURL.  So you dont' need the full URL on the step.
    So when Agentry Runs the step to call the backend it will go:
    <BaseURL>/<Step's URL>
    This way if you need to change the base URL, IE, going from Dev to QA to Production Server you only need to change the Base, and not go into every step and update it.
    URL: This attribute contains the URL to which the Agentry Server will make a request. This value will be appended to the value configured as the base URL for the HTTP-XML system connection. This base URL is configured within the HTTP-XML system connection configuration options for the Agentry Server. Proper use of both this base URL option and the URL entered in the requests of the step definitions can support portability for the application, with the base URL being the implementation-specific portion and the step’s URL being the portion not likely to change for the same back end system from one implementation to the next.
    http://help.sap.com/saphelp_smp303sdk/helpdata/en/7c/143d5d70061014b323be16eb0b0a77/frameset.htm 
    Stephen

  • How to deploy web service as part of console.war

    Hello,
    I need to expose the deploy functionality of bpel console as web service. I see that there is a JSP page which pretty much does the same thing in console.war. So I know what my Java class is going to look like the problem is I am very new to OC4J so I don't know how to deploy it as web service on this container. Any help is greatly appreciated.
    I tried going through the tutorial on deploying web services on OC4J but the sample stateless class does not compile because it cannot find some proxy classes. Also next I copied ws_example.ear in 'D:\OraBPEL_1\bpel\system\appserver\oc4j\j2ee\home\applications' and restarted server but it is not deployed.
    Thank you,
    Meghana

    Thank you for replying to my post.
    The requirement is that we deploy BPEL suitcase remotely. My impression was that one can get handle to the Locator object only if running on local machine so I was looking at how to create web service on Oracle BPEL PM itself that will accept the stream of jar and deploy it locally.
    However now looking at this tutorial and the Java docs, I know it supports RMI calls. So I can use this constructor to get Locator instance -
    public Locator(java.lang.String domainId,
    java.lang.String password,
    java.util.Hashtable pInitialContextProperties)
    throws ServerException
    Can you let me know sample initial context properties? I checked the sample InvokingProcesses' context.properties
    orabpel.platform=oc4j_10g
    java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory
    java.naming.provider.url=ormi://ca-guru/orabpel
    java.naming.security.principal=default
    java.naming.security.credentials=welcome1
    My guess is I have to change that url but I don't know where to point it. Also could you please let me know what are the jars I will need on the client side?
    Thank you. I appreciate your help.
    Meghana

  • (261680070) Q SYNCH-11 How do my web service methods accees EJBs and java classes?

    A<SYNCH-11> How do my web service methods accees EJBs and java classes?
    A<SYNCH-11> It is simple to use java classes, just do it as you would ordinarily.
    The .jws file really contains a simple class so you can program with it in the same
    way that you would use a regular Java class.
    To use an EJB you can go and access it directly as you would with any EJB remote
    client (lookup home stub, create, etc) or if the EJB is deployed to WLS you can use
    a control to provide a very simple wrapper to the EJB. We will see this in detail
    on Thursday in the ADVC module.

    Futher information about the possibility of callback:
    It may be possible for a synchronous only web service (i.e. MS .net) to even paticipant
    in the callback functionality of asynchronous web services. If the client implements
    the appropriate methods for the callback but listens for them on a different port
    or binding than the SOAP request, then web service may be able to build a response
    if the client's "callback URL" is submitted as the beginning part of a conversation.
    Watch the BEA developer forum (http://dev2dev.bea.com) for more information about
    this approach and other tips and techniques for building web services.
    "Adam FitzGerald" <[email protected]> wrote:
    >
    Q<SYNCH-03> I heard that MS .net only implements synchrnonus method? If
    this is true.
    Does it means my async methods will only work with J2EE clients?
    A<SYNCH-03> I do not know the limitations of .net but let me point out that
    is very
    difficult to provide asynchronous web service method invocation (this is
    different
    from an asynchronous web service). HTTP as a general communication protocol
    is based
    on a request and response paradigm so your client libraries will mostly
    likely be
    expecting a response even if it is empty (check the asynchronous example
    from today
    to see that the start method still returns an empty response). You must
    distinguish
    this from the notion of an asynchronous web service which is a business
    operation
    that occurs on the server whose return value/result is not directly associated
    with
    building response to the client. An asynchronous web service can (and generally
    will)
    be started and stopped with web service operations that are invoked synchronously.
    Thus MS .net clients can still be client to WLS hosted web services.

  • I generated web service from function module.Where can I find .wsdl file ?

    Hi,
    I generated web service from function module.
    Where can I find .wsdl file ?
    I want to use .wsdl file in .Net application.
    Thanks.

    Hii Cemil Bozlagan,
      All Remote enabled Function Modules in Web AS 6.20 and Above are available as Webservices and the WSDL documents are available in the web service repository at
    [http://<host>:<port>/sap/bc/bsp/sap/webservicebrowser/search.html]
    Find the respective BAPI.
    Click on the WSDL link in the browser and download the WSDL document and use it as per the requirement
    Regards,
    Varun

  • Error while testing Service enabled Application module-ADF11g

    Hi All,
    I am facing an error while testing Service enabled Application module.I have followed the documentation avaialble in this link
    http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcextservices.htm#CJABABJE.
    All the supporting jar files are included in the calling application, but still I am getting class not found exception.
    Error is as follows…
    JBO-29000: Unexpected exception caught: java.lang.RuntimeException, msg=java.lang.RuntimeException: java.lang.ClassNotFoundException: demo.model.common.serviceinterface.AppModuleService: java.lang.RuntimeException: java.lang.ClassNotFoundException: demo.model.common.serviceinterface.AppModuleService
    Jdev version is 11.1.1.2.0 and
    Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
    Any pointers for the same is highly appreciated.
    Thanks,
    Anusha

    Hi Willian,
    Did you set up your "Model" Project to use the JDK 1.4 and rebuild the application ?
    See " [Deploying to Application Servers That Support JDK 1.4|http://tinyurl.com/lfc6kc] "
    Regards,
    Didier.

  • How to consume Web Service in ABAP WebDynpro

    Hi
    I want to know the entire details about how to consume Web Service in WebDynpro application.
    regards
    Piyush

    hI piyush,
    Have a look at this Blog by Thomas Jung.
    /people/thomas.jung/blog/2007/12/17/consuming-services-with-abap
    on consuming webservies thru webdynpro ABAP
    Cheers
    Mary

  • Urgent: Web Service from Function Module

    Hi guys, I am new to this area so please help to achieve following:
    I want to show a demo to load data from a web service to BI. I have performed the following steps and don’t know how to process further. Please help me in the sense where do I put the logic to show fields on the web service and ….
    1. I have created a web service data source in BI with four fields (Cal dat, material, amount and currency)
    2. This created a Web Service /RFC FM automatically.
    3. From this FM I created a web service (Utilities – create web service – from function module)
    4. I followed the web service creation wizard.
    Thanks,
    sam

    releasing and related steps are fine,
    what i want to know is, BW/BI datasource will create a FM, from this FM inturn I will create a webservice.
    Lets say BW/BI datasource has 4 fields account, company, amount & currency.
    I want to enter these 4 values from the webservice which will bring these values to BW delta queue and eventually get loaded in BW.
    For this process do I need to code anything in the FM or any other part of the system

  • How to call web-service using only java code

    Hello, how to call web-service using only java code. I can call it from BPM process or Web Dynpro Java Application, but if I need to call it from ejb component?

    I'm found answer:
    Java and SAP Portal blog: How to call web service from java code example

Maybe you are looking for

  • How do i put payment information as itunes gift card?

    you use to be able to put in none for billing information did they change that you have to use credit card now?  I keep getting asked to submit my credit card information but don't have a credit card only purchase gift cards from retail stores  

  • Checkpoint not complete;;cannot allocate new log ;;; PLZ HELP ME

    Hi all, We are working on Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 on a Redhat Linux Server platform. We are facing the following problem in the alert.log file : Wed Aug 22 02:58:57 2007 Thread 1 cannot allocate new log, sequence 435

  • We are unable to start your subscription for adobe photoshop cs5

    Why this happened?

  • Help with Aperture

    Right now I only use Aperture to edit RAW files and export finished images to iPhoto for viewing purposes. Is it possible to have Aperture libray located on an external drive? is it possible to have multiple library? In your opinion, which one is bet

  • Report Designer Result Row question

    Hello Gurus I read that in the report desinger you can grab the result row feilds from the inserted query and place it another report section but where do get that i don't see those cells showing up anywhere in the feild catalog. basically i have two