JAX-WS and JAXB 2.0 for ComplexTypes

I have a simple web service method that returns a string. I want to enhance this method to return a Java object. Do I have to explicitly use JAXB and have the web service method return the marshalled data string? And then unmarshall on the client side? Or does JAX-WS handle this implicitly?
For complex return types, what is the best practice when using JAX-WS? Are there any books out there for beginners?
Thanks

Maybee here
http://java.sun.com/webservices/docs/1.4/api/index.html

Similar Messages

  • Java Mapping Using JAXB [Java Arch for XML Binding]

    Hi All,
    Anyone tried using JAXB  [Java Architecture for XML Binding API available with Java WebServices Pack] technique for XML processing in Java Mapping??
    I am facing the following problems..
    1. I am not able to generate namespace while marshalling target XML [In standalone mode and not tried in XI].
    2. What are the jar files we need to import?
       I tried importing the following jar files in XI.
    jaxb-api.jar,jaxb-impl.jar,jaxb-libs.jar,jax-qname.jar,namespace.jar,relaxngDatatype.jar
      and getting some errors while importing these files in XI.
    3. It throws error at runtime [Interface Mapping-Test Tab]
       like Resource not found:javax/xml/bind/Messages_en.properties,javax/xml/bind/Messages_en_US.properties
    4. Even after creating a copy of available file Messages.Properties with name: Messages_en.properties and Messages_en_US.properties.. it is not generating any messages in Target message tab
    Thanks in Advance,
    Ananth Chinnaraj

    Sravya ,
    I have searched wide and far for this, but no success.
    A lot on JAXB XI and Webdynpro, but nothing on JAXB, XI and mappings.
    Could you please post the url here ?
    Thanks and kind regards,
    Jan

  • Bgm.ser and jaxb.properties not created

    Is there a particular reason to why the bgm.ser and jaxb.properties files are not created when a schema only consists of a simpletype and I run the binding compiler???
    The two files seem to be created when I include a 'dummy' complextype in the schema. Is a complextype needed in order for the files to be created?
    Cheers.
    Anders
    <simpleType name="Values">
        <restriction base="string">
            <enumeration value="ValueOne"/>
            <enumeration value="ValueTwo"/>
            <enumeration value="ValueThree"/>
            <enumeration value="ValueFour"/>
        </restriction>
    </simpleType>

    I've had the same exact problem! I had the property file in my JAR file properly, but the JAXBContext.newInstance( "package.name" ) call was failing - while at the same time I could load the property file via the ClassLoader just fine, by hand.
    I played around with source for the jaxb beta a bit and I think I found the problem. I recompiled the JAR file after changing the "fileSep" variable in the "searchforcontextPath" method from "file.separatorChar" to "/".
    This seemed to fix the problem. Well, the problem of it not finding the properties file that is... now I've got some kinda non-marshalable exception (but I haven't even spent 3 minutes on that problem yet, as opposed to the hours wasted on this bug).
    I'm not sure if this bug only cropped up when running under a Windows env or not (my test was running under JBoss on XP... though I was building/compiling under Linux).
    Anyway... to fix this just change that variable.. it's on line 228 (i think... i might have added some debug lines of my own in the code) of the javax/xml/bind/ContextFinder.java file. Then just re-jar it over the old JAR -- oh yeah, you'll need a few Message.property files from the jaxb-api.jar file for the new jar file to work (so make sure you unjar the old file 1st or back it up or whatnot).

  • XMLBeans and JAXB

    Can someone from BEA explain the relationship and/or differences between the proposed
    Java standard API for XML binding, JAXB, and XMLBeans? Obviously XMLBeans offers
    additional APIs, such as cursors and XQuery support (which is neat), but it seems
    to be non-standard and BEA-specific.
    In this context, are there any clear statements from BEA product marketing how
    the technology will be productized? Without that, it seems a bit dangerous to
    use...
    Thanks,
    PM

    XMLBeans and JAX-B are complementary technologies. JAX-B is a good technology
    for loading XML documents into Java objects – in constructing XMLBeans, we have
    attempted to be compatible with JAX-B naming conventions. However, JAX-B cannot
    necessarily preserve the full fidelity of XML documents, nor does it support 100%
    of schema. This is where XMLBeans is complementary - document preservation and
    support for extensibility are explicit goals of XMLBeans. Though JAX-B does not
    make this possible today, it is conceivable that XMLBeans will be an implementation
    of a future JAX-B spec as both technologies may converge together.
    Given the above statement, one may ask then why is that preserving full fidelity
    of the original XML document may be important? Consider the following advantages:
    (1) Sequencing and interleaving information is not lost in XMLBeans. There are
    schemas where you care whether <input> comes before <output> or <buy> comes before
    <sell> or the other way around. If you just give people a Java .getBuy() and
    a .getSell(), they've lost the ability to tell which came first. In XMLBeans,
    after the .get you always have the ability to grab an XML cursor on the <buy>
    and another one on the <sell> and ask which one came first.
    (2) Information that comes into wildcards are not lost in XMLBeans. Consider
    the regularly used <xsd:any> and <xsd:anyAttribute> features of schema that allow
    any data to appear in the document. With JAX-B, for example, the specification
    does not specify how an implementation handle content that it does not know how
    to map to a Java representation. But with XMLBeans, you can see where and how
    your document has been extended at the wildcards, and change or manipulate the
    wildcarded data. Furthermore, something cool is that if you have compiled schemas
    for the wildcarded data you can even coerce the wildcards to strongly-typed XMLBeans
    and keep on drilling in conveniently. A common use case for this is processing
    WSDLs: the w3c schema for WSDL uses wildcards for nearly every interesting piece
    of data in a WSDL.
    (3) Loading, modifying, and saving an XML document using XMLBeans, you won't lose
    all the "other stuff" that human beings don't want to lose on human-readable XML
    files, namely comments and all that extra pretty white space between things.
    (Unless you want to lose it; XMLBeans can be put in a mode where it is used to
    strip extra white space too.)
    (4) The architecture is set up so that 100% of schema types can correspond one-to-one
    with a Java type. This is perhaps a subtle benefit, but it is powerful because
    it means that there are "no regrets" and "no dead-ends" later. You never run
    into a schema type that can't be subclassed because of Java problems, or some
    extension that has some data that can't be accessed from Java.
    I hope this helps shed some light on the complementary relationship between XMLBeans
    and JAX-B.
    Regards,
    Samir
    "Peter Meyer" <[email protected]> wrote:
    >
    Can someone from BEA explain the relationship and/or differences between
    the proposed
    Java standard API for XML binding, JAXB, and XMLBeans? Obviously XMLBeans
    offers
    additional APIs, such as cursors and XQuery support (which is neat),
    but it seems
    to be non-standard and BEA-specific.
    In this context, are there any clear statements from BEA product marketing
    how
    the technology will be productized? Without that, it seems a bit dangerous
    to
    use...
    Thanks,
    PM

  • Reusing JAXB generated classes for XSDs included in other XSDs

    Hi,
    I use xsds with jaxb in a number of related projects. To avoid duplication I've factored out commonly used elements into their own xsd in a separate project. I then include these in the xsds that need them.
    I generate classes with jaxb for each project. I'm now trying to get jaxb so far as to reuse the already generated classes for the common elements.
    For example: I have a general xsd Person.xsd for which I generate classes in common.xsd. I have another xsd Project.xsd that includes a reference to the Person element. When i let jaxb generate classes for Projects.xsd, it will also generate a project.xsd.PersonType and so on.
    Is there any way to tell JAXB to use the existing classes? I've played around with the <jxb:javaType> bindings, but I can't get it to work yet. It gives me a "bindings not used" warning and doesn't compile. Also, if this is in fact the way to go, what do I specify as the parseMethod and printMethod attributes for the javaType element?
    Thx for any help

    JAXB questions should be better directed to the users list of http://jaxb.dev.java.net/
    you should subscribe to the 'users' mailing list, then post a question there.
    Thank you!

  • JSP and JAXB

    DB Structure
    Parent Table - Incident --> Child Table - IncidentCharges --> Child Table of IncidentCharges --> IncidentChargeWeapons
    Container
    Oracle Containers for JAVA(OC4J)
    We have a schema (Incident.xsd) which comprises of our entire database structure. We unmarshalled the schema using JAXB to Java classes and interfaces .
    It created 2 .java classes and 2 .java interfaces for each high level tag . for eg for our Incident tag it created a Incident interface and a IncidentType Interface
    and also it created 2 classes IncidentImpl and IncidentTypeImpl . The IncidentTypeImpl has all the get and set properties we require eg. getIncidentType,
    setIncidentType,getIncidentNumber,setIncidentNumber,getOccuranceDate,setOccuranceDate etc.
    Our objective is to create a JSP page which has form fields to enter data which use these JAXB generated classes get and set properties. In other words
    we want to bind the JSP form fields to these JAXB generated classes. And once these JAXB objects are populated we want to marshal it and create a XML file with the data from those JAXB . Our database would then consume the generated XML. We tried creating a simple incident form with just 3 fields IncidentType,Occurance date and Incident Number and tried to bind these fields with the properties from IncidentTypeImpl classes using the <jsp:usebean> tag . When we deployed it to our container and tried to load the Incident.jsp page , it would not load up . Only when we cleared all the bindings it loaded up .
    Then we tried another workaround (just to get it working. Not a preferred approach) . We created another simple JAVA bean(not JAXB generated beans) which has set and get properties for the form fields and bound the form fields to it.
    On submitting the JSP page we called a servlet which takes data from our created bean and transfers it to the JAXB generated IncidentTypeImpl bean. When we deployed this the jsp page loads up and also our bean is filled with data . But the servlet bombs with this error below.
    500 Internal Server Error
    java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
    at Servlets.IncidentServlet.doPost(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)
    We have 2 questions .
    1. Can a JSP page be bound directly to this JAXB generated bean in pretty much the same way as we bind it to our own bean ? (We would like to do this so that we dont have to create duplicate classes which mirror the JAXB generated classes.)
    2. Is there something special we have to do to deploy this application to recognize the JAXB classes. Do we have to deploy some jar file for it to recognize those classes ?

    I've used oracle's xdk to generate both the interfaces and the implementation classes. Next i've implemented a service class with some methods to return java classes as generated by oracle's jaxb. The return types of these service methods are interfaces, not the implementation classes.
    I can generate an adf data control for this service class, but the data control palette doesn't show the attributes for the jaxb generated classes (i have changed the bean class property in the data control description xml file).
    It's not possible to ignore the interfaces and just use the implementation classes, as the implementation classes specify their return types in interfaces. I don't want to rewrite all the generated code.

  • One project with two different web services styles (JAX-RPC and JAX-WS)

    Hi theres,
    how come the same project doesn't support two different web services styles?
    First time I create a web service proxy using the wizard, the second step is to choose between JAX-RPC and JAX-WS. After that, this step is removed from the wizard and all subsquent web services are assumed to be the same style as the first one.
    Can someone explain me why?
    thanks in advance,
    Manuel Leiria

    Hi,
    yes, I think to remember that there is support for a single style only. If you need another one too then you create a new project.
    Frank

  • Jax-rpc and xsd x:any/

    I am using JAX-RPC to build a client for a web service. Some of the operations on the web service include an <x:any/> element in the response. JAX-RPC generates a corresponding javax.xml.soap.SOAPElement for each of the elements defined as <x:any/>.
    The web service operation, that I am building the client for, is truly generic. It takes in a parameter that is a sql query string and so the respones for the web service could and will be many different sizes and shapes. I'm curious if there are any frameworks that will aid in my handling of the SOAPElement objects. I am currently the JAX-RPC that comes with apache AXIS 1.3 for the web service client.
    Does JAX-RPC or AXIS provide functionality for handling the SOAPElements so that I do not have to write code for each custom query that may be invoked on this web service? I would prefer handIe this in a more generic and abstracted manner. I realize that I can traverse the SOAPElement, but this seems very ugly.
    Are there examples of how this is usually done.?

    Thanks. I am using Hibernate as well. Unfortunately, I did not develop the web service itself and are only tasked with invoking it. We have no control over how the web service is defined or developed. So, I am forced to deal with the SOAPEnvelope. Any insight as to frameworks that will help parse the SOAPEnvelope would be appeciated

  • Jax RPC and security

    Hello
    i have a little question about the jax rpc and security stuff
    i have a webservice running
    once over http://localhost:8080/appl/service
    and over ssl too http://localhost:8443/appl/service
    i am starting the server and then the client is generating static stubs over the ...8080/appl/ws/service?WSDL
    is it possible to let the client application generate the stubs over the https port?
    or do i have to secure the files on port 8080 via authentication then let the ClientDeveloper download the wsdl-files and let him then create the stubs with a local copy of the wsdls?
    Any sugestions?
    Thx for any Ideas
    Michael / Adraw

    Michael / Adraw,
    Sorry for piggybacking on your request but I see you have your web service running on over SSL. When I tried that with the jwsdp 1.3 I am unable to browse pages over SSL with netscape and I can not connect with a client web services application (written in java).
    Are you able to do this with jwsdp 1.3??
    Brian Mason
    [email protected]

  • Jax-rpc and rmi confusion

    I'm new to the jax-rpc, and I'm very confused about jax-rpc, if it is using RPC (remote precedure call), why we have to import java.rmi.Remote ? is it somewhere still using RMI?
    Thank you in advance for you answer!

    Found some answer from the following link
    http://forum.java.sun.com/thread.jsp?forum=331&thread=465860

  • JAX-RPC and Parameter Interfaces

    I am designing the Web Service interface for our project using JAX-RPC, and have enjoyed the ease with which I can create Web Service deployments and WSDL documents.
    However, some of the developers on my team have chosen to create their Data Transfer Objects as a pair of Interface and Implementation classes. This works okay in scenario where the WS caller is "pulling" data from my service. However, it doesn't work in the scenario where the caller is "pushing" data to the service because JAX-RPC can't make the connection between the interface and implementation classes used in my service interface.
    For example, suppose there are four classes in the project: MyService, MyServiceImpl, Foo, and FooImpl. The MyService class uses Foo in it's method signatures. How does JAX-RPC know to instantiate an instance of FooImpl for incoming requests?
    public class MyServiceImpl implements MyService {
    // not ok
    public void doStuff (Foo arg) { ... }
    // ok
    public Foo giveMeStuff () { ... }
    It would be nice if JAX-RPC provided annotations that facilitated making connections between interfaces and implementation classes used in service inputs and outputs. For example:
    @WebServiceInterface {
    Implementation=FooImpl
    public Foo {
    Any thoughts? Thanks,
    Scott Kidder
    http://urlgrey.net/

    Found some answer from the following link
    http://forum.java.sun.com/thread.jsp?forum=331&thread=465860

  • JAX-RPC and (not versus) JAX-WS

    hi all!
    I know (after some reading on java.net and java.sun.com) that JAX-RPC and JAX-WS are incompatible versions of the same underlying idea.
    But i read on JAX-WS FAQ at java.net that:
    JAX-WS and a JAX-RPC based service CAN co-exist
    ... now this is a little confusing for me. Does this mean that a server can have two web services deployed; one coded with JAX-WS and other with JAX-RPC... OR... does that mean that i can code a webservice using JAX-WS and a JAX-RPC based client can invoke that webservice.???
    Because if the second thing is true, then it is really cool (and would be reason of simplifying things for me).

    Found some answer from the following link
    http://forum.java.sun.com/thread.jsp?forum=331&thread=465860

  • Basic doubts regarding ssl with tomcat 5.5  and netbeans 5.5 for WSDL?

    I've just started my preparation of web services. I'm using JAX-WS to create my web services and client. I'm using Tomcat 5.5(not apache axis) to deploy my web services over https and i'm able to do that. I've configured my keystore and keystorepassword in tomcat's server.xml. After i've configured my web.xml to choose security type(choosen CLIENT-CERT). I'm able to run my web services over https. I'm using IDE as netbeans 5.5.
    But to access this web service from core java client, i'm unable to do it. I've configure my jvmargs in the project-properties-run tab of netbeans and have given keystore,keystorepassword,keytrust,keytrustpassword. After all this i've also export it to the trustcacerts of tomcat. I want to run this using jax-ws. I've searched for many tutorials of this jax-ws , but all were in vain. Eventhough i've checked in java.dev.net site for tutorial but didn't find for my need. Everywhere they metioned on glassfish,wsit or some other technologies.
    Right now i'm totally confused. I've read some little bit things of all these things and finally land it in the middle of the sea. Could anyone provide me the basic concepts or any url for this.
    After all this i'm getting exception as : https hostname should be <localhost>. I'm totally confused what to do.
    One more thing i just wanted to know that i'm diving into the jax-ws technology, is that right to buil an application on this or should i use JAX-RPC. Which one is better for accessing the url and should be secured from security propects. Also tell me is that possible to build web services on https with using tomcat5.5,jax-ws and netbeans 5.5 or should i need some technology for start up.

    Any kind of help are welcome.

  • XML and JAXB

    Hi All,
    I am planning to use Oracle XML DB 10g for persistence of XML documents and JAXB for XML-Java conversions. I would like to know
    <ul><li>     Whether this is a good approach or any better approch exists. The aim is to allow manipulation of the XML documents in XML DB tables from Java layer. </li>
    <li>What is the best way to retrieve the XMLTYPE columns using the JDBC APIs for THIN driver?</li>
    </ul>
    Thanks,
    Ramesh

    It's a bit cumbersome, but I guess as a hack , after generating your xml file, you could try just reading the input file using a regular FileReader, then writing out just the lines that start with <!doctype & <? xml > (they should be at the top right, so you know the location in the output file). Of course the efficiency for this is terrible--you're reading & writing the file all over!
    That's an interesting analogy, heh. One of the surprising things I found about JAXB is that it doesn't validate enumerations (as far as I know).

  • Does the NetWeaver04Sr1 support JAX-RPC101 and JSR109 Standards?

    Does the NetWeaver04Sr1 support JAX-RPC101 and JSR109 Standards of Web Services???
    thank you very much?

    Hi Frank,
    I think this is only partially true.
    This enhancement only affects the condition editor (i.e. the namespaces within xpathes). For External Definitions the restriction persists. However, there is a simple workaround.
    When having defined your External Definition you will see a correct WSDL on the WSDL-tab. This WSDL contains the required message definitions. Unfortunately these message definitions are not displayed on the messages-tab because the target namespace of the WSDL is too long.
    Here is what you can do in this situation: Download the WSDL to your local file system. Edit this WSDL with notepad. Thereby simply replace the target namespace of the WSDL (not of the XSDs in the types-section!) by a shorter one. Upload this WSDL as another External Definition (category WSDL). You may worl with this External Definition now.
    This works because the target namespace of the WSDL has no influence on the structure of the message.
    Greetings
              Stephan
    Remark: Frank Beunings has added his answer inbetween. My answer was to Frank Bakermans.
    Message was edited by: Stephan Naundorf

Maybe you are looking for

  • Can I use my iMac i5 as a WiFi base station?

    I have an iMac i5, which is supposed to have a built-in Air Port Extreme card. My problem is that my regular WiFi (a Verizon-supplied FiOs combination WiFi/Router) is for some reason not working well the past couple of days. We can't figure out why,

  • Remove an iCal event without sending updates?

    So... I have a thorny question that nobody seems to have an answer to. I use my Mac at work (as well as at home). I have 2 calendars- 'Work' is connected to my Exchange account. 'Home' is synced through iCloud. For some inexplicable reason, when I ge

  • Download as a CSV file (excel)

    hi all, I am trying to download it as a CSV file (local and unix files), but when i get the data in excel , the issue occurs is: F1     F2     F3                                         OU Code     OU Name     OU Description                          

  • Pass data from BSP to WebDynpro Abap

    Hi, Can anyone pls tell how to pass the data from BSP to WD4A Application. I am trying to call the WDA URL using the class CL_GUI_FRONTEND_SERVICES in BSP,but it is giving a run time error. How to call the WDA URL from the classes in BSP & not using

  • NI-488.2 no instruments found

    Using PCI-GPIB card with NI-488.2 version 1.6 (or 1.7) and Windows NT 4.0: - If a GPIB instrument is at GPIB address 1 on PCI-GPIB configured as GPIB1, this instrument is not found using N.I. "Scan for instruments" utility. If I change this GPIB inst