Java interface

Hello all,
I want to create a simple interface that can receive simple xml files(not wsdl) through an http connection in order to handle its data. I can't use Soap and Jax-rpc because the sender is n't using this technologies.He just sends an xml file to me. Can anyone give some details of how can i do this ?
Thank you

Sure take a look at JAX-WS. You can use the Provider interface. There is a sample showing how this is done. http://jax-ws.dev.java.net.

Similar Messages

  • Java Interface Question.

    There are classes in the Java SDK, such as the Interface:
    org.w3c.dom.Document
    that have factory methods in them that carry out actual operations.
    But how can this be possible, because when I program an interface:
    public interface test {
    public void setString(String s);
    It will only compile thus, with no implementation on the method signatures?
    How do Java interfaces with factory methods to this?
    org.w3c.dom.Node is another one. Where does the functionality/method implementation
    come from?

    public interface MyInterface {
         public void method1();
    class MyImplementation implements MyInterface {
         public void method1(){
    public class MyFactory {
         public static MyInterface createMyInterface(){
              return new MyImplementation();
    public class Test{
               public static void main(String args[]){
                      MyInterface x=MyFactory.createMyInterface();
                      x..method1();
    }Now can you understand this? Assume all These classes are separate classes. This is not a problem with inner classes. Before make a reply, try to understand it or post a reply as saying it is not clear rather than posting this kind of post.

  • Are Java Interfaces 'free'?

    From a performance point of view, are Java interfaces free?
    That is, if I have:
    class Foo
    public void bar() { ... // some code }
    }and I change it to:
    interface Foo
    public void bar();
    class FooImpl implements Foo
    public void bar() { ... // some code }
    }And I call one or other of the Foos like
    Foo foo // A parameter, field or local variable.
    foo.bar();Does calling foo through an interface add any overhead that calling it direct in the first example not? As I understand it, all methods are 'virtual' in Java, so it should perform the same in either case.
    Thanks for any of your thoughts.
    Rupert

    rupertlssmith wrote:
    YoungWinston wrote:
    The Second Rule of Program Optimization (for experts only!): Don't do it yet.”
    - Michael A. Jackson
    Basically, don't worry about it. Worry about writing clear, correct, object-oriented code.
    Wierdly enough, in the long run, that is more likely to help than anything else you can do, should (and if) you ever need to worry about optimization in the future.
    WinstonThanks for the advice. I can write good clear OO code. I am now at the future and worrying about optimization, so have made it past the second rule!Then you exactly know where your bottleneck is from the profiler you've used. Did it tell you that your interfaces are the bottleneck? If so, why do you even bother to ask here?

  • Java interface with Crystal Reports

    Post Author: [email protected]
    CA Forum: JAVA
    Hello everyone,I need to build a Java interface for JSP to interact with crystal reports.Could anyone recommend any book or forward me the url's where I can find the related material with examples. Eagerly Waiting for reply!Thanks,Prathima.

    Post Author: MJ@BOBJ
    CA Forum: JAVA
    The latest version of the Java Report Component (JRC) is available from the Diamond website.  This download is actually a plugin for Eclipse but you can still use the JRC runtime jars to use the SDK APIs in your JSP page.  You will also find lots of resources such as samples, videos, and forums to help you get started.  You can also refer to the DevLibrary for more information.

  • Java interface as an Axis Web Service

    Hi averybody:
    I'm developping an application containning a web service using Axis 1.2 with Tomcat 5.5.7. I had design a Java interface for the WS and create mi deploy.wsdd file for it using Message-style.
    Everithing goes right in deployment process, but when i try too use de WS from a client, i get de following error:
    Exception in thread "main" AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.InstantiationException: chatService.IChatServer
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname: visit18 (este el nombre de esta m�quina)
    java.lang.InstantiationException: chatService.IChatServer (esto es lo que da problema)
    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(Deseri
    alizationContextImpl.java:1015)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXPar
    ser.java:585)
    at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespa
    ceBinder.java:898)
    at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBind
    er.java:644)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(
    XMLDocumentFragmentScannerImpl.java:1008)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
    Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
    LDocumentFragmentScannerImpl.java:329)
    at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
    a:525)
    at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
    a:581)
    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
    ava:1175)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
    tionContextImpl.java:242)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
    at org.apache.axis.client.Call.invoke(Call.java:2553)
    at org.apache.axis.client.Call.invoke(Call.java:2248)
    at org.apache.axis.client.Call.invoke(Call.java:2171)
    at org.apache.axis.client.Call.invoke(Call.java:1691)
    at samples.message.TestChatMsg.doit(TestChatMsg.java:64)
    at samples.message.TestChatMsg.main(TestChatMsg.java:86)
    The code of my interface is this:
    public interface IChatServer {
    public void connect(SOAPEnvelope req, SOAPEnvelope resp);
    public void disconnect(SOAPEnvelope req, SOAPEnvelope resp);
    public void publishMessage(SOAPEnvelope req, SOAPEnvelope resp);
    public void retrieveMessages(SOAPEnvelope req, SOAPEnvelope resp);
    public void retrieveUsers(SOAPEnvelope req, SOAPEnvelope resp);
    Can anybody tell me what's happening here...
    Thanks.

    Hi, did you find out what the problem was ?
    I've got the same problem.
    Thanks,
    Lotte

  • Can I take Java interface as .h of C?

    Can I use Java interface as a substitute of .h files in C?

    It almost sounds as if you want to use C, not an OOP language like Java. So why not use C?

  • Java interfaces allow us to specify limited ways in which otherwise

    can anyone explain "Java interfaces allow us to specify limited ways in which otherwise dissimilar classes, from completely different parts of inheritance hierarchy, resemble one another." please?
    many thanks.

    An interface defines a contract which an implementing class must fulfill. As long as the implementing class is written properly, then it provides a specific, advertised behavior. There are no restrictions as to which classes may implement a given interface (in the sense that there are inheritance restrictions, such as single-inheritance, no inheritance loops, and the like). Therefore, any two arbitrary classes may implement the same interface, and therefore provide the same behavior.
    For example, the Iterator interface provides the ability to loop over a collection of objects in a well-defined way. Any class which implements Iterator would be manipulable in the same way, and could therefore be said to resemble each other.

  • Mediator To Spring Error-Could not convert from java interface to interface

    Hi,
    I have a requirement to using a Spring component and my composite application would be File Read -> Mediator -> Spring Component -> File Write.
    I have to read a file and using mediator map the same to the Spring input and write the Spring component output to a file.
    I have created a Java interface ( Package Name - transformtospring , Interface Name - TransformInterface) and also created a Java Class ( TransformImpl ) which implements the Interface in this package. Saved all these artifacts in SCA-INF/src folder of the application.
    My Spring Bean configuration file is as follows ( saved the file in the same folder as composite.xml )
    <?xml version="1.0" encoding="windows-1252" ?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:sca="http://xmlns.oracle.com/weblogic/weblogic-sca"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool-2.5.xsd http://xmlns.oracle.com/weblogic/weblogic-sca META-INF/weblogic-sca.xsd">
    <!--Spring Bean definitions go here-->
    <bean class="transformtospring.TransformImpl" name="TransformBean"/>
    <sca:service name="TransformService" target="TransformBean"
    type="transformtospring.TransformImpl"/>
    </beans>
    I have created a Spring Context which uses the above Spring Configuration. When i tried to map the mediator output to Spring , i'm getting an error shown below.
    " Could not convert from java interface to interface type wsdl . Exception=java.lang.ClassNotFoundException transformtospring.TransformImpl "
    Please do let me know where exactly i'm doing wrong.
    Regards,
    Sri.

    Hi All,
    I could able to work this one out now !!!
    But i'm having an issue mapping the input to this service. The method signature for the service is as follows:
    public byte[] processData(byte[] input) throws Throwable{
    So the input for this Service is a byte array. Now i'm mapping the data from a File Input ( Read File - opaqueElement ) to this service directly ( using mediator ).
    Now when i have looked into the message in the Enterprise Manager, following is the message structure from Read File input to the service.
    <message>
    <properties>
    <property name="tracking.compositeInstanceId" value="10009"/>
    <property name="tracking.ecid" value="bcd04297e25136e7:4869a9c:13316255efc:-8000-0000000000001f79"/>
    <property name="tracking.conversationId" value="TJ9PCcbtu3S0DA0GuxsGx13RYUb1NxHNndfk2PC8ukk."/>
    </properties>
    <parts>
    <part name="parameters">
    <ns0:processCollaboration>
    <arg0>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48bnMwOkFkZDJJbnB1dCAgeG1s bnM6eHNpPSdodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZScgeG1sbnM6 bnMwPSd1ay5jby5qZHdpbGxpYW1zLkFkZDJJbnB1dCcgeHNpOnNjaGVtYUxvY2F0aW9uPSd1ay5j by5qZHdpbGxpYW1zLkFkZDJJbnB1dCByZXF1ZXN0LnhzZCcPG5zMDpudW0xPjEwPC9uczA6bnVt MT48bnMwOm51bTI+MTY8L25zMDpudW0yPjwvbnMwOkFkZDJJbnB1dD4=+</arg0>
    </ns0:processCollaboration>
    </part>
    </parts>
    </message>
    and the corresponding response message ( No output ) back from the service is:
    <message>
    <properties>
    <property name="tracking.compositeInstanceId" value="10009"/>
    <property name="tracking.ecid" value="bcd04297e25136e7:4869a9c:13316255efc:-8000-0000000000001f79"/>
    <property name="componentName" value="ProcessCollab"/>
    <property name="tracking.conversationId" value="TJ9PCcbtu3S0DA0GuxsGx13RYUb1NxHNndfk2PC8ukk."/>
    <property name="compositeDN" value="default/CollaborationToSpring!1.0*soa_a8da1da7-f98f-4935-8d20-da9e7bc003cc"/>
    </properties>
    <parts>
    <part name="parameters">
    <processCollaborationResponse>
    <return/>
    </processCollaborationResponse>
    </part>
    </parts>
    </message>
    I have included System.out statements in my Java class , but its not printing anything in the logs.
    I'm under the impression that the underlying infrastructure ( mediator ) transparently encodes and decodes data from base64Binary to java byte array. So could anyone help me on this !!!
    Regards,
    Sri.

  • Could not convert from java interface to interface type wsdl ??

    i have a problem wheni have a problem when i develop bpel using mediator and wire to ejb service. When the mediator wire to ejb service, i found the error : Could not convert from java interface to interface type wsdl.... How to solve the problem?

    I followed the case closely (with the same name of classes, methods, etc), but still get the error: “Could not convert from java interface to interface type wsdl.Exception=nl.amis.calculator.Calculator”. I created a Java class to test the lookup and function correctly. However, when I try to wire a Mediator to this Reference, I run into an Interface Conversion Error. I’ve included the line javaInterface = “nl.amis.calculator.Calculator” in file composite.xml, but still get error. Could you help me?

  • Java interface with xml communication

    Hello everybody,
    For a project i need to make a java interface with xml communication.
    For example ; from 1 laptop I press on a java button and then i need to get a text message on the other laptop.
    The java interface is already created now the xml code for communication.
    I hope someone can help me how to start with the xml code.
    Are there any templates that i can use?

    I need to use XML for this, cause it is in the
    assignment.As far as communication is concerned, it doesn't matter that you are sending XML. You can send any kind of data. So first find out how to send data, then send data which is XML.
    I only want to know if its possible to send data/text
    from 1 laptop (windowsxp prof) to the other laptop
    (also windows xp prof).Provided the other laptop is running a server that can receive that data.
    Maybe its easier if I send data to a specific IP
    address?Provided there is a server running at that IP address that can receive that data. You can use an IP address to connect to a server but that has nothing to do with sending the data.
    Its important that the communication between 2 system
    is in XML language.XML is not a programming language. XML is a format for storing data. You can certainly send XML-formatted data between two computers.
    So i hope u have a solution for my problem.The solution would be for you to learn how communication between two computers works in the real world. If you have an assignment that says you have to make communication work, surely there was something taught to you before about how to do it?

  • Any good article on Java Interface usage principle?

    Hi All
    I find Java interface is quite good concept, but some expert mentioned in some article, "Don't over use it".
    Just wonderring anyone can point me to some good article on the internet on In what kind sceniaro we need use Interface, in which case we'd better not use it.
    Thanks in advance.
    Steven

    Then how do you explain some gurus said" don't overuse interface"?I explain it thus:
    (a) it doesn't actually contradict what the article says
    (b) 'don't overuse interfaces' is a tautology: it doesn't actually say anything very useful.
    On the other hand there's no reason why "some gurus" can't disagree with Holub. I disagree myself to a large extent. You can define your entire API as interfaces, but then you're committed to all kinds of factory methods, and provision of secret implementation classes, etc. This can get pretty tedious pretty quickly. And, somewhere or other, you must have at least one actual class, so that you can have either a static method or a constructor, so you can get hold of your initial factory, or factory builder, or factory builder factory, or factory builder factory builder, or wherever it is that you want to start.
    I've used frameworks where there were four different implementation classes for the same interface. Never did find out why. Something wrong somewhere.
    When you can keep your base classes stable, I don't see a reason not to use them. 'Base class fragility' is all that Holub is really complaining about, and there are lots of solutions to that, such as 'don't' for a start. Java is chock full of stable base classes.

  • Java Interface does not accept method that passes ArrayList...Why?

    Java Interface does not accept method that passes ArrayList...Why?
    for example...
    public interface Interface extends java.rmi.Remote
    public ArrayList getSomething(String ID) throws java.rmi.RemoteException;
    Why is this not acceptable?

    Java Interface does not accept method that passes ArrayList...Why?for example...
    ALSO:
    You are not 'passing' ArrayList, you are returning it.
    If you are 'passing' anything, it is String.
    ~David

  • Java interfaces as c++ controls?

    in my c++ program (windows), i need to use java interfaces (i.e. JFrame or JButton). i want to use c++ interface as container and java interface as its components (controls), is this possible? if yes, what is right tech to do that?
    thx

    Have a look at JNI (Java Native Interface). This is a way to link c++ and Java code.

  • Accessing java Interface

    Hi.
    Sorry for my bad english.
    I'm in trouble.
    I have became a complet HttpServer with a simple servlet.
    My servlet doesn't contains all of the functions, what I
    MUST to use.
    I have to use a givven Java Interface, to communicate via rmi
    between to java servers. There are givven java classes.
    I can execute a server, which creates some object.
    I'm interested to use these methods, or the interface.
    Somebody knows, how should i to try to do this?
    (I can create the JVM,
    I can access a class, but not a class of this projekt. classpath seems to be correct. How Can I use a Java Interface via JNI?)
    Thanks:
    Peter([email protected])

    post your error messages so we can see what java is telling you.

  • Contract-first : WSDL vs Java interface

    Hello,
    I am starting to work with web Service.
    Many blogs and articles suggest to write WebServices contract from a WSDL.
    I am a java Programmer. I totally agree with the contract-first and the data-driven communication concept.
    Here is my question: why use WSDL when you can convert any Java Interface and Bean into a WebServices?
    If a tool gives you the possibility to move from xml to java (and vice-versa), why not stay with a java interface?
    What are the pitfalls of using this technique (other than being too easy to change the contract)?

    The main reason why you would want to write WSDL first is to be able to create a more verbose XML schema. For instance, if you take a raw Java interface or class and convert from Java to WSDL/XSD everything ends up being optional because the converters have no idea what is supposed to be required versus what isn't as well as field length restrictions etc. Some of the newer tools may allow you to do this with annotations but I haven't really looked into this.
    Writing the XML schema first allows you to offload more work on the XML parser at run time because it can do the schema validation for you instead of you having to manually perform this. This also allows someone writing their own client to consume the WSDL and be able to generate a client that will do more work than one based off of Java classes (e.g. someone creating a .NET client can let the XML parser do some heavy lifting during the marshalling process before ever sending the request to your web service).

  • (262119469) Q WSC-15 Is the .ctrl file just a java interface?

    Q<WSC-15> Is the .ctrl file just a java interface?
    A<WSC-15> Yes. Any control that you generate in Workshop is really an interface definition
    for the methods that the enterprise component understands. You can then use those
    methods in the interface directly in your .jws code. The actual object that implements
    that interface and acts as a broker to the enterprise resource is generated during
    the compilation of the web service. This helps keep your web service code very simple.

    I don't see a way to do this. You want to transform a function to a variable. Even if that's a variable holding a function, these are incompatible.
    But you can just override the function in the class instantiation:
    var responder = Response {
        override function doResponse(input: String): String {
            return "JavaFX Rocks!"
    }

Maybe you are looking for

  • My MacBook Pro Hard Drive recently gave me the gray folder with the question mark of death. Even as

    My MacBook Pro Hard Drive recently gave me the gray folder with the question mark of death. Even as a Mac Newbie/Novice, I successfully installed a new hard drive and the OS (10.6.8) software from my installation discs. I have, however, lost the abil

  • Error on running jinfo in linux

    # A fatal error has been detected by the Java Runtime Environment: #  SIGSEGV (0xb) at pc=0x00002aaabab4fcd6, pid=32136, tid=1111173440 # JRE version: 7.0_15-b03 # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode linux-amd64 compressed

  • Join to multiple sql db's

    I have one table (user_projects) that lists user_id and project_id, a user table to get the user name and a project table to get the project name. These items are all contained in a single 'admin' database. Each individual project has a separate data

  • [Help] To prevent timeout error of browser in clinet with servlet in server

    Hi all, If a browser (for example, Internet Explorer) do not get any response from a server for more than sometime (in case of IE, default is 5 min), it will stop waiting and return some timeout error message. But I have a servlet, which has a really

  • Lost All My Songs

    Ok so I just went to plug my new iPod Classic 120gb into my computer this morning to make a playlist. I didnt think the plug was in all the way so I quickly pulled it out and then put it back in. I guess it had been in, and then me taking it out and