Creating WS from Java Clases

Hi! i was trying to create a JAX-WS Web Service from a Java Class, a simple Hello World example and i found some things.
- I can not select the type of encoding from binary data, the selected and disabled option is MIME, but what if i need to select MTOM for encoding?
- For all the options of the wizard for Web Services, JAX-RPC and JAX-WS it uses Java Annotations, for a service created with JAX-WS the wizard only defines the WebService annotation but not the methods annotations, the final Service will work in this way?
- where is the wsdl file for the service?
- When i create a WS without SEI, and rigth click over the Service and select "Show WSDL from Web Service Annotations" i get this exception:
oracle.j2ee.ws.common.tools.api.ValidationException: java.lang.reflect.InvocationTargetException
     at oracle.j2ee.ws.tools.wsa.JavaToWsdlTool.processJSR181Annotations(JavaToWsdlTool.java:822)
     at oracle.j2ee.ws.tools.wsa.JavaToWsdlTool.getModelInfo(JavaToWsdlTool.java:688)
     at oracle.j2ee.ws.common.tools.wscompile.CompileTool.createConfiguration(CompileTool.java:429)
     at oracle.j2ee.ws.tools.wsa.AssemblerTool.run(AssemblerTool.java:93)
     at oracle.j2ee.ws.tools.wsa.JavaToWsdlTool.run(JavaToWsdlTool.java:202)
     at oracle.j2ee.ws.tools.wsa.JavaToWsdlTool.createWSDL(JavaToWsdlTool.java:129)
     at oracle.j2ee.ws.tools.wsa.Util.createWSDL(Util.java:1050)
     at oracle.jdeveloper.webservices.model.java.generator.CreateWSDL.createWSDL(CreateWSDL.java:280)
     at oracle.jdeveloper.webservices.model.generator.CommonCreateWSDL.action(CommonCreateWSDL.java:62)
     at oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAction.java:126)
     at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at oracle.j2ee.ws.tools.wsa.JavaToWsdlTool.processJSR181Annotations(JavaToWsdlTool.java:789)
     ... 10 more
Caused by: java.lang.NullPointerException
     at oracle.j2ee.ws.common.util.JavaModelHelper.fixupNameForJot(JavaModelHelper.java:468)
     at oracle.j2ee.ws.common.util.JavaModelHelper.getJavaClass(JavaModelHelper.java:63)
     at oracle.j2ee.ws.common.metadata.BaseEndpointMetadataBuilder.generateServiceEndpointInterface(BaseEndpointMetadataBuilder.java:482)
     at oracle.j2ee.ws.common.metadata.BaseEndpointMetadataBuilder.process(BaseEndpointMetadataBuilder.java:400)
     ... 15 more
this options of the rigth click are not available when i create a WS with SEI (Service Endpoint Interface).
Thanks a lot for answers!
Regards and blesses!

Daorte,
Thanks for your questions:
- in JAX-WS MTOM is selected as a policy (see the policy page in the ws editor)
- method annotations are inserted when needed, by default all public operations are exposed by @WebSerrvice but if you want to select a subset then @WebMethod comes in
- for annotated services the wsdl must be retrieved from the server (manually by adding "?wsdl" at the end of the url, or use the Resource Pallete to browse to a deployed service and invoke Test WS)
- Known bug re. wsdl for annotated service
Guus Ramackers (JDev PM)

