REST Webservice invocation from Java

Hi Guys,
I am developing an application that needs to invoke a REST webservice and submit XML data to it. The server will then process the request XML data, and return a result, etc.
I have never worked with REST and have spent hours researching it on the NET. I have done SOAP calls in the past, but this seems to be eluding me some what.
Does anyone know of any useful links that explains REST implementation, frameworks / jars needed, or possibly even an example or two that shows me how to submit data via REST to a URL (would be first prize :) ).
Any help would be greatly appreciated.
Many thanks
Mark

http://java.sun.com/developer/technicalArticles/WebServices/restful/

Similar Messages

  • RESTful webservices invocation from OSB.

    Can some one please explain the best way to develop the OSB service to invoke the Restful services.
    1. Only proxy service is enough to handle the request, no need of business service?
    2. when moving the code from one env to other, we use a business service to update endpoint url which is the common approach we generally follow, to make the osb service loosely coupled. how to use the business service when invoking the restservice? does we have the base uri value in the transport url and will get appended with the relative-uri value which we frame as part of the request in the outbound variable in the proxy settings?
    3. when invoking the rest service do we need to append all the request message to the url itself or the request can be passed separately as request body and the main rest uri will have only the key fields as part of the relative-uri?
    4. If we receive huge request message does the URL support the entire request?
    5. how the response/error will be returned when calling the Restful webservice?
    I am assuming this appraoch. Can some one please confirm does this approach works with RESTful service invocation from OSB.
    Request processing:
    Source System request-> Proxy Service -> Transformation to end system specific -> Business service (with base-uri -> http://mainappl.com/web/cmr/{relative-uri from outbound transport}) -> endsystem
    Response processing:
    endsystem Response/Error -> Business Service -> Proxy Service -> transformation to source system specific -> source system.
    Please advice which is the best approach to follow while invoking the RESTful webservices from OSB.
    Thanks..
    Edited by: user12679330 on May 5, 2010 4:33 AM
    Edited by: user12679330 on May 5, 2010 5:00 AM

    Hi,
    Thanks for the update. Can you please explain the above mentioned approach works or how it should be?
    I have one requirement, can some one explain the implementation for this:
    I have one element which is of type unbound. I need to map this element to a single enelement value by separating each element value with a ;, before that I need to check wheteher this element(s) are present in the request then need to appened all these element values to a single element and the end of this element need to append default values.
    Scenario:
    <student>
    <name>asd</name>
    <address>
    <street>street1</street>
    <street>street2</street>
    <street>street3</street>
    ||
    ||
    </address>
    to be mapped it to:
    <student>
    <field name="NAME">asd</field>
    <field name="ADDRESS">street1;street2;street3;default1;default2;default3</field>
    </student>
    Here need to check if street names are present in the request xml, if yes ned to assign it to ADDRESS as mentioned above if street names present or not need to append the default values at the end to the ADDRESS field.
    Thanks in advance.

  • ESB Webservice call from Java client

    Hi,
    i need to call webservice from Java client which inturn will call ESB
    I tried creating proxy from the WSDL in jDeveloper and tried setting the following end points
    My concrete WSDL path :http://10.237.25.63:8889/esb/wsil/SubroCaseESBSystem/InputRouter?wsdl
    My EM -path:"http://10.237.25.63:8889/event/subrotest/SubroInputrouter"
    When i call the concreteWSDL im getting
    "HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 405 Method Not Allowed"
    If i call the EM pathim getting
    "javax.xml.rpc.soap.SOAPFaultException"
    Any guess as how i need to call my ESB from client.

    Hello Venkat,
    - I have created Java Proxy using Jdeveloper for ESB webservice and I usually use http://host:port/event/...?wsdl, and it creates stub which works without any modification. Let me know, may be I can try sending sample project
    - I would like to verify if you are having issue with Java client or ESB itself, are you able to execute that ESB process/service from EM test page or from any other BPEL process?
    Regards,
    Chintan

  • OSB WSDL invocation from java /jsp client!

    Hi ,
    I did a sample work on invoking osb wsdl(based on DB adapter) from a java/jsp application.It worked fine!
    Its a simple select query wth parameter that was configured in my DB adapter.
    Below are the steps I follow -
    a.Created a DB adapter for collective response
    b.created BS out of jca
    c.Generated PS based on above BS.
    d.Performed some xquery tranformation in PS message flow response piepeline.
    e.Exported WSDL and tested it in SOAP UI ,getting the transformed response as required.
    When we generate Java client out of above WSDL in Eclipse ,it generates client for DB data,transformed data fields are not seen -How to obtain transformed data too through Java client?will this work ?
    Is it gud practice to generate java client directly n Eclipse (OEPE) or do we have any other alternative ways to generate Java client out of OSB WSDL?
    Please assist.
    Thanks,
    Ani

    Hi Anuj-
    My proxy was generated out of business ,i get 2 wsdl like master-child .Master wsdl holds referecnce to child wsdl.I hope wsdl generation is fine.
    When i invoke the proxy wsdl url from Java client ,i get below error -
    Exception in thread "main" AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: org.xml.sax.SAXException: Invalid element in com.oracle.xmlns.pcbpel.adapter.db.PhysicalTampered_Meter.PhysicalTampered_MeterOutput - PhysicalTampered
    faultActor:
    faultNode:
    faultDetail:
         {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Invalid element in com.oracle.xmlns.pcbpel.adapter.db.PhysicalTampered_Meter.PhysicalTampered_MeterOutput - PhysicalTampered
         at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
         at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
         at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
         at org.apache.axis.client.Call.invoke(Call.java:2467)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at com.oracle.xmlns.pcbpel.adapter.db.CoreAnalytics.PhysicalTampered_Meter.PhysicalTampered_Meter.PhysicalTampered_Meter_pttBindingStub.physicalTampered_Meter(PhysicalTampered_Meter_pttBindingStub.java:175)
         at Client.JavaClient.main(JavaClient.java:25)
         {http://xml.apache.org/axis/}hostname:B7B-3F-149-4HJV

  • EJB invocation from java callout

    hi,
    Is it possible to invoke an EJB from java callout class. I have tried to invoke an EJB from java callout . In the Initial Context it throws exception as RMIInitialContextFactory not found esception. So, I have added the realted jar and tried. It throws the below exception.
    com.cccis.interfaces.edi.journal.EDIJournalCallout - ejb_edijournal.jar
    2009.03.13 at 06:11:19:192: Thread-6: Deployment - (ERROR) java.lang.NoSuchMethodError: com.evermind.server.rmi.RMIContext.<init>(Lcom/evermind/server/rmi/RMIClient;Ljava/lang/String;Ljava/util/Map;Loracle/j2ee/naming/SecurityContextHelper;)V
    at com.evermind.server.rmi.RMIClientContext.<init>(RMIClientContext.java:40)
    at com.evermind.server.rmi.RMIClientContext.<init>(RMIClientContext.java:36)
    at com.evermind.server.rmi.RMIClient.createContext(RMIClient.java:596)
    at com.evermind.server.rmi.RMIClient.getContext(RMIClient.java:544)
    at com.evermind.server.rmi.RMIInitialContext.get(RMIInitialContext.java:44)
    at oracle.j2ee.rmi.RMIInitialContextFactory.getInitialContext(RMIInitialContextFactory.java:45)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    at com.cccis.interfaces.edi.journal.EDIJournalCallout.execute(EDIJournalCallout.java:71)
    at oracle.tip.adapter.b2b.callout.CalloutExecuteWorker.doWork(CalloutExecuteWorker.java:424)
    at oracle.tip.adapter.b2b.callout.CalloutExecuteWorker.run(CalloutExecuteWorker.java:333)
    at java.lang.Thread.run(Thread.java:534)
    Please help us to resolve this problem.
    Thanks,
    Geetha S

    The initial contextfactory used is RMIIntitialContextFactory.
    This class is not available in the B2B classpath. So we added the oc4jclient.jar in ../ip/lib and added to classpath by making an entry in opmn.xml.
    The OpmnProcess classes present in optic.jar (opmn/lib) does nt have the method getApplist(). So we updated this jar with jdev jar. Now its throwing an java.lang.UnsupportedClassVersionError: EJBHome.

  • WebService Invocation from ADF

    Hi,
    What is the standard process for invoking a service from a ADF application? I know that I can make a Call the the service from the java code and populate reslts in ABF Business Components. I just want to know if there is any other standard way to do this?

    Can any one provide me details about the same?
    My requirement is to invoke a BPEL process from ADF page and display returned results as a table.
    I have created a Data Control for the BPEL process an trying to invoke the process. I could see from the BPEL console that BPEL process is getting invoked. But ADF gets errored out with the following error message
    WARNING:
         Missing class: SuppLOV.process.SearchRecord
         Dependent class: oracle.jbo.common.JBOClass
         Loader: adf.oracle.domain:10.1.3.1
         Code-Source: /D:/JDEV_STUDIO/BC4J/lib/adfm.jar
         Configuration: <code-source> in /D:/JDEV_STUDIO/jdev/system/oracle.j2ee.10.1.3.40.66/embedded-oc4j/config/server.xml
    This load was initiated at current-workspace-app.web.JunkADFAppication-JunkADFPrUI-webapp:0.0.0 using the Class.forName() method.
    The missing class is not available from any code-source or loader in the system.
    Mar 13, 2007 11:33:16 PM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
    WARNING: JBO-25029: Data class (a domain?) SuppLOV.process.SearchRecord not found
    Mar 13, 2007 11:33:16 PM oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
    Here: SuppLOV is name of data link I have created for the web service and process is operation of BPEL process and SearchRecord is XML node of the returned data.
    Can any one help me in this regard?

  • HOW DO I  RUN A UNIX BASH SCRIPT FROM JAVA??

    HI. Here's a tricky little problem i have. There's a unix bash script that has some commands in it, that manipulate a file. It appends a certain string variable to a file called users. The users file is an ordinary text file.
    I know this script to work perfectly, when i invoke it like this directyl from the command line: ./addusers.sh
    or even: bash /downloads/selinux/policy/addusers.sh
    Now, i have a java program, and its meant to just execute that script. It doesnt throw any Exceptions at runtime. But when i look at the users file, and expect it to have an extra line that was the string variable, the file is UNTOUCHED!
    Again, direct command line invocation works, but not from java. Here's what my invocation from java looks like:
    Process p = Runtime.getRunTime().exec("bash downloads/selinux/policy/addusers.sh");
    The strange thing is, i tried a different bash command. I tried:
    Process p = Runtime.getRunTime().exec("mkdir /temporary");
    and this worked!
    so why not the other one??
    I cant figure it out.

    You say:
    bash /downloads/selinux/policy/addusers.sh
    And you say in Java:
    Process p = Runtime.getRunTime().exec("bash
    downloads/selinux/policy/addusers.sh");
    As if a leading / would be missing from the Java
    version...nyix says:>
    ...OK sorry about that. i DO have a / in front of the downloads.... section in the java method. So its:
    Process p = Runtime.getRunTime().
    exec("bash /downloads/selinux/policy/addusers.sh");
    HELP please?

  • BO 4.1 WEBI Metadata extraction using Java Restful Webservice

    Hi
    We are building an application using the Restful webservice and are trying to extract the metadata from the webi report.
    Whether there is any URL to retrieve Query filter in web Intelligence Report.
    Please help.
    Regards,
    Kavitha S

    Assuming this is a BEX query, you may want to check p. 296 in the following; SAP Web Intelligence RESTful web service SDK User Guide, SAP BusinessObjects Business Intelligence platform 4.1
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Calling secured webservice from java

    Hi Experts,
    I am trying to call a secured webservice from java.
    I got the code to call a non secured web service in java.
    What changes do i need to do in this to call a secured webservice.
    Please help me.
    Thank you
    Regards
    Gayaz
    calling unsecured webservice
    package wscall1;
    import java.io.BufferedReader;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.StringBufferInputStream;
    import java.io.StringReader;
    import java.io.StringWriter;
    import java.io.Writer;
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    import java.security.Permission;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.ParserConfigurationException;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    import org.w3c.css.sac.InputSource;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class WSCall2 {
    public WSCall2() {
    super();
    public static void main(String[] args) {
    try {
    WSCall2 ss = new WSCall2();
    System.out.println(ss.getWeather("Atlanta"));
    } catch (Exception e) {
    e.printStackTrace();
    public String getWeather(String city) throws MalformedURLException, IOException {
    //Code to make a webservice HTTP request
    String responseString = "";
    String outputString = "";
    String wsURL = "https://ewm52rdv:25100/Saws/SawsService";
    URL url = new URL(wsURL);
    URLConnection connection = url.openConnection();
    HttpURLConnection httpConn = (HttpURLConnection)connection;
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    //Permission p= httpConn.getPermission();
    String xmlInput =
    "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://www.ventyx.com/ServiceSuite\">\n" +
    " <soapenv:Header>\n" +
    "     <soapenv:Security>\n" +
    " <soapenv:UsernameToken>\n" +
    " <soapenv:Username>sawsuser</soapenv:Username>\n" +
    " <soapenv:Password>sawsuser1</soapenv:Password>\n" +
    " </soapenv:UsernameToken>\n" +
    " </soapenv:Security>" + "</soapenv:Header>" + " <soapenv:Body>\n" +
    " <ser:GetUser>\n" +
    " <request><![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
                "                        <GetUser xmlns=\"http://www.ventyx.com/ServiceSuite\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
                "                        <UserId>rs24363t</UserId>\n" +
                "                        </GetUser>]]>\n" +
    " </request>\n" +
    " </ser:GetUser>\n" +
    " </soapenv:Body>\n" +
    "</soapenv:Envelope>";
    byte[] buffer = new byte[xmlInput.length()];
    buffer = xmlInput.getBytes();
    bout.write(buffer);
    byte[] b = bout.toByteArray();
    String SOAPAction = "GetUser";
    // Set the appropriate HTTP parameters.
    httpConn.setRequestProperty("Content-Length", String.valueOf(b.length));
    httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
    httpConn.setRequestProperty("SOAPAction", SOAPAction);
    // System.out.println( "opening service for [" + httpConn.getURL() + "]" );
    httpConn.setRequestMethod("POST");
    httpConn.setDoOutput(true);
    httpConn.setDoInput(true);
    OutputStream out = httpConn.getOutputStream();
    //Write the content of the request to the outputstream of the HTTP Connection.
    out.write(b);
    out.close();
    //Ready with sending the request.
    //Read the response.
    InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
    BufferedReader in = new BufferedReader(isr);
    //Write the SOAP message response to a String.
    while ((responseString = in.readLine()) != null) {
    outputString = outputString + responseString;
    //Parse the String output to a org.w3c.dom.Document and be able to reach every node with the org.w3c.dom API.
    Document document = parseXmlFile(outputString);
    NodeList nodeLst = document.getElementsByTagName("User");
    String weatherResult = nodeLst.item(0).getTextContent();
    System.out.println("Weather: " + weatherResult);
    //Write the SOAP message formatted to the console.
    String formattedSOAPResponse = formatXML(outputString);
    System.out.println(formattedSOAPResponse);
    return weatherResult;
    public String formatXML(String unformattedXml) {
    try {
    Document document = parseXmlFile(unformattedXml);
    OutputFormat format = new OutputFormat(document);
    format.setIndenting(true);
    format.setIndent(3);
    format.setOmitXMLDeclaration(true);
    Writer out = new StringWriter();
    XMLSerializer serializer = new XMLSerializer(out, format);
    serializer.serialize(document);
    return out.toString();
    } catch (IOException e) {
    throw new RuntimeException(e);
    private Document parseXmlFile(String in) {
    try {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource is = new InputSource(new StringReader(in));
    InputStream ins = new StringBufferInputStream(in);
    return db.parse(ins);
    } catch (ParserConfigurationException e) {
    throw new RuntimeException(e);
    } catch (SAXException e) {
    throw new RuntimeException(e);
    } catch (IOException e) {
    throw new RuntimeException(e);
    } catch (Exception e) {
    throw new RuntimeException(e);
    static {
    javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
    public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
    if (hostname.equals("ewm52rdv")) {
    return true;
    return false;
    }

    Gayaz  wrote:
    What we are trying is we are invoking webservice by passing SOAP request and we will get soap response back.I understand what you're trying to do, the problem is with tools you're using it will take a while for you do anything a little away from the trivial... Using string concatenation and URL connection and HTTP post to call webservices is like to use a hand drill... It may work well to go through soft wood, but it will take a lot of effort against a concrete wall...
    JAX-WS and JAXB and annotations will do everything for you in a couple of lines and IMHO you will take longer to figure out how to do everything by hand than to learn those technologies... they are standard java, no need to add any additional jars...
    That's my thought, hope it helps...
    Cheers,
    Vlad

  • How to call webservice from Java application

    Hi XI gurus
    Pls let me know how to call a webservice from Java application.
    I wanted to build synchronous interface from Java Application to SAP using SAP XI
    For example, i need to create Material master from Java application and the return message from SAP, should be seen in Java application
    Regards
    MD

    Hi,
    If your  JAVA Application is Web based application, you can expose it as Webservice.
    JAVA People will pick the data from Dbase using their application and will send the data to XI by using our XI Details like Message Interface and Data type structure and all.
    So we can Use SOAP Adapter or HTTP in XI..
    If you use HTTP for sending the data to XI means there is no need of Adapter also. why because HTTP sits on ABAP Stack and can directly communicate with the XI Integration Server Directly
    If you are dealing with the Webservice and SAP Applications means check this
    Walkthrough - SOAP  XI  RFC/BAPI
    REgards
    Seshagiri

  • Creating webservice using webdynpro java calling bapi from r/3

    hi all,
    as i am new to this area can anyone provide me a guide to create a simple webservice using webdynpro java to call bapi's from r/3?
    i want to consume the created webservice on a .net client.
    Thanks in advance,
    Raghunandan

    You can use the SAP .NET Connector to do it.
    Download from [http://service.sap.com/connectors|http://service.sap.com/connectors].

  • Urgent :: 11g Invoking Composite from Java/From Webservice Proxy

    Hi All,
    i have a requirement where in need to when ever the exception occurs it invokes custom java and then it invoked a BPEL process to handle the errror.
    in 10.1.3.4 i used to Java Api to invoke the BPEL process and it works fine.
    1) . now we are migrating to 11g, i know this API wont work with 11g as the server is on weblogic and client librairies may be different for invoking in composite it in 11g. if any body has invoked a composite using java and the using 11g libraries to invoke the composite ? if so can you please post here ?
    2). otherway i tried to create a Web Service proxy using Jdeveloper for the composite, when i test it using Jdeveloper it is working fine, but when i place it in the lib directory, im getting a bad response from server 503.
    please see logs below for the second approch
    Caused by: javax.xml.ws.WebServiceException: javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Bad response: 503 Service Unavailable
         at oracle.j2ee.ws.client.jaxws.DispatchImpl.invokeOneWay(DispatchImpl.java:989)
         at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.synchronousInvocationWithRetry(OracleDispatchImpl.java:224)
         at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.invokeOneWay(OracleDispatchImpl.java:102)
         at oracle.integration.platform.blocks.soap.AbstractWebServiceBindingComponent.dispatchRequest(AbstractWebServiceBindingComponent.java:447)
         ... 61 more
    Caused by: javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Bad response: 503 Service Unavailable
         at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call2(HttpSOAPConnection.java:209)
         at oracle.j2ee.ws.common.transport.HttpTransport.transmit(HttpTransport.java:73)
         at oracle.j2ee.ws.common.async.MessageSender.call(MessageSender.java:64)
         at oracle.j2ee.ws.common.async.Transmitter.transmitSync(Transmitter.java:134)
         at oracle.j2ee.ws.common.async.Transmitter.transmit(Transmitter.java:90)
         at oracle.j2ee.ws.common.async.RequestorImpl.transmit(RequestorImpl.java:273)
         at oracle.j2ee.ws.common.async.RequestorImpl.invokeOneWay(RequestorImpl.java:169)
         at oracle.j2ee.ws.client.jaxws.DispatchImpl.invokeOneWay(DispatchImpl.java:985)
         ... 64 more
    Caused by: javax.xml.soap.SOAPException: Bad response: 503 Service Unavailable
         at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.processHttpResponseCode(HttpSOAPConnection.java:603)
         at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.post2(HttpSOAPConnection.java:469)
         at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:1203)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.call2(HttpSOAPConnection.java:207)
         ... 71 more
    if any body has already implemented the invocation of composite in one of above approaches, please let me know.
    any pointers to resolve this will be of great help
    Thanks
    Nadh

    Here is sample to invoke a composite from JSP, this should be same from Java Class. Note that the composite should use adf binding and not ws binding.
    Here is snippet of composite.xml service:
    <service name="rmibpel_client_ep" ui:wsdlLocation="RMIBPEL.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/Application1/RmiVsSOAP/RMIBPEL#wsdl.interface(RMIBPEL)"/>
    <binding.adf serviceName="rmibpel_client" registryName=""/> </service>
    Note the binding should be binding.adf and not binding.ws
    Sample jsp:
    <%@page import="java.util.Hashtable" %>
    <%@page import="java.util.Map" %>
    <%@page import="javax.naming.Context" %>
    <%@page import="oracle.soa.management.facade.Locator" %>
    <%@page import="oracle.soa.management.facade.LocatorFactory" %>
    <%@page import="oracle.fabric.common.NormalizedMessage" %>
    <%@page import="oracle.soa.management.util.NormalizedMessageImpl" %>
    <%@page import="oracle.soa.management.facade.Composite" %>
    <%@page import="oracle.soa.management.facade.Service" %>
    <html>
    <head>
    <title>Invoke HelloWorld</title>
    </head>
    <body>
    <%
    String msg = request.getParameter("world");
    if(msg == null)
    msg = "World";
    String xml = "<process xmlns=\"http://xmlns.oracle.com/Application1/RmiVsSOAP/RMIBPEL\"><input>" + msg + "</input></process>";
         Hashtable jndiProps = new Hashtable();
         jndiProps.put(Context.PROVIDER_URL,"t3://strec03-1.us.oracle.com:8001/soa-infra");
    jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    jndiProps.put(Context.SECURITY_PRINCIPAL,"weblogic");
    jndiProps.put(Context.SECURITY_CREDENTIALS,"weblogic");
    jndiProps.put("dedicated.connection","true");
    Locator locator = LocatorFactory.createLocator(jndiProps);
         String compositeDN = "default/RmiVsSOAP!1.0";
    Composite composite = locator.lookupComposite(compositeDN);
    String serviceName = "rmibpel_client_ep";
    Service deliveryService = composite.getService(serviceName);
    System.out.println("composite=" + composite);
    System.out.println("deliveryServce=" + deliveryService);
    // construct the normalized message and send to Oracle WLS
    NormalizedMessage nm = new NormalizedMessageImpl();
    nm.getPayload().put("payload", xml );
         NormalizedMessage res = null;
         try {
              res = deliveryService.request("process", nm);
         catch(Exception e)
         e.printStackTrace();
    Map payload = res.getPayload();
    out.println( "BPELProcess HelloWorldService executed!<br>");
    //See below output in log file
    oracle.xml.parser.v2.XMLElement elem =
         (oracle.xml.parser.v2.XMLElement) payload.get("payload");
    elem.print(System.out);
    %>

  • Calling SAP Webservice from JAVA ME bad response time

    Hello together,
    I'm calling a SAP RFC as a Webservice from JAVA ME (Netbeans 6.8). The stub classes I've generated with the Sun Wireless Toolkit. The RFC function stores entries in a SAP database table. The call of the websevice with transmitting the data and the database update in SAP works fine, but I got the response message from SAP with a delay of 40 seconds.
    Does anyone know why there is so a long delay in the response and how to fix it?

    hi,
    is this reproducible or was it just the first call to that service?
    it usually occurs that once you call a webservice for the first time, some of the programs (be it your application programs or the even the SOAP runtime itself) required have not been compiled until that and so they are compiled during the webservice call.
    This leads to slow response times even time-outs. The effect vanishes once all sources are compiled (i.e. depending on the complexity of your calls after one to a few calls to that service).
    So, if the slow response times persist, you should turn on debugging in SICF and see where time is spent...
    my 2 cents,
    anton

  • Need to call webservice WSDL directly from Java code

    Hi All,
    I hope u all are doing great.
    I am new to web services and i have a requirement where i need to call the webservice directly from the java code, we dont need any middle layer(via proxy n all).
    Can you all please help me on this, we are using Jdeveloper 11g and we do have WSDLs
    we shld be able to use the wsdl in code and pass the request and get the request
    Any help will be appreciated
    Thanks

    @Puthanampatti     
    Thanks, but i already went through this link and seems this link also says we need to access webserivice through stub,dii etc.
    I want straught java code to access webservice without any tier in between
    Thanks

  • Invoke JCAPS webservice from Java Application

    I am getting
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
    faultSubcode:
    faultString: JAXRPC.TIE.01: caught exception while handling request: unrecognized operation: Test
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}stackTrace: AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
    faultSubcode:
    faultString: JAXRPC.TIE.01: caught exception while handling request: unrecognized operation: Test
    faultActor:
    faultNode:
    faultDetail:
    JAXRPC.TIE.01: caught exception while handling request: unrecognized operation: Test
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
    at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl. java:1015)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser. java:633)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocum entScannerImpl.java:719)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDisp atcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDoc umentFragmentScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.jav a:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.jav a:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java: 1242)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
    ==========================================================
    JAVA CODE :
    public static void main(String[] args) {
    // TODO code application logic here
    try {
    WebServiceClient wsClient = new WebServiceClient();
    String strTargetNameSpaceIn ="urn:stc:egate:jce roject3_Collaboration_1" ;
    String strPortNameIn = "ExecutePortType";
    String strServiceNameIn ="Project3_Collaboration_1Service" ;
    String strOperationNameIn ="Test" ;
    //String strWebserviceURLIn = "http://165.68.202.246:8080/uddidocs/Nonesecurewebservice/testweb3/jc/wsdl_jce_jc-2145777518.wsdl";
    String strWebserviceURLIn = "http://localhost:8080/uddidocs/EnvUCHDevLocal/Project3/Collaboration_1/wsdl_jce_Collaboration_1771627736.wsdl ";
    String strInputIn = " Test JCAPS WebService ";
    String output = wsClient.callWebService(strTargetNameSpaceIn,strPortNameIn,strServiceNameIn,strOperationNa meIn,strWebserviceURLIn,strInputIn);
    System.out.println("WebService Output " + output);
    } catch (Exception err) {
    System.out.println( " EXCEPTION OCCURED");
    err.printStackTrace();
    public String callWebService(String strTargetNameSpace,String strPortName,String strServiceName,String strOperationName,String strWebserviceURL,String strInput) throws ServiceException, MalformedURLException, RemoteException
    if(strTargetNameSpace==null || strPortName == null || strServiceName == null || strOperationName == null || strWebserviceURL ==null || strInput == null )
    throw new IllegalArgumentException();
    ServiceFactory factory = ServiceFactory.newInstance();
    // for webservice target namespace
    String targetNamespace =strTargetNameSpace;
    // for webservice name
    QName serviceName = new QName(strTargetNameSpace,strServiceName);
    // for webservice port name
    QName portName = new QName(strTargetNameSpace,strPortName);
    // for operation name
    QName operationName = new QName("urn:stc:egate:jce roject3:Collaboration_1WSDL:Test",strOperationName);
    // for url of webservice ".wsdl" file
    URL wsdlLocation = new URL(strWebserviceURL);
    if(wsdlLocation==null)
    throw new ServiceException();
    // for bind to service name with wsdl file
    Service service = factory.createService(wsdlLocation, serviceName);
    // for call to webservice using operation name
    Call call = service.createCall(portName, operationName);
    String result = null;
    try{
    System.out.println(" STR INPUT" + strInput);
    result = (String) call.invoke(new Object[] {strInput});
    }catch(Exception e){
    e.printStackTrace();
    result="Occur webservice processing error";
    if(result==null)
    result="Occur webservice processing error";
    String str = "Webservice Responce from :"+strWebserviceURL;
    return result;
    }//close function
    =========================================================
    WSDL FILE :
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions name="Project3_Collaboration_1" targetNamespace="urn:stc:egate:jce roject3_Collaboration_1" xmlns:tns="urn:stc:egate:jce roject3_Collaboration_1" xmlns:inMsg="http://dn1318d-uwsxp:13000/repository/UCHDevLocal/Project3/UCHDevLocal23b1e1:1192e3ad66a:-8000/XSDDefinition1" xmlns:errMsg="urn:stc:egate:jce:JavaException" xmlnsutMsg="http://dn1318d-uwsxp:13000/repository/UCHDevLocal/Project3/UCHDevLocal23b1e1:1192e3ad66a:-7fff/XSDDefinition2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
    <import namespace="http://dn1318d-uwsxp:13000/repository/UCHDevLocal/Project3/UCHDevLocal23b1e1:1192e3ad66a:-7fff/XSDDefinition2" location="XSDDefinition2.xsd"/>
    <import namespace="http://dn1318d-uwsxp:13000/repository/UCHDevLocal/Project3/UCHDevLocal23b1e1:1192e3ad66a:-8000/XSDDefinition1" location="XSDDefinition1.xsd"/>
    <types>
    <xs:schema elementFormDefault="qualified" id="UID-20000000-DC88392E190100-A544977D-01" targetNamespace="urn:stc:egate:jce:JavaException" xmlns="urn:stc:egate:jce:JavaException" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="JavaException" type="JavaExceptionType"/>
    <xs:complexType name="JavaExceptionType">
    <xs:sequence>
    <xs:element name="Type" type="xs:string"/>
    <xs:element name="Message" type="xs:string"/>
    <xs:element name="Trace" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    </types>
    <message name="Output">
    <part name="Body" element="outMsg utput"/>
    </message>
    <message name="Input">
    <part name="Body" element="inMsg:Input"/>
    </message>
    <message name="JavaExceptionMessage">
    <part name="FaultDetails" element="errMsg:JavaException"/>
    </message>
    <portType name="ExecutePortType">
    <operation name="Test">
    <input name="Input" message="tns:Input"/>
    <output name="Output" message="tns utput"/>
    <fault name="JavaException" message="tns:JavaExceptionMessage"/>
    </operation>
    </portType>
    <binding name="ExecutePortTypeBinding" type="tns:ExecutePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="Test">
    <soapperation soapAction="urn:stc:egate:jce roject3:Collaboration_1WSDL:Test" style="document"/>
    <input name="Input">
    <soap:body parts="Body" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </input>
    <output name="Output">
    <soap:body parts="Body" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </output>
    <fault name="JavaException">
    <soap:fault name="JavaException" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </fault>
    </operation>
    </binding>
    <service name="Project3_Collaboration_1Service">
    <port name="ExecutePortType" binding="tns:ExecutePortTypeBinding">
    <soap:address location="http://localhost:18501/WsServer/ExecutePortType"/>
    </port>
    </service>
    </definitions>

    Hi Abinap.
    If you are woking with JEE 1.3 or JAX-RPC.
    You need to add some libraries to java project.
    Go to the tab "Add Libraries" on context menu of the project: Properties --> Java build Path
    Select "Add variable" button, after select the SAP_WEBSERVICES_EXT_LIBS_HOME variable and click on "Extend" Button, finally select all the libraries under lib folder, do the same to the SAP_XML_TOOLKIT_LIBS_HOME variable.
    Greetings.
    Manuel Loayza Gahona

Maybe you are looking for

  • Ipod not recognized by finder or itunes or windows xp

    i have a video ipod and since i used a widget to load lyrics onto it, no computer will recognize it. i have tried the solutions recommended in the manual and in posts (resetting, reinstalling itunes, using different usb port/cable, restarting compute

  • Need Help Cloning Old Windows XP to Mac with VMWare Fusion

    Hello I'm new to the forums and I have been searching all over for a good answer on how to do this. I have a ton of applications, docs, etc. on my old windows xp machine that I need and I am looking for a way to clone the drive it to my mac that is u

  • UCCX 9 on 7816-I5

    Trying to install UCCX on a MCS7816-I5 and receiveing a Hardware not Compatible message after HW verification. As far as this MCS is compatible, do you have any idea of what is happening? All latest firmware and BIOS updates are installed.

  • DATE QUERY'S

    Hello NEWBIE I have just installed oracle 9i personal, it seems to be working apart from when I use a query with a date in a WHERE clause, I know the date is there but I get the reply NO ROWS SELECTED, can anyone help? THANKS. SELECT GUEST_NAME FROM

  • IMac shuts down instead of sleeping

    Hi everybody. Forum newbie here. I'm having a bit of trouble with my iMac. First of all, it's a G5 with 2.0 GB of facory installed RAM, and running OSX 10.4. I bought it barely used from a friend and when I first got it in the spring it shut down ins