Paramer marshalling/unmarshalling in jax-ws

HI,
Can we transit an complex-type parameter to some other types of java objects (like a Document object or something else) rather than java beans when we are using jax-ws?

Yes, if you use Dispatch you can use a Source object. The JavaBean model
is not required. Again the most flexible would be to use Dispatch.

Similar Messages

  • Validate  XML against  XML Shema while marshalling/Unmarshalling in JAXB?.

    Hi,
    Can i validate XML documents against XML Shema when i marshall/unmarshall the same using JAXB API?.
    Thanks

    Well, it is weird, but, the code below works when validating the NonEmptyString type:
    XmlSchemaSet schemaSet = new XmlSchemaSet();
    schemaSet.Add(null, "LogConfig.xsd");
    XDocument doc1 = XDocument.Load("LogConfig.xml");
    doc1.Validate(schemaSet, new ValidationEventHandler(ValidationCallBack), false);
    However, if I leave the <LogName> empty it does not valid the values set on xsd fixed attribute, 
    The solution?
    Well, I'm validating the same xml twice, the code above and the code on my first question.

  • Character encoding conversion for marshall/unmarshall?

    Hello, Java Web Services gurus,
    I am wondering if there is an easy/plugin-able way to do character encoding conversion transparently in the process of marshall/unmarshall.
    Basically, my input/output will always be these UTF-8 XMLs. As the backend database is ISO encoded, I hope the result of unmarshall will give me ISO strings. And when it comes to marshall, the ISO strings can be transparently turned to UTF-8 XML response. Right now I'm using JAXB's annotations to parse XML into objects.
    I understand there will be chars in the input file not able to get converted, if so, I'd be be expecting an error/exception that flags the failure
    Hope I sound clear. This has been a headache for a while. Really hope someone may help out a bit. Thanks a million in advance

    [Duplicate Post|http://forums.sun.com/thread.jspa?messageID=10971554&tstart=0#10971554]

  • What is marshalling/unmarshalling?

    And how is it different form Serialization/Deserialization?

    And the additional comment I would add to that explanation would be that while serialization/deserialization is usually performed on whole objects, marshalling/unmarshalling is a finer grained mechanism for the serialization/deserialization of just a parameter list and a return value ...with the actual method implementations left unexposed and secure.

  • XML marshalling / unmarshalling javabeans and xsd rational

    Hoping someone can give ma starting point as I am having trouble
    finding any clear documentation. In Rational Application Developer you have the option to generate javabeans from an XML Schema document. My questions are:
    1) once you have generated your beans how can you use these files to
    marhall and unmarshall XML documents?
    2 )how does all of this compare to the JAXB api packaged in the
    webservices development pack?
    I am new to all of this and just looking for some good documentation,
    tutorials, and a starting point.
    Thanks!!!

    BTW, sorry for posting so late, but I am heading out for the day. See you all in 16 hours. :^)
    - Saish

  • XML Marshalling/Unmarshalling

    All,
    I am familiar with XMLBeans and JAXB. However, I would prefer not to use either of these for two reasons:
    I am not a schema guru (not do I want to be)
    I hate code generation in the build processI'm looking for something that would map an X-Path to a Java object. However, I do not want the tool to actually generate that Java object. Rather, a developer will.
    Any technology out there that anyone has used that fits those requirements?
    Thanks,
    - Saish

    BTW, sorry for posting so late, but I am heading out for the day. See you all in 16 hours. :^)
    - Saish

  • JAXB marshal and unmarshal

    hello,
    i have written some code to retrieve data from an XML file and mapped the data and display the mapped data in a new XML file, but i am able to display the mapped data in an MSdos window by running ANT, after this i am unable to write the displayed data in to XML file.
    Input XML file holds --- Firstname(Hello) and
    Lastname(World)
    my MSdos display data ----------- Hello World
    is in this way
    I want the above out put in to XML file
    if any body know this help me.
    Thank you.

    IMHO these classes are not meant to be serialised, the XML produced is the medium that is tranmitted between programs. The XMLB classes are available at both ends to do the marshalling/unmarshalling.I dissagree, xml is just an interface to the outside world, so to speak. I'm working with a project that uses jini and rmi, I really don't need the extra hasle of writting custom serialization classes.

  • Wrong Case or ClassCastException

    Hello everyone
    I use JWSDP2.0, JDK is jdk1.5.0_12
    I have tried to generate class by the command:
    xjc -p test.jaxb poll.xsd
    Following is the schema
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xsd:element name="Poll" type="Poll"/>
         <xsd:complexType name="Poll">
              <xsd:sequence>
                   <xsd:element name="queryName" type="xsd:string"/>
                   <xsd:element name="params" type="QueryParams"/>
              </xsd:sequence>
              <xsd:anyAttribute processContents="lax"/>
         </xsd:complexType>
         <xsd:complexType name="QueryParams">
              <xsd:sequence>
                   <xsd:element name="param" type="QueryParam" minOccurs="0" maxOccurs="unbounded"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="QueryParam">
              <xsd:sequence>
                   <xsd:element name="name" type="xsd:string"/>
                   <!-- See note in EPCIS spec text regarding the value for this element -->
                   <xsd:element name="value" type="xsd:anyType"/>
              </xsd:sequence>
         </xsd:complexType>     
    </xsd:schema>I modify the poll.java, and add @XmlRootElement in front of the class declaration.
    Then I write code to test marshall and unmarshall
    package test;
    import java.util.List;
    import java.io.*;
    import javax.xml.bind.*;
    import org.w3c.dom.*;
    import test.jaxb.*;
    public class JAXBTest {
         public static void main(String[] args){
              try {
                   JAXBContext context = JAXBContext.newInstance("test.jaxb");
                   ObjectFactory factory = new ObjectFactory();
                   Marshaller marshal = context.createMarshaller();
                   marshal.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
                   Unmarshaller unmarshal = context.createUnmarshaller();
                   Poll poll = factory.createPoll();
                   poll.setQueryName("Query1");
                   QueryParams params = factory.createQueryParams();
                   List list = params.getParam();
                   QueryParam param = factory.createQueryParam();               
                   param.setName("Name");
                   param.setValue("David");
                   list.add(param);
                   poll.setParams(params);
                  OutputStream os = new FileOutputStream( "poll.xml" );
                  marshal.marshal( poll, os );     
                  marshal.marshal(poll,System.out);
                  Poll input = (Poll)unmarshal.unmarshal( new File( "poll.xml" ) );
                  System.out.println(input.getQueryName());
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }I found the root element is generated to "poll", not the schema defined "Poll"
    But marshall and unmarshall are ok.
    In order to comform the schema, I modify Poll.java again.
    Change @XmlRootElement to @XmlRootElement(name = "Poll")The result is I can generate the right case element now("Poll").
    But I get the exception simultaneously, unmarshall is not ok
    java.lang.ClassCastException: javax.xml.bind.JAXBElement
         at test.JAXBTest.main(JAXBTest.java:29)
    is there any resolution to solve wrong case problem and make marshall/unmarshall ok?
    Message was edited by:
    chihwen

    Hi,
    As far as I know Oracle are porting Developer R6 to Linux.
    We're also anxiously waiting for it to be out.
    It should be out in 2 or 3 months.
    About CASE I don't thing anyone will port it to linux.
    Regards,
    Michael
    Jose Abelardo Gutierrez (guest) wrote:
    : My company is looking for CASE or RAD tools for database system
    : developement on Linux.
    : If I can find something that suits our needs we will change all
    : our application developement schema to Linux, and I'll very
    : happy, and our client to.
    : Thanks for your reading
    null

  • TYPES.XML for client generated stubs?

    Hello!
    Does the types.xml file, generated by 'autotype' when the web service is created,
    need to be bundled with the client? If so, where should it go? I tried placing
    into the same package path as the generated client stubs, but that didn't have
    an effect.
    When I generate the web service, the type.xml shows up in WEB-INF/classes ...
    so does that mean the client should have it in the root package?
    Thanks
    -- Jake

    Hi Jacob,
    There are no types generated, because the method of your "backend" component,
    accepts (or returns) an org.w3c.dom.Document. Correct? This basically means that
    the input argument (or return type) can be any XML document, which is why the
    WSDL uses an xsd:anyType :-)
    I don't know about WLS 8.1 SP2, but you will need weblogic.jar in the client's
    CLASSPATH to call a WebLogic Web Service operation, which accepts or returns an
    object that implements the org.w3c.dom.Document interface. This is because the
    webserviceclient.jar (or webserviceclient+ssl.jar) file does not contain all the
    classes needed to marshall/unmarshall an org.w3c.dom.Document. You may also have
    some problems getting a "static" (i.e. stub) JAX-RPC client working. The JAX-RPC
    "dynamic" (i.e. dii) JAX-RPC client will work, "out-of-the-box", if you load the
    type mapping registry with the correct info from the WorkflowService.xml file.
    I have attached a code extract that shows what the DII code should look like :-)
    For the record, the org.w3c.dom.Document object does not travel over the wire
    to the target web service. Just the XML inside it :-) This means that the target
    web service implementation does not need to know that you use an org.w3c.dom.Document
    object to marshall/unmarshall the arguments (or return value).
    Regards,
    Mike Wooten
    "Jacob Anderson" <[email protected]> wrote:
    >
    I tried building the client classes using the web service EAR file, thinking
    that
    it would embed the type information into the client JAR file. Unfortunately,
    no, that did not occur. The type mapping data in the WorkflowService.xml
    found
    in the generated client JAR file contains nothing:
    <wsdd:type-mapping xmlns:wsdd="http://www.bea.com/servers/wls70"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    </wsdd:type-mapping>
    On the console, when running the client, I see:
    [java] javax.xml.rpc.JAXRPCException: web service invoke failed:
    javax.xml.soap.SOAPException:
    failed to serialize interface org.w3c.dom.Documentweblogic.xml.schema.binding.SerializationException:
    mapping lookup failure. class=interface org.w3c.dom.Document class context=TypedClassContext{schemaType=['http://www.w3.org/2001/XMLSchema']:anyType}
    Clearly the client is not able to understand the "anyType" that is used
    in the
    service WSDL to denote the org.w3c.dom.Document type.
    Does the classpath have an impact here? I noticed that the webserviceclient.jar
    is supposedly the only jar needed to run WS clients. Well, I call "setEnv.cmd"
    before I run the ant task to build and test my web service - does that
    have an
    effect? It didn't seem to affect tutorial31 when I ran it this way.
    Any help is greatly appreciated
    -- Jake
    "Jacob Anderson" <[email protected]> wrote:
    Hello!
    Does the types.xml file, generated by 'autotype' when the web service
    is created,
    need to be bundled with the client? If so, where should it go? I tried
    placing
    into the same package path as the generated client stubs, but that didn't
    have
    an effect.
    When I generate the web service, the type.xml shows up in WEB-INF/classes
    so does that mean the client should have it in the root package?
    Thanks
    -- Jake
    [jacob-dii.txt]

  • Running JAXB2 in a 10g Database

    Hi All,
    We have some java business logic which uses JAXB2. We now would like to be able to call / store this java code inside the database. It's a 10g database, which I understand has the 1.4 JVM, so I've retrotranslated the code (and the JAXB2 dependencies) and created a compatible jar. The loadjava command^1^ completes successfully, however when I try and execute the code which unmarshals the XML, I get the following error: Caused by: java.lang.RuntimeException: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
    The ContextFactory is definitely in the jar file. Looking through the generated DB trace file I see the following:
    creating : class com/sun/xml/bind/v2/ContextFactory with resolver ((* london) (* PUBLIC) (org/apache/* -) (jp/gr/xml/relax/* -) (com/bea/* -) (javax/management/* -) (com/thoughtworks/xstream/* -) (org/jvnet/* -) (com/sun/xml/fastinfoset/* -) (sun/misc/* -))
    but then, instead of resolving the class:
    skipping : class com/sun/xml/bind/v2/ContextFactory
    Why would the ContextFactory be skipped? Is there any way I can force the loadjava command to resolve it?
    1. The server-side loadJava command I use is: call sys.dbms_java.loadjava( '-force -verbose -resolve /scripts/p3/db_sql/cta23001.jar','((* london) (* PUBLIC) (org/apache/* -) (jp/gr/xml/relax/* -) (com/bea/* -) (javax/management/* -) (com/thoughtworks/xstream/* -) (org/jvnet/* -) (com/sun/xml/fastinfoset/* -) (sun/misc/* -))' );

    Hi:
    You can find Jaxb related classes implemented by Oracle into ${ORACLE_HOME}/lib/xml.jar but not all classes should be installed, please look at Ant task named unpack-jaxb-classes at:
    [http://dbprism.cvs.sourceforge.net/viewvc/dbprism/cms-2.1/tasks/cms.xml?revision=1.19&view=markup]
    this Ant task extract all Jaxb required classes which can be installed into an Oracle 10g/11g database, see the Task pre-install which install this jar into SYS's schema.
    To see how to use Jaxb marshall/unmarshall operation please take a look at the method processRequestAction, inside the code you can see how to instantiate the marshaller and unmarshaller:
    [http://dbprism.cvs.sourceforge.net/viewvc/dbprism/cms-2.1/src/com/prism/cms/action/Controller.java?revision=1.8&view=markup]
    Best regards, Marcelo.

  • XML parsing in CEP

    Hi All,
    I somehow strongly feel OCEP should have much more XML support.
    Firstly we need not to use XML marshalling/unmarshalling to and from Java classes.
    Secondly event definition could have supported through XSD(s).
    Lastly CQL should have a solid XML parsing capability (although it has some XQuery based naive support). If we had the support, it would have been much more easier send data directly from some bus (e.g. OSB) to OCEP and apply the pattern using CQL.
    Life would be much more simpler.... Isn't it?
    Regards
    Arijit
    Edited by: calvinIsMe on Oct 15, 2012 11:45 PM

    Hi Alex
    Nice to get feedback directly from creator.
    Always felt EDN integration is an obvious future step. I feel it kind of completes gaps in Oracle EDA offering. ESB (in this case SOA suite) can be biggest source of events in an enterprise.
    Having said that can we get some more details on what next release of OCEP is bringing along? Anything on CEP dashboard. Whenever we are trying to build a solution around CEP, we had to rely on BAM. No offense on BAM, that is indeed a powerful tool. But to represent a pattern of data graphically, it seems overkill. Or am I missing something?
    Regards
    Arijit
    Edited by: calvinIsMe on Oct 17, 2012 12:09 AM

  • Accessing BPEL processes via a proxy web service performance issues

    Hello,
    I have more BPEL processes implemented, each such a process implementing business functionality in a certain domain (generally, a domain has more business processes).
    The request was to provide a single web service for each domain. It means that all the business methods (processes) in the same domain should be accessed through the same web service. This request doesn't make possible to expose the BPEL processes themselves as web services that could be directly consumed by different clients of the application.
    The alternative will be to implement the "domain" web services through a Java class, for instance. With this approach, the Java based domain web services will expose the needed business methods to the clients. And the Java class will get the request input parameters and will call the corresponding BPEL process via SOAP. This scenario would be fine, but... this approach would imply a supplementary marshalling/unmarshalling process at the domain web service level. The data returned by the BPEL processes could be very large and in such a situation the Java based domain web service will introduce an important performance drawback.
    Is there any other solution to this case that will allow the using of a "proxy" domain web services that will not introduce any important drawback via marshalling/unmarshalling?
    Many thanks in advance!
    Regards,
    Marinel

    Hello,
    First, thank you Sandor for your answer.
    I understand that it is possible to create a BPEL process that exposes multiple operations/messages. This would be exactly what I need: a single process (web service) that will expose many operations. Could anyone, please, point me to such an example?
    So far I thought that there is possible to have only one operation exposed with a BPEL process, what is delimited between the receive/reply blocks (in the synchronous case).
    Regards,
    Marinel

  • SOAP performance issue

    Hi,
    My problem is that the NE I am connecting to was exposing its interfaces as LDAP and now they are changing those interfaces as SOAP. We are getting a very high load and I feel that since LDAP is optimized for fast read-speeds, replacing the LDAP interfaces with Web Services would have performance implications since SOAP performs poorly compared to the LDAP because of transport inefficiencies & marshalling/unmarshalling overhead.
    Although the NE team says that they will be able to give response withing the defined SLA time (around 1 sec) but the what they are not understanding is that even if they given response withing 1 sec, Web services invocation operations would also be expensive. Also overhead on our end (client) would also include extracting the SOAP envelope and parsing the XML by engine. Further, XML data cannot be optimized much for all cases.
    Pls guide me if I am correct or wrong in my opinion.
    Thanks
    AA

    If I get it right, LDAP ist just a protocol for calling a directory service. The backend, is performing with the same throughput independent of the type of protocol.
    Our performance tests on our soa-servers showed, the total overhead, including network, logging, Application server stuff, xml parsing, is about 10%. We got this value testing with JMeter and logging statements inside of the code.
    CPU, Memory (incl garbage collecting) and networktraffic were very, very good, we didn't except some of these results (~40 samples / second -> 3% CPU on a Sun T5120 machine), most overhead was from the backends.
    I guess you're correct if you say, SOAP needs more ressources than LDAP, but this is less than you think (in my opinion, of course).
    You definetly should do some performance tests and compare the results with the ldap variant.
    regards
    slowfly

  • Using XML as persistance

    I'm re-writing a swing client that uses regular serialization to files in order to save user data. The data that needs to be persisted to file is very hierarchical by nature. I'm using MVC throughout the application.
    Now, I'm considering using XML as the file format for the persistence. I've written an XML schema (xsd) that dictates the data model.
    As I've stumbled upon XStream before I first had a look at that for marshalling/unmarshalling my XML. XStream is wonderful but it kind of makes the XML schema validation useless as I see it. So, now I'm looking at JAXB (or maybe XMLBeans) instead as the API between my XML files model layer in the application.
    Basically, what I'm looking for is a convenient way to read XML data from file into my data model. Obviously I want to be able to create XML from my data model as well. Will JAXB really save me from doing all the mapping between the XML and data model (POJO's) based on my XML schema?
    Am I barking at the wrong tree here? Also, please stop me if you think that XML are a ridiculous way of persisting application data.
    Thanks in advance!

    Thank you for your input DrClap!
    My Swing app is kind of a CAD app where users can make drawings of marinas. Objects can be moved, rotated, connected to each other and grouped and each object has a set of properties. The drawing layout, object props and calculation parameters needs to be persistent. Think MS Visio... Target audience is marine engineers that needs to make force calulations.
    Generating an xml file from my xml schema produces a file on about 7Kb (about 200 lines). A real life file would probably be at least 10 times bigger.
    I don't see an issue with updating or adding single elements in the XML. This is only done when the user saves to file, in all other cases the application would store data in the model layer. And as I understand it JAXB would handle all XML marhsalling/unmarshalling automagically.
    The only thing I'm worried about is having JAXB generating the model classes from my xml schema (xsd). Since I'm working with MVC my current model classes all fire property change events to its controllers whenever a setter is called. This would be lost if JAXB would generate the model for me. Am I right? My assumption with JAXB/XMLBeans is that you update the model by changing your xml schema and then generate/compile you model classes (and ObjectFactory).
    Thank you for taking your time to read this!

  • How to create an XML fril from an XML instance

    i have already created an instance of the xml using the classes generated from
    the SCHEMA, how will i generate an xml file from the instance i have? is it the
    same like the marshalling/unmarshalling Castor is doing? help please!!!

    It worked, Thanks so much!
    "Steve Traut" <[email protected]> wrote:
    Manuel -- If you simply want to write out the XML you've created, you
    can
    use one of the save methods exposed by your generated XMLBeans types.
    For
    example, to write the XML out to a file, you might do this:
    File myFile = new File("c:/myXml.xml");
    try
    myNewXmlDoc.save(myFile);
    catch (java.io.IOException ioe)
    System.out.println("Error while writing my XML file");
    Note that other save methods are available to write to other formats.
    Steve
    "Manuel Pantaleon" <[email protected]> wrote in message
    news:3f9f9312$[email protected]..
    i have already created an instance of the xml using the classes generatedfrom
    the SCHEMA, how will i generate an xml file from the instance i have?is
    it the
    same like the marshalling/unmarshalling Castor is doing? help please!!!

Maybe you are looking for