Create a webservice using java class

Hi,
I have a java class (which is used to open a URL). I need to create a webservice out of this so that I can publish this. Which is the best tool to convert java to a webservice and what are the steps.
Any pointers on this would be of great help.
Thanks,
Shreevatsa

If you are using Java 6 use JAX-WS to expose it as a webservice. See the JavaEE tutorial for more information.

Similar Messages

  • Create web service using java class

    Hi,
    I created the web service using java class then i deployed this web service in to the weblogic admin server.when i tested this process it is working fine.
    when I tested The generated WSDL to this process in browser(IE). it is not working.
    I need to to invoke this webservice from another BPEL but this WSDL is not working.

    Hi,
    when i created the webservice in jdeveloper by default it is connected to integrated weblogic server and generates this wsdl.
    http://localhost:7101/helloApplication-javaexcel-context-root/MyWebService1Soap12HttpPort?WSDL
    then I deployed this webservice in to the Adminserver.it gives the following URL.
    http://192.168.56.1:7001/extracExcelToCSV-extractExcelToCSV-context-root/ExtractExcelToCSVSoap12HttpPort?wsdl
    This URL is not working but when i tested this process it is working fine.
    It is giving below error when i try to invoke from jdeveloper
    Error while reading wsdl file
    caused by:java.net.connectExcepption :Connection timed out:connect

  • How to create Webservice using java

    Hi Experts,
          I am very new to Visual composer, can any one of you suggest how to create a webservice using java so that i can use that webservice in Visual Composer application.If it is possible please give me detailed description about it.
    Regards,
    Prasanna.

    Hi Prasanna,
    See if my article is of any use to you:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10">How to Create a Web Service using an Enterprise JavaBean</a>
    For creating Web Services, you won't need to do the MS SQL Part explained in my doc. You can just concentrate on the part where i explain how to create a Web Service using an EJB.
    Bye
    Ankur

  • What are the steps to create a webservice from java

    i followed the doc. of weblogic 10.3 but something is missing..i am using ubuntu
    1)
    i created a webservice ping.java which placed in myproject/HelloWorld directory
    package HelloWorld;
    import javax.jws.WebMethod;
    import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;
    import javax.xml.ws.BindingType;
    @WebService(name="SimplePortType", serviceName="SimpleService",
    targetNamespace="http://example.org")
    @SOAPBinding
    @BindingType
    public class ping {
    @WebMethod
    public String main(String p){
    System.out.println("sayHello:" + p);
    return "Here is the message: '" + p + "'";
    2) and created a build.xml and placed it in myproject folder
    <project default="all">
    <target name="all"
    depends="clean,build-service,deploy" />
    <target name="clean">
    <delete dir="output" />
    </target>
    <path id="*my.path*">
         <pathelement path="/home/suresh/bea/jdk160_05/lib/tools.jar"/>
    <pathelement path="/home/suresh/bea/wlserver_10.3/server/lib/weblogic.jar"/>
    </path>
    <taskdef name="jwsc"
    classname="weblogic.wsee.tools.anttasks.JwscTask" classpath="/home/suresh/bea/wlserver_10.3/server/lib/weblogic.jar" />
    <target name="build-service">
    <jwsc srcdir="HelloWorld" destdir="output/helloWorldEar">
    <jws file="ping.java" type="JAXWS"/>
    </jwsc>
    </target>
    <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" classpath="/home/suresh/bea/wlserver_10.3/server/lib/weblogic.jar"/>
    <target name="deploy">
    <wldeploy action="deploy"
    name="myproject"
    source="output/helloworldEar" user="weblogic"
    password="weblogic"
    adminurl="t3://${wls.hostname}:${wls.port}"
    targets="${wls.server.name}"/>
    </target>
    </project>
    3) after that how to start weblogic and how to set any needed env or domain properties.How to publish it to server?
    4) how to configure security
    can i use netbeans to do all the above things?
    Thanks
    Suresh

    what my.path indicates in the above wsdl?
    or which path i have to give there?

  • Failure to create Web Service using Java client

    Attempting to create a WebService using a Java client (partial code follows):
    String xml = "<custId xmlns=\"http://samples.otn.com\">" + 101 + "</name>";
    //Context ic = new InitialContext();
    Locator lctr = new Locator("default", "bpel");
    IDeliveryService dservice = (IDeliveryService)lctr.lookupService(IDeliveryService.SERVICE_NAME);
    NormalizedMessage nm = new NormalizedMessage();
    nm.addPart("payload", xml);
    However - get the following error message:
    E:\OraBPELPM_1\jdk\bin\javaw.exe -client -classpath E:\OraBPELPM_1\integration\jdev\jdev\mywork\Workspace1\BPELProcess1\output;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\orabpel.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\orabpel-common.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\orabpel-thirdparty.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\bpm-infra.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\bpm-services.jar -Dhttp.proxyHost=ges-proxy.oracle.com -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=jpa*.jp.oracle.com|jpe*.jp.oracle.com|*.oracle.co.jp|144.23.230.118|144.23.230.110|psh*.peoplesoft.com|*.us.oracle.com|ex*.oracle.com|es0*.oracle.com|localhost|127.0.0.1 BusinessProcess.TestBPEL
    java.lang.Exception: Failed to create "ejb/collaxa/system/DomainManagerBean" bean; exception reported is: "javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.oracle.bpel.client.util.BeanRegistry.lookupDomainManagerBean(BeanRegistry.java:218)
         at com.oracle.bpel.client.auth.DomainAuthFactory.authenticate(DomainAuthFactory.java:83)
         at com.oracle.bpel.client.auth.DomainAuthFactory.authenticate(DomainAuthFactory.java:47)
         at com.oracle.bpel.client.Locator.<init>(Locator.java:65)
         at BusinessProcess.TestBPEL.main(TestBPEL.java:19)
         at com.oracle.bpel.client.util.BeanRegistry.lookupDomainManagerBean(BeanRegistry.java:232)
         at com.oracle.bpel.client.auth.DomainAuthFactory.authenticate(DomainAuthFactory.java:83)
         at com.oracle.bpel.client.auth.DomainAuthFactory.authenticate(DomainAuthFactory.java:47)
         at com.oracle.bpel.client.Locator.<init>(Locator.java:65)
         at BusinessProcess.TestBPEL.main(TestBPEL.java:19)
    Exception in thread "main" Process exited with exit code 1.
    The line: Locator lctr = new Locator("default", "bpel");
    is the point of the error -
    What is the problem here. I have seen several similar issues on the forum but I have not foound one that iindicated a solution to the problem.
    THANKS - Ken Cooper

    Applied the suggested code and am getting following errors:
    E:\OraBPELPM_1\jdk\bin\javaw.exe -client -classpath E:\OraBPELPM_1\integration\jdev\jdev\mywork\Workspace1\BPELProcess1\output;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\orabpel.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\orabpel-common.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\orabpel-thirdparty.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\bpm-infra.jar;E:\OraBPELPM_1\integration\jdev\jdev\lib\ext\bpm-services.jar -Dhttp.proxyHost=ges-proxy.oracle.com -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=jpa*.jp.oracle.com|jpe*.jp.oracle.com|*.oracle.co.jp|144.23.230.118|144.23.230.110|psh*.peoplesoft.com|*.us.oracle.com|ex*.oracle.com|es0*.oracle.com|localhost|127.0.0.1 BusinessProcess.TestBPEL
    java.lang.Exception: Failed to create "ejb/collaxa/system/DomainManagerBean" bean; exception reported is: "javax.naming.NoInitialContextException: Cannot instantiate class: com.evermind.server.rmi.RMIInitialContextFactory [Root exception is java.lang.ClassNotFoundException: com.evermind.server.rmi.RMIInitialContextFactory]
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
         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.oracle.bpel.client.util.BeanRegistry.lookupDomainManagerBean(BeanRegistry.java:216)
         at com.oracle.bpel.client.auth.DomainAuthFactory.authenticate(DomainAuthFactory.java:83)
         at com.oracle.bpel.client.Locator.<init>(Locator.java:126)
         at com.oracle.bpel.client.Locator.<init>(Locator.java:97)
         at BusinessProcess.TestBPEL.main(TestBPEL.java:30)
    Caused by: java.lang.ClassNotFoundException: com.evermind.server.rmi.RMIInitialContextFactory
         at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:219)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
         ... 8 more
         at com.oracle.bpel.client.util.BeanRegistry.lookupDomainManagerBean(BeanRegistry.java:232)
         at com.oracle.bpel.client.auth.DomainAuthFactory.authenticate(DomainAuthFactory.java:83)
         at com.oracle.bpel.client.Locator.<init>(Locator.java:126)
         at com.oracle.bpel.client.Locator.<init>(Locator.java:97)
         at BusinessProcess.TestBPEL.main(TestBPEL.java:30)
    Error occurs at the bold line below - same location as before:
    Properties props = new Properties();
    props.setProperty("orabpel.platform", "oc4j_10g");
    props.setProperty("java.naming.factory.initial",
    "com.evermind.server.rmi.RMIInitialContextFactory");
    props.setProperty("java.naming.provider.url", "ormi://localhost/orabpel");
    props.setProperty("java.naming.security.principal", "admin");
    props.setProperty("java.naming.security.credentials", "welcome");
    props.setProperty("dedicated.rmicontext", "true");
    Locator lctr = new Locator("default", "oracle", props);
    Thanks - Ken

  • How to use JAVA class in C++

    Hi people,
    is there anyone who knows how I can create and use JAVA class in C++ code. Example I have one JAVA class which works with database.
    One of the methods from this class returns XML string that represent result set. How to create instance of this class inside of C++ and have possibility to call this method.

    Hi, I'm also curious how to solve this.
    My problem is that I call a DLL from C++ that returns several values (e.g. function(a, b, c, &w, &x, &y, &z); )
    and I want to create a java class object that can be used to store these values so I can return 1 object
    Below I've written an abstract of the code
    Can someone help me with the parts in <> ??
    Thanks!
    Sander
    JNIEXPORT jobject JNICALL Java_nativeF(...a,b,c...)
       int w,x;
       float y,z;
       C_DLL_Function(a, b, c, &w, &x, &y, &z);
       //<Create Java Class 'Data' jobject>
       //<Call Data.setvalues(w,x,y,z) >
       return jobject;
    ...in java...
    class Data
      private int jw, jx;
      private float jy, jz;
      public function setvalues(int w, int x, float y, float z)
        jw = w;
        etc... 
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Want To create Zip file  using java,And Unzip without Java Program

    I want to create a zip text file using java, I know Using ZipOutputStream , we can create a zip file, , But i want to open that zip file without java program. suppose i use ZipOutputStream , then zip file is created But for unZip also difftrent program require. We cant open that zip file without writing diff java program.
    Actually i have one text file of big size want to create zip file using java , and unzip simply without java program.Its Possible??
    Here is one answer But I want to open that file normal way(
    For Exp. using winzip we can create a zip file and also open simply)
    http://forum.java.sun.com/thread.jspa?threadID=5182691&tstart=0

    Thanks for your Reply,
    I m creating a zip file using this program, Zip file Created successfully But when im trying to open .zip file i m getting error like "Canot open a zip file, it does not appear to be valid Archive"
    import java.io.*;
    import java.util.zip.*;
    public class ZipFileCreation
         public static void main (String argv[])
         try {
         FileOutputStream fos = new FileOutputStream ( "c:/a.zip" );
         ZipOutputStream zip = new ZipOutputStream ( fos );
         zip.setLevel( 9 );
         zip.setMethod( ZipOutputStream.DEFLATED );
    //     get the element file we are going to add, using slashes in name.
         String elementName = "c:/kalpesh/GetSigRoleInfo092702828.txt";
         File elementFile = new File ( elementName );
    //     create the entry
         ZipEntry entry = new ZipEntry( elementName );
         entry.setTime( elementFile.lastModified() );
    //     read contents of file we are going to put in the zip
         int fileLength = (int)elementFile.length();
         System.out.println("fileLength = " +fileLength);
         FileInputStream fis = new FileInputStream ( elementFile );
         byte[] wholeFile = new byte [fileLength];
         int bytesRead = fis.read( wholeFile , 0 /* offset */ , fileLength );
    //     checking bytesRead not shown.
         fis.close();
    //     no need to setCRC, or setSize as they are computed automatically.
         zip.putNextEntry( entry );
    //     write the contents into the zip element
         zip.write( wholeFile , 0, fileLength );
         zip.closeEntry(); System.out.println("Completed");
    //     close the entire zip
         catch(Exception e) {
    e.printStackTrace();
    }

  • Creating a triangle using polygon class problem, URGENT??

    Hi i am creating a triangle using polygon class which will eventually be used in a game where by a user clicks on the screen and triangles appear.
    class MainWindow extends Frame
         private Polygon[] m_polyTriangleArr;
                       MainWindow()
                              m_nTrianglesToDraw = 0;
             m_nTrianglesDrawn = 0;
                             m_polyTriangleArr = new Polygon[15];
                             addMouseListener(new MouseCatcher() );
            setVisible(true);
                         class MouseCatcher extends MouseAdapter
                             public void mousePressed(MouseEvent evt)
                  Point ptMouse = new Point();
                  ptMouse = evt.getPoint();
                if(m_nTrianglesDrawn < m_nTrianglesToDraw)
                                int npoints = 3;
                        m_polyTriangleArr[m_nTrianglesDrawn]
                      = new Polygon( ptMouse[].x, ptMouse[].y, npoints);
    }When i compile my code i get the following error message:
    Class Expected
    ')' expectedThe two error messages are refering to the section new Polygon(....)
    line. Please help

    Cannot find symbol constructor Polygon(int, int, int)
    Can some one tell me where this needs to go and what i should generally
    look like pleaseI don't think it is a good idea to try and add the constructor that the compiler
    can't find. Instead you should use the constructor that already exists
    in the Polygon class: ie the one that looks like Polygon(int[], int[], int).
    But this requires you to pass two int arrays and not two ints as you
    are doing at the moment. As you have seen, evt.getPoint() only supplies
    you with a single pair of ints: the x- and y-coordinates of where the mouse
    button was pressed.
    And this is the root of the problem. To draw a triangle you need three
    points. From these three points you can build up two arrays: one containing
    the x-coordinates and one containing the y-coordinates. It is these two
    arrays that will be used as the first two arguments to the Polygon constructor.
    So your task is to figure out how you can respond to mouse presses
    correctly, and only try and add a new triangle when you have all three of its
    vertices.
    [Edit] This assumes that you expect the user to specify all three vertices of the
    triangle. If this isn't the case, say what you do expect.

  • Need help with tomcat 5.5 and using java classes

    hey there,
    i am trying to set up tomcat 5.5 on my computer at home and have sucessfully done so. i have been trying to use Java classes inside my JSP files however tomcat thows an internal servlet error as follows:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 144 in the jsp file: /order.jsp
    Generated servlet error:
    ProductList cannot be resolved to a type
    An error occurred at line: 144 in the jsp file: /order.jsp
    Generated servlet error:
    ProductList cannot be resolved to a type
    An error occurred at line: 144 in the jsp file: /order.jsp
    Generated servlet error:
    Product cannot be resolved to a type
    i have the classes located as the setup tutorial recommends (root/WEB-INF/classes/) and still nothing works. i would appreciate any help anyone can give.
    thanks,

    Which tutorial are you following?
    As of java1.4, all classes must be in packages for them to work in Tomcat. This means your beans and servlets too.
    Put your beans in a package, and then recompile them, and put them in the right place.
    eg
    package com.mypackage
    public class MyClass ...
    once compiled would go into WEB-INF/classes/com/mypackage/MyClass.class
    Are you using Product and ProductList classes in scriptlet code?
    Have you imported them with a page directive
    <%@ page import="com.mypackage.Product, com.mypackage.ProductList" %> ?

  • How to create a Folder using java.

    Hi All,
    I have a doubt. I want to create a folder using java.
    Inputs are the destination where the folder should be created and the name of the folder. Plz help me in this regard.
    thanks and regards,
    Vincent .R.

    check out javadoc for java.io
    File reldir=new File("NewDir");//relatively where your program runs
    reldir.mkdir();
    File absdir=new File("C:/NewDir");//absolute path
    reldir.mkdir();
    File newdir=new File(absdir,"SubDir");//defines another dir under absdir
    newdir.mkdir();
    Gil

  • Creating aVirtual directory Using java

    Hai ,
    I am Using windows XP Operating system, I know how to create a directory using java,
    can you please suggest me a procedure to create a virtual(web share ) directory using java.
    waiting for your reply
    Thanks & Regards,
    Naga Raju

    Virtual Programmer is in the to share the directory
    over the Internet.No, that's a file/web server. :) I see, it's a Microsoft term.

  • Can I create Oracle Database using Java ???

    HI ...
    Can I create a Database using Java... ? If yes can any one tell me how ? I mean provide some codeing help... ???

    If you mean a table yes, since the create table statement is exactly that, an SQL statement, if you mean an SID then I would have to say (AFAIK) no.

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • Can i Use java Class

    Can any help, can i use java class in
    froms 6 or any one have designed form
    of progress bar please help me

    Thanks for your reply...
    Actually the task is quite simple... It requires me to do a better interface for a tomcat server folders...
    For example, users are free to access
    http://apache.oss.eznetsols.org/jakarta/tomcat-5/v5.0.12-beta/
    to download the tomcat... However, its index may not nice and easy for browing.. Therefore, the task requires a new dynamic page to access this server folder, and get all file names under this folder, anlaysis whether it is file or directory..and finally get its path....
    It is quite easy to do a JSP page, but I don't know whether it is possible to do by using JavaScript .... Although JS is running in client side, the user/client also can access the tomcat folder, why not JavaScript?
    Thanks a lot!
    SD

  • Developing webservices using Java SE6 and Tomcat Webserver

    Hi All,
    I am trying to develop a webservice using Java SE6 Beeta SDK with Tomcat webserver. I read somewhere in the Sun site and it says JAXWS2.0 is fully packaged with JAVA SE 6 SDK? If this is correct then what are all the remining packages(jar files present in JWSDP2.0) required to develop and publish the webservice.
    I does the setup as follows.
    - Install the Java SE6 SDK Beeta available.
    - Install Tomcat 5.17 webserver.
    - Started the webserver by setting java_home as SDK6.
    I am not able to publish the webservice with this setup
    Do i need to place any other package present in JWSDP2.0 in Tomcat_home/common/lib ?
    I used the same example present in JWSDP2.0 package.
    Please guide me regarding this?
    Thanks In Advance,
    Mohan

    Any ideas on how this could be achieved.Have you looked at the Unofficial Web Start FAQ at the Lopica site?
    - Gerald
    PS: You might wonna also consider posting your question to the Java Web Start developers group at Yahoo! See http://groups.yahoo.com/group/webstart

Maybe you are looking for