Similar Messages

  • Read, Write and create files from java applet.

    Dear All,
    I have created a two files. One is applet and one application file. I am creating a instance of application file in applet. Application file is used for reading, writing and creating files. When I invoke applet from broser it dipslays error wrt file access permission. From the forum search I know that we need to sign the applet / edit the java policy to run the code locally. Final delivery of my code should execute on different system. Its not web. I have created a html page on submitting the form it invokes applet to read the form values from param and needs to update the values in xml file located locally. Please help me on how I can proceed with this fix.
    Thanks in advance.

    Sorry if I have not stated the problem clearly. I need to update content to files hosted in local system using java applets.
    I belive there are two ways to achive that.One with jar signer and one with modifying the java policy file. But this application needs to be installed in different system locally as I have created a application with webpage as useinterface and need to update the content in local files on submission. Not sure on how to modify the java.policy files in each end user system and whats the value we need to update in java policy file. Please help me on the steps to be followed

  • Trouble creating jar from java applet in eclipse

    I have a java applet in eclipse which I can run, however, I need to be able to view the applet in IE, because certain pieces wont work when I run within eclipse. When I attempt to export the project to a jar it asks for a main class, which does not exist. Can someone please help as to how I can launch my applet from eclipse into IE, or how I can export it as a jar?
    Thanks!

    Don't you just use copy the class from your workspace and embed it in your HTML by pointing to it's new location. Eclipse only asks for the main class when exporting an executable Jar anyways. Why don't you just get the class and putting in your directory with your HTML?

  • Creating an auto incrementing field with CREATE TABLE from Java

    I'm using the "sun.jdbc.odbc.JdbcOdbcDriver" to get a connection towards an ODBC data source that's linked to a Access (.mdb) database.
    I've tried various combinations in my CREATE TABLE statement execution in order to create a table with an auto incrementing integer but neither of them work, not even the most obvious one:
    stmt.executeUpdate("CREATE TABLE mytable(uid integer AUTO_INCREMENT PRIMARY KEY);");
    I always get this runtime exception: *java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition*; and AUTO_INCREMENT is the problem. I've tried all variations like AUTO, INCREMENT, AUTOINCREMENT and such, but nothing works.
    I've looked everywhere but couldn't find an answer to this. Thanks for the help.

    You used MySQL syntax. I think you agree with me that Access isn't a MySQL database. Either use MySQL with a real JDBC driver (recommended) or use Access syntax.
    That said, creating databases and tables using Java is a bad idea. The database and table must be already there. With Java you just do the usual table operations like select, insert, update and delete. Nothing more is needed.

  • Creating XML from java Code

    Hello @ll,
    I need a java code to convert XML file ,which has one node to again a XML file with multiple nodes,depends on the content of source XML File....
    The source structure is something like this:
    <Name>abcd;xyzw;prs</Name>
    and the target structure is something like:
    <FirstNAme>abcd</FirstNAme>
    <MidNAme>xyzw</MidName>
    <LastName>prs</LastName>
    the length of the data is not fixed. and ";" is used as a seperator.
    I have hundred such nodes on the target side.
    How do i acheive this
    Thanks in Advance.
    With Regards,
    BVS

    DEVELOPEMENT-THRILL wrote:
    hi ,
    what i think he can convert the xml to java object by using xstream then he can do his desired work in java and again he can convert it to xml by using xstream again.
    RegardsAn enormous waste of time, though. His "desired" work doesn't need any Java at all, beyond maybe kicking off the transform. Seriously, you've given some poor advice - as we all do from time to time - just accept it rather than try to justify it in retrospect. One of the biggest mistakes you can make as a developer is to use the same tool for everything simply because you already know how to. XSLT and XPath are enormously useful tools to have kicking about, and pretty trivial to learn as well. What could take dozens of lines of Java to achieve could take a single XPath query. Which would you prefer?

  • Error finding/creating AM from Java Concurrent Program

    Hi All,
    Here is what I am attempting to do in a Java concurrent program
    --------------- Code Start - Error description in the code snippet comments ---------------
    public void runProgram(CpContext pCpContext)
    DBTransactionImpl mDBTransactionImpl
    = new DBTransactionImpl(pCpContext.getJDBCConnection());
    OAApplicationModule am = null;
    // At this point I tried to call various methods on DBTransactionImpl
    // And each method call, causes the CP to error with a different exception
    // Calling findApplicationModule() causes the following exception
    // java.lang.NullPointerException
    // at oracle.jbo.server.DBTransactionImpl.findApplicationModule(DBTransactionImpl.java:4840)
    // at xxicon.oracle.apps.xbol.pa.cp.XXIconImportUnitsFrmXls.runProgram(XXIconImportUnitsFrmXls.java:101)
    // at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    am = mDBTransactionImpl.findApplicationModule(IMPORT_UNITS_AM_INS);
    // Calling createApplicationModule() causes the following exception
    // java.lang.NullPointerException
    // at oracle.jbo.server.DBTransactionImpl.createApplicationModule(DBTransactionImpl.java:4954)
    // at xxicon.oracle.apps.xbol.pa.cp.XXIconImportUnitsFrmXls.runProgram(XXIconImportUnitsFrmXls.java:109)
    // at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    am = mDBTrx.createApplicationModule( IMPORT_UNITS_AM_INS
         ,IMPORT_UNITS_AM_DEF);
    // Calling isConnected() causes the following exception
    // java.lang.NullPointerException
    // at oracle.jbo.server.DBTransactionImpl.isConnected(DBTransactionImpl.java:4335)
    // at xxicon.oracle.apps.xbol.pa.cp.XXIconImportUnitsFrmXls.runProgram(XXIconImportUnitsFrmXls.java:65)
    // at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    if (mDBTransactionImpl.isConnected())
    // Log the fact that DBTrx is connected
    --------------- Code End - Error description in the code snippet comments ---------------
    Would someone be kind enough to tell me what is it that I am doing wrong here?
    Thanks a ton!
    KH
    Message was edited by: Kiran
    kiran.k.hegde

    Kiran,
    How did you convert/cast the CpContext into an AppsContext to supply to createRootAM?
    Would you maybe share some more code?
    Update
    No need for that, a simple
    public void runProgram( CpContext ctx )
    String amName;
    String methodName;
    OAApplicationModuleFactory amF = new OAApplicationModuleFactory();
    OAApplicationModule am = amF.createRootOAApplicationModule( ctx, amName );
    am.invokeMethod( methodName );
    will do...
    Message was edited by:
    TyskJohan

  • How to create and execute PL/SQL program or Procedure from Java (JDBC)

    hi all,
    user will enter the Pl/Sql program from User-Interface. that program has to be create in DB and execute that.
    due to some confusions, how to execute this from Java, i (user) entered the same logic through a Procedure.
    my Java code is
    Statement st = con.createStatement();
    Statement.execute(procedure_query); // procedure name is myPro
    CallableStatement cs = con.prepareCall("{call myPro}");
    (as given in SUN docs - http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html)
    but its not creating the procedure.
    and i tried to run a procedure (which is already created) with CallableStatement, and this is also not working.
    how to get this.
    thanks and regards
    pavan

    Hi,
    SInce the PL/SQL block is keyed in dynamically, you probably want to use the anonymous PL/SQL syntax for invoking it:
    // begin ? := func (?, ?); end; -- a result is returned to a variable
    CallableStatement cstmt3 =
    conn.prepareCall(“begin ? := func3(?, ?); end;”);
    // begin proc(?, ?); end; -- Does not return a result
    CallableStatement cstmt4 =
    Conn.prepareCall(“begin proc4(?, ?); end;”);
    SQLJ covered in chapter 10, 11, and 12 of my book furnish a more versatile dynamic SQl or PL/SQL mechanisms.
    Kuassi
    - blog http://db360.blogspot.com/
    - book http://db360.blogspot.com/2006/08/oracle-database-programming-using-java_01.html

  • Parse errors while creating a Web service from Java class!

    Can anybody tell me please, is it possible to create a Web Service from java class where the input from user is required ?
    I have the following program, which is successfully compiled, but when I'm trying to make a web service in JDeveloper, the following error occurs:
    "Validation failed.
    The implementation class primePackage.isPrime ofport type MyWebService contains parse errors."
    import java.io.*;
    import java.util.*;
    class isPrime
    public static void main (String args[])
    Scanner reader = new Scanner(System.in);
    int n;
    System.out.println ("Enter a number you want to know is it prime or not");
    n=reader.nextInt();
    if (isPrime(n))
    System.out.println ("True");
    else
    System.out.println ("False");
    static boolean isPrime (int n)
    int i=2;
    while (i<=n-1)
    if (n%i==0)
    return false;
    i++;
    return true;
    }

    Hi,
    Can anybody tell me please, is it possible to create
    a Web Service from java class where the input from
    user is required ?Yes, the parameters of your method will be mapped in WSDL.
    But i've some considerations about your code.
    I suggest you change the name of isPrime do Prime, its a good code convention to put the name of class starting with Upper case. and isn't good the name of class equals to name of method.
    I suggest you to change the "static boolean isPrime (int n)" to "public boolean isPrime(int n)" to publish a method as a WebService method it's must be public and not static. After this change try to generate your Web Service.
    Regards.

  • Error while tesing a Datasource created from Java function

    Hi ,
    I am trying to create a datasource from java function.After build/deploy i am getting the following error . The java class i am using from the EvalGuide Sample. Anybody had similar issues ?
    regards
    GK
    weblogic.xml.query.exceptions.XQueryStaticException: {lib:TestLayer/xfl/library1}protectSSN:1, line 4, column 1: {err}XQ0017: "{lib:TestLayer/xfl/library1}protectSSN": unknown function (or number of arguments (1) is wrong)
         at com.bea.ld.server.XQuery.createInvocation(XQuery.java:228)
    i am using WLS8.1 sp 6 ,ALDSP 2.5

    I am testing from Test View.
    I tried build-->deploy-->redeploy several times.
    Pls find the complete trace below
    eblogic.xml.query.exceptions.XQueryStaticException: {lib:TestLayer/xfl/library}protectSSN:1, line 4, column 1: {err}XQ0017: "{lib:TestLayer/xfl/library}protectSSN": unknown function (or number of arguments (1) is wrong)
         at com.bea.ld.server.XQuery.createInvocation(XQuery.java:228)
         at com.bea.ld.EJBRequestHandler.invokeQuery(EJBRequestHandler.java:559)
         at com.bea.ld.EJBRequestHandler.invokeFunction(EJBRequestHandler.java:775)
         at com.bea.ld.EJBRequestHandler.executeFunction(EJBRequestHandler.java:339)
         at com.bea.ld.ServerBean.executeFunction(ServerBean.java:95)
         at com.bea.ld.Server_ydm4ie_EOImpl.executeFunction(Server_ydm4ie_EOImpl.java:954)
         at com.bea.ld.Server_ydm4ie_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:491)
         at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:120)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:434)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:429)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

  • How I can create a XML file from java Aplication

    How I can create a XML file from java Aplication
    whith have a the following structure
    <users>
    <user>
    <login>anyName</login>     
    <password>xxxx</password>
    </user>
    </users>
    the password label must be encripted
    accept any suggestion

    Let us assume you have all the data from the jsp form in an java bean object..
    Now you want a xml file. This can be acheived in 2 ways
    1. Write it into a file using java.io classes. Say you have a class with name
    write("<name>"+obj.getName+</name>);
    bingo you have a flat file with the xml
    2. Use data binding to do the trick
    will recommend JiBx and Castor for the 2nd option
    Regards,
    Rajagopal

  • Creating XML file from Java Bean

    Hi
    Are there any standard methods in Java 1.5 to create XML file from java bean,
    i can use JAXB or castor to do so,
    But i would like to know if there is any thing in java core classes,
    I have seen XMLEncoder, but this is not what i want.
    Any ideas
    Ashish

    Marshall JavaBean to an XML document with JAXB or XMLBeans.

  • Java.sql.SQLException: can't create statement from closed connection

    java.sql.SQLException: can't create statement from closed connection.
    at com.caucho.sql.QPooledConnectionImpl.prepareStatement(QPooledConnecti onImpl.java:411)
    I am getting this error with my JSP's, i am running on Resin on Win2k, and MySql as backend.
    Has anyone else also faced this issue ?
    Looking for someone to help me to solve this issue.
    rc

    Looking for someone to help me to solve this issue.Maybe you are closing the connections. You might want to verify that you are not doing that. Or if you are that that is the correct way to return the connection to the pool.
    Or you could have stale connections. Some databases will time out connections if the connection is no used in a while. (This is a good thing.) But this means connection pools must do something with connections that are not used for a while. The pools usually have a configuration option(s) which allows you to set up a keep alive message which keeps the database from closing the connection.

  • Insert data from java to oracle object created

    Hi
    How can i insert data from java to table test with column LIST_QRY_RES_DN_MEMBER_INFO as below after create object type
    CREATE OR REPLACE TYPE QRY_RES_SERVICE_VALUES AS OBJECT (
      PARAMETER_CODE            VARCHAR2(60),
      PARAMETER_VALUE           VARCHAR2(60)
    CREATE OR REPLACE TYPE LIST_QRY_RES_SERVICE_VALUES AS TABLE OF QRY_RES_SERVICE_VALUES;
    CREATE OR REPLACE TYPE QRY_RES_OPTIONS AS OBJECT (
      SERVICE_CODE            VARCHAR2(60),
      SERVICE_VALUE           LIST_QRY_RES_SERVICE_VALUES 
    CREATE OR REPLACE TYPE LIST_QRY_RES_OPTIONS AS TABLE OF QRY_RES_OPTIONS;
    CREATE OR REPLACE TYPE QRY_RES_MEMBER_INFO AS OBJECT (
      VARIABLE_CODE            VARCHAR2(60),
      VARIABLE_VALUE           VARCHAR2(120)
    CREATE OR REPLACE TYPE LIST_QRY_RES_MEMBER_INFO AS TABLE OF QRY_RES_MEMBER_INFO;
    CREATE OR REPLACE TYPE QRY_RES_DN_MEMBER_INFO AS OBJECT (
      DN                       VARCHAR2(60),
      MEMBER_INFO              LIST_QRY_RES_MEMBER_INFO,
      OPTIONS                  LIST_QRY_RES_OPTIONS
    CREATE OR REPLACE TYPE LIST_QRY_RES_DN_MEMBER_INFO AS TABLE OF QRY_RES_DN_MEMBER_INFO;
    CREATE TABLE test(
    DN_MEMBER_INFO          LIST_QRY_RES_DN_MEMBER_INFO,
    NESTED TABLE DN_MEMBER_INFO STORE AS LIST_QRY_RES_DN_MEMBER_TAB
        (NESTED TABLE MEMBER_INFO STORE AS MEMBER_INFO_TAB,
         NESTED TABLE OPTIONS STORE AS LIST_QRY_RES_OPTIONS_TAB
            (NESTED TABLE SERVICE_VALUE STORE AS SERVICE_VALUE_TAB));

    It appears you are trying to store java objects (types) in a database rather than raw data (string, int, date types) that the object contains. If so, I don't think that ever really caught on. Most programmers store the raw data, then pull it out and populate a class. The problem with storing the object is that new versions of classes come out and your old version is stored in the database. If you just store the data, you don't have to worry about what version is in the database. You can populate the new version of the class with the same data.
    Also, others can use sql to query your data and use it for their own use independent of what you intended it for. I think most people use the (browser) based utility that comes with the database to create the tables, normalize them, set up primary keys, set up foreign keys, etc rather then run an sql statement as you did above.

  • How to create an ODBC entry from Java

    From Java application, how can I create an ODBC entry in Ms Windows client?

    I know of two ways you could do this. One is very dangerous, but I will describe it here. ODBC DSN's are created using a GUI application from within the Windows Control Panel. The GUI application manages a set of files found in the Windows directory. You can find them if you search for the ODBC. You should find odbc.ini and odbcinst.ini. These are text files, and you can view there structure using notepad. A Java program could open a stream and append whatever information you want to into these two files. The danger is that if you do it wrong, you will corrupt ODBC for all applications, so be very careful with this method.
    The 2nd method, as I described above has been discussed (to death) within this forum. Just spend a little time searching, and I know you will find what you need to implement using that method. This is the method I would recommend using.
    Good Luck,
    Joel

  • Create web service from java code in Jdeveloper 11.1.1.5

    I am try to create web service from java code by default it is connected to Integrated web logic server and generate a
    WSDL like this.
    http://localhost:7101/javaexcel-project1-context-root/MyWebService1Soap12HttpPort.
    please tell me how we can change this local host to our needed Host and how to deploy this web service to web logic server.

    Hi,
    Just right click on your project and deploy it to your application server (Weblogic Server (Not the Integrated server)). {Before that, you have create your Application server connection in the Jdeveloper).
    After deployment open the Admin console of the weblogic server and find your ear of the project.Click on that (Go to the "Testing tab") and you will get the "WSDL" (Concreate wsdl)  and "Test Client" of the Project.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for