XMLBeans
Dear friends,
Can anyone help me finding the best way to read the dynamic URL returned XML . Like webservices this URL returns the result in an XML and I want to embed this result into my application.
The best way I thought was to use XMLBeans and map the results into a JavaBean. But I am little confused with this approach. As firstly I need to create XSD from the XML, then based on that XSD I have to build java classes and .XSB files to map to javabeans.
Confusion lies here-
1) What if the returned XML changes some of the returned attribute
2) Can XMLBean map XML to javabeans dynamically?
3) Is there anyother way/framework to map XML to javabeans dynamically?
4) Does Axis provides any mechanism to map XML to Javabeans dynaimically?
Your help is highly appreciated.
sachin
It's usually an anti-pattern to statically bind an XML structure returned from a web service to code. Just walk the document tree and extract what you need dynamically.
Pete
Similar Messages
-
Unable to pass xmlbeans object in weblogic web services using OEPE
Migrating Weblogic web services from Weblogic Workshop 10.3 to Oracle Enterprise for Eclipse...Passing xmlbean generated types in arguments of webservice call
How to work around the following errors? I do not have this error when in workshop 10.3 only in OEPE eclipse
"oracle.eclipse.tools.webservices.compiler.CompilationException: Errors: JAX-WS web services must not have xmlBean parameter or return type"
PLease note that I want DocType to be xmlbeans generated or inherited from org.apache.xmlbeans.XmlObject....
@WebMethod
public void upload(String filename, DocType doc) {
Hi, I have legacy codes from Weblogic workshop 10.1 and 10.3.....
I am able to compile and run in Weblogic workshop 10.3 by passing the xmlbean generated DocType as arguments in the web services call.... but why am I not able to do this in Oracle Enterprise for Eclipse OEPE......
If I were to generate the web service from teh wsdl...it will generate it's own DocType.class in the jar files and not use the xmlbean generated class one....
How to get iOEPE to generate the classes in build\jws\ for
testWSService-annotation.xml
weblogic-webservices.xml etc like in workshop
How can I resolve this??? Am I stuck with Workshop on this?? How to work around??
Any help or clarifications would be much appreciated.
Inside testWS.java,
package ws;
import java.io.File;
import javax.jws.*;
import org.example.doc.DocType;
@WebService
public class testWS {
@WebMethod
public void upload(String filename, DocType doc) {
try {
doc.save(new File(filename));
catch(Exception e) {
System.out.println(e);
Inside xmlbeans generated DocType.java.....and DocTypeDocuments.java
* XML Type: DocType
* Namespace: http://www.example.org/doc
* Java type: org.example.doc.DocType
* Automatically generated - do not modify.
package org.example.doc;
* An XML DocType(@http://www.example.org/doc).
* This is a complex type.
public interface DocType extends org.apache.xmlbeans.XmlObject
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(DocType.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.testWSTypeSystem").resolveHandle("doctypec217type");
* Gets the "element1" element
java.lang.String getElement1();
* Gets (as xml) the "element1" element
org.apache.xmlbeans.XmlString xgetElement1();
* Sets the "element1" element
void setElement1(java.lang.String element1);
* Sets (as xml) the "element1" element
void xsetElement1(org.apache.xmlbeans.XmlString element1);
* Gets the "element2" element
java.lang.String getElement2();
* Gets (as xml) the "element2" element
org.apache.xmlbeans.XmlString xgetElement2();
* Sets the "element2" element
void setElement2(java.lang.String element2);
* Sets (as xml) the "element2" element
void xsetElement2(org.apache.xmlbeans.XmlString element2);
* A factory class with static methods for creating instances
* of this type.
public static final class Factory
public static org.example.doc.DocType newInstance() {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.example.doc.DocType newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static org.example.doc.DocType parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static org.example.doc.DocType parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static org.example.doc.DocType parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static org.example.doc.DocType parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static org.example.doc.DocType parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static org.example.doc.DocType parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static org.example.doc.DocType parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static org.example.doc.DocType parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static org.example.doc.DocType parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static org.example.doc.DocType parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static org.example.doc.DocType parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static org.example.doc.DocType parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static org.example.doc.DocType parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static org.example.doc.DocType parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.example.doc.DocType parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.example.doc.DocType parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.example.doc.DocType) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
Edited by: user11079482 on Jan 1, 2010 2:09 AMOk just as I expected. So I guess I am left with the following two options
1) either I switched to using JAXB in my apps instaed of xmlbeans....
2) or if I still wanna use the old JAX-RPC web services to deploy on the Weblogic 10gR3 server i will have to create my own ant task jwsc directly......as shown below in your docs
Programming Web Services for WebLogic Server (ant tasks)
http://download.oracle.com/docs/cd/E13222_01/wls/docs92/webserv/anttasks.html
Getting Started With WebLogic Web Services Using JAX-RPC
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv_rpc/index.html
Will OEPE be supporting the old JAX-RPC anytime in the near future release? or have to create own build ant task to call jwsc ant task directly to compile JAX-RPC web services?? -
Returning Errors from a webservice using XMLBeans
I have a webservice that accepts XML as input and output parameters, and I'm using XMLBeans to handle this. I'm trying to work out how I can return error information from the webservice, so I created an Exception.xsd schema and 'include' it in the output XML Schema, so an exception xml element is valid in the output schema. The problem is, the XMLBean class generated from the output XML schema has no methods that allow me to create an Exception element. Is there some other way of handling the return of exceptions from webservices using XML?
The answer is just throw a SoapFaultException and put the exception.xsd XMLBean in the FaultDetail section of the SoapFaultException.
-
Using an external web service and XMLBeans
I have an external document/literal web service that I want to use
(call) from inside workshop. I have listed a small example at the end
of this email.
I am wondering if there is a way to call and receive from the web
service using XMLBeans. In the tutorial examples XMLBeans are only
used by marshaling and unmarshaling the xml structure into a string
which is what is actually passed according to the WSDL. However, in
this case (and I personally think in most cases) the schema is
explicitly described in the WSDL and passed as the message. I might
add the structures for my real service are much more complex and so
the value of XMLBeans is certainly applicable to them.
Clearly I can somehow save off the schema and generate XMLBeans from
it. The next step is much less clear, how do I tell my JCX to use the
beans instead of generating private classes to represent the
structures?
To be honest I am a little surprised that for 8.1 the WSDL->JCX stuff
doesn't just leverage XMLBeans by default instead of generating basic
classes. This would give the power of XMLBeans to all web service
calls.
thanks,
dave
*** Sample WSDL ***
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="urn:tutorial/hello"
targetNamespace="urn:tutorial/hello"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<s:schema targetNamespace="urn:tutorial/hello">
<s:element name="sayHelloResponse" >
<s:complexType>
<s:sequence>
<s:element name="sayHelloReturn" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="sayHello" >
<s:complexType>
<s:sequence>
<s:element name="caller" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="sayHelloRequestMsg">
<wsdl:part name="message" element="tns:sayHello"/>
</wsdl:message>
<wsdl:message name="sayHelloResponseMsg">
<wsdl:part name="sayHelloReturn" element="tns:sayHelloResponse"/>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="sayHello" >
<wsdl:input message="tns:sayHelloRequestMsg" />
<wsdl:output message="tns:sayHelloResponseMsg" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldServiceSoapBinding"
type="tns:HelloWorld">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequestMsg">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponseMsg">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="tns:HelloWorldServiceSoapBinding"
name="HelloWorldService">
<wsdlsoap:address
location="http://localhost:18080/tutorial/HelloWorldService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>FYI, there is a XMLBeans newsgroup; w/ good feedback from the
developers:
http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.xmlbeans
Bruce Stephens wrote:
>
Hi David,
We are on the road, headed in that direction; pedal to the metal, etc.
just not there...yet.
We appreciate and value your input.
Thanks,
Bruce
David Rees wrote:
I have an external document/literal web service that I want to use
(call) from inside workshop. I have listed a small example at the end
of this email.
I am wondering if there is a way to call and receive from the web
service using XMLBeans. In the tutorial examples XMLBeans are only
used by marshaling and unmarshaling the xml structure into a string
which is what is actually passed according to the WSDL. However, in
this case (and I personally think in most cases) the schema is
explicitly described in the WSDL and passed as the message. I might
add the structures for my real service are much more complex and so
the value of XMLBeans is certainly applicable to them.
Clearly I can somehow save off the schema and generate XMLBeans from
it. The next step is much less clear, how do I tell my JCX to use the
beans instead of generating private classes to represent the
structures?
To be honest I am a little surprised that for 8.1 the WSDL->JCX stuff
doesn't just leverage XMLBeans by default instead of generating basic
classes. This would give the power of XMLBeans to all web service
calls.
thanks,
dave
*** Sample WSDL ***
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="urn:tutorial/hello"
targetNamespace="urn:tutorial/hello"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<s:schema targetNamespace="urn:tutorial/hello">
<s:element name="sayHelloResponse" >
<s:complexType>
<s:sequence>
<s:element name="sayHelloReturn" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="sayHello" >
<s:complexType>
<s:sequence>
<s:element name="caller" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="sayHelloRequestMsg">
<wsdl:part name="message" element="tns:sayHello"/>
</wsdl:message>
<wsdl:message name="sayHelloResponseMsg">
<wsdl:part name="sayHelloReturn" element="tns:sayHelloResponse"/>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="sayHello" >
<wsdl:input message="tns:sayHelloRequestMsg" />
<wsdl:output message="tns:sayHelloResponseMsg" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldServiceSoapBinding"
type="tns:HelloWorld">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequestMsg">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponseMsg">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="tns:HelloWorldServiceSoapBinding"
name="HelloWorldService">
<wsdlsoap:address
location="http://localhost:18080/tutorial/HelloWorldService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions> -
How can I use XMLBeans in a Web Services client?
How can I use XMLBeans in a standalone Java client with a Web Service?
I posted the message below earlier in the year, but have not yet been successful
in my
attempts.
regards
Eddie
Hi,
I'm trying to using XMLBeans to send a document to a web service from a standalone
Java client. I'm using the PurchaseOrder (easypo) example document, and the service
expects a parameter of type PurchaseOrderDocument. The client proxy class generated
by WebLogic Workshop, however, expects to send a parameter of type PurchaseOrder.
In the client, I can instantiate a PurchaseOrderDocument, and then obtain a PurchaseOrder
(e.g. pod.getPurchaseOrder() ), but the returned class is not compatible with
the PurchaseOrder type that the client proxy expects.
In a previous attempt (not using Workshop), the client would not compile because
it expected to send a non-abstract class with a public default constructor (presumably
a JAX-RPC requirement), and XMLBeans had generated an interface.
Any help would be greatly appreciated!
thanks & regards
EddieI have been experiencing similar problems with the HTML Editor and have managed to find an answer that should start to answer some of my questions. The Apex HTML Editor Standard is actually an HTML editor called FCKeditor. The FCKeditor has a Javascript API that can be found at http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API. Unfortuately this doesn't seem to give the whole answer and I found more at http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:49607.
I needed to get the text entered within my html editor standard (e.g. P1_MYTEXT) and use it within my javascript function. I did this by using the following script
<script language="JavaScript" type="text/javascript">
function showtext(){
var oEditor = FCKeditorAPI.GetInstance('P1_MYTEXT');
var editortext = escape(oEditor.GetXHTML(oEditor.FormatOutput));
alert(editortext);
</script>
Hope this helps.
Matthew -
Xmlbean Error while creating jar from XSD
Hi all,
I am using xmlbean technology while preparing jar from xsd i am getting the following error
"error: Could not load resource "http://dataservices.citigroup.net:8080/documentEngine/GMA/technology_area/CMM/Commons/1.0/Core-schema.xsd" (network downloads disabled)."
Please help meHi All,
I got the solution.
we have to add -dl in the script as args -
Error while accessing a war with xmlbeans under WEB-INF/lib
Hi All,
I am trying to deploy a WAR file with XMLBean generated jar under WEB-INF/lib folder along with other jars.
I am getting following error
java.lang.NoClassDefFoundError: com/xx/DataServiceRequestDocument
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredField(Class.java:1880)
at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1610)
at java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:52)
at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:425)
at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
at java.io.ObjectStreamClass.lookup0(ObjectStreamClass.java:310)
at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java)
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:547)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1582)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at com.tangosol.util.ExternalizableHelper.readSerializable(ExternalizableHelper.java:2216)
at com.tangosol.util.ExternalizableHelper.readObjectInternal(ExternalizableHelper.java:2347)
at com.tangosol.util.ExternalizableHelper.readObject(ExternalizableHelper.java:2290)
at com.tangosol.io.DefaultSerializer.deserialize(DefaultSerializer.java:74)
at com.tangosol.coherence.component.net.extend.Channel.deserialize(Channel.CDB:15)
at com.tangosol.io.pof.PofBufferReader.readAsObject(PofBufferReader.java:3306)
at com.tangosol.io.pof.PofBufferReader.readObject(PofBufferReader.java:2603)
at com.tangosol.coherence.component.net.extend.messageFactory.InvocationServiceFactory$InvocationRequest.readExternal(InvocationServiceFactory.CDB:5)
at com.tangosol.coherence.component.net.extend.Codec.decode(Codec.CDB:29)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.decodeMessage(Peer.CDB:25)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.onNotify(Peer.CDB:54)
at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
at java.lang.Thread.run(Thread.java:662)
I tried multiple combinations like changing, but no success.
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<wls:weblogic-version>10.3.2</wls:weblogic-version>
<wls:context-root>CoherenceWS</wls:context-root>
<wls:container-descriptor>
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
</wls:weblogic-web-app>
I have very few classes in WEB-INF/class (trying to load java objects from lib)
My WEB-INF/lib folder contains following jar
coherence.jar
commons-beanutils-1.8.0.jar
commons-collections-3.2.jar
commons-lang-2.4.jar
commons-logging-1.1.1.jar
dsRemoteCall.jar
ezmorph-1.0.jar
jackson-all-1.8.5.jar
json-lib-2.1-jdk13.jar
org.springframework.asm-3.1.0.M2.jar
org.springframework.beans-3.1.0.M2.jar
org.springframework.context-3.1.0.M2.jar
org.springframework.core-3.1.0.M2.jar
org.springframework.expression-3.1.0.M2.jar
org.springframework.oxm-3.1.0.M2.jar
org.springframework.web-3.1.0.M2.jar
org.springframework.web.servlet-3.1.0.M2.jar
schemaclasses.jar
xbean.jar
xom-1.2.7.jar
Am I missing something? Any help is greatly appreciated
Thanks
sunder
Edited by: 868704 on Sep 6, 2011 6:10 PMNote : schemaclasses.jar contains "com/xx/DataServiceRequestDocument" class file.
WebLogic Server 10.3.5.0
Thanks
sunder
Edited by: 868704 on Sep 6, 2011 6:26 PM -
Creating a web service with XMLBeans
Hello
I have created an XML schema defining some complex types such as Person, Address, etc.. I use the Apache XMLBeans project (version 2.2.0) to automatically generate Java beans from my schema. I then populate these objects using standard accessors.
I want to expose methods such as Find, Retrieve, etc.. as web services which return these XMLBean objects in the SOAP body.
public PersonType findPerson(String p_surname)
public AddressType retrieveAddress(String p_houseNumber, String p_postcode)
I understand the fundamentals of web services and have successfully written web services from scratch using Apache Axis.
I'm now using JDeveloper 10.1.3.0.4 and creating web services using the wizard. When stepping through the wizard I get to the part where you are asked to choose which methods of your class you wish to expose. In my case all the methods are greyed out. Now I believe this is because my methods are returning complex Java types (generated by XMLBeans) which themselves contain other complex types which have no serializers defined for them.
Has anyone written a custom serializer for XMLBeans to work with JDeveloper/OC4J or know how to get started? Any other tips?
Any advice greatly appreciated.
Thanks.Hi,
When you start the create WS wizard in SE80 you can choose what to base it on - an RFC, a BAPI or a function group. If you choose function group you can then choose which modules within that function group to make available as operations.
Hope this helps,
Gareth. -
Creating an xml file from XMLBeans
I'm trying to use XMLBeans to modify an XML file but I can't seem to determine
if XMLBeans support taking the modified xml document and saving it to a file.
Do I need to write my own code to accomplish this?Say you have an XML Bean called PurchaseOrderDocument. You should be able to save
to a file doing this:
PurchaseOrderDocument.save(myFile).
You can also save to an OutputStream or a Writer.
"Pete" <[email protected]> wrote:
I'm trying to use XMLBeans to modify an XML file but I can't seem to
determine
if XMLBeans support taking the modified xml document and saving it to
a file.
Do I need to write my own code to accomplish this? -
Getting from an xml file to an XMLBean argument to web service
I'm a newbie here, so I apologize for the lack of understanding, but the docs are
not helping me at all here.
I'm trying to write a simple SOAP client to call into a JWS (document style) generated
in Workshop and deployed in 8.1 SP2. The Web Service was in turn generated from
a Java Control with one method. That method took as an argument an XMLBean type.
After deploying my EAR, I downloaded the proxy jar and am trying to use that
to develop a client outside workshop to call into my web service.
ServiceTest_Impl proxy = new ServiceTest_Impl("<pathtoWSDL>");
ServiceTestSoap soap = proxy.getServiceTestSoap();
On that soap variable, I have a method:
validateLoanApp(LOANAPPLICATION arg)
LOANAPPLICATION exists as a class at com.foo.BAR.LOANAPPLICATION, and there's
a LOANAPPLICATIONCodec in the same package, and a com.foo.BAR.holders.LOANAPPLICATIONHolder
Now I have a file on disk that is an XML document. I'd like to read that file,
convert it to a LOANAPPLICATIOAN, and pass it to my method. I cannot for the
life of me figure out how to do this. The LOANAPPLICAITON class just has getters
and setters, and I don't want to have to go through the document and hand parse
it; there must be a way to do it automatically.
I see the deserialize method, but that is expecting a DeserializationContext,
which doesn't seem to have a constructor I can find. Any help here would be appreciated!
Thanks.Michael, thanks for the quick reply. And crud. Unfortunately, this document is
huge and immensely complicated, so I was hoping to avoid using the getters and
setters for it by populating the Javabeans in some automatic way. I guess I'll
have to just send the doc as a String, and parse it in the client using the Factory.
Thanks!
"Michael Wooten" <[email protected]> wrote:
>
Hi Brian,
No, you won't have to "hand-parse" it, but something must :-)
Those Codec classes are JavaBeans, not XMLBeans, so you won't find a
method like
parse(String xml), on them. If this arg type is really an XMLBean type,
you should
have a .jar file in the APP-INF/lib director (under the directory for
your Workshop
app), which has it (a LOANAPPLICATIONDocument class) in it. You should
be able
to use:
LOANAPPLICATIONDocument mydoc = LOANAPPLICATIONDocument.Factory.parse(new
File("filename.xml"));
to parse (and validate) the file for you. Then you can just use the "getters"
on the mydoc object, with the "setters" on the LOANAPPLICATION class
from the
proxy .jar, to get the results you want.
For the record, it has been brought to the attention of the BEA engineers
(by
myself, and others), that there is a real desire to just use XMLBeans
with the
XXX_Impl and XXXSoap classes in the client proxy .jar, and they are working
on
this for a future release :-)
Regards,
Mike Wooten
"Brian Sensale" <[email protected]> wrote:
I'm a newbie here, so I apologize for the lack of understanding, but
the docs are
not helping me at all here.
I'm trying to write a simple SOAP client to call into a JWS (document
style) generated
in Workshop and deployed in 8.1 SP2. The Web Service was in turn generated
from
a Java Control with one method. That method took as an argument anXMLBean
type.
After deploying my EAR, I downloaded the proxy jar and am trying to
use that
to develop a client outside workshop to call into my web service.
ServiceTest_Impl proxy = new ServiceTest_Impl("<pathtoWSDL>");
ServiceTestSoap soap = proxy.getServiceTestSoap();
On that soap variable, I have a method:
validateLoanApp(LOANAPPLICATION arg)
LOANAPPLICATION exists as a class at com.foo.BAR.LOANAPPLICATION, and
there's
a LOANAPPLICATIONCodec in the same package, and a com.foo.BAR.holders.LOANAPPLICATIONHolder
Now I have a file on disk that is an XML document. I'd like to read
that file,
convert it to a LOANAPPLICATIOAN, and pass it to my method. I cannot
for the
life of me figure out how to do this. The LOANAPPLICAITON class just
has getters
and setters, and I don't want to have to go through the document and
hand parse
it; there must be a way to do it automatically.
I see the deserialize method, but that is expecting a DeserializationContext,
which doesn't seem to have a constructor I can find. Any help herewould
be appreciated!
Thanks. -
XMLBEANS classcastexception issues when migrating from WLS 8.1 to WLS 9.2
Hi
We are migrating our applications from Weblogic 8.1 / xbean (?) to Weblogic 9.2 / apache xbean 2.2.9-r540734 .
We compiled our schema successfully with new version after making changes recommended by bea (replaced all com.bea.xml occurrences to org.apache.xmlbeans ) along with ant task def etc.
XBEAN Compilation produces classes in following package structure: com.tuftshealth.container.providerListService.* and com.tuftshealth.container.providerListService.impl.*
Our XSD looks like below:
===============================
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:this="http://www.tuftshealth.com/Container/ProviderListService" xmlns:messageheader="http://www.tuftshealth.com/Base/MessageHeader" xmlns:name="http://www.tuftshealth.com/Base/Name" xmlns:status="http://www.tuftshealth.com/Base/Status" xmlns:network="http://www.tuftshealth.com/Base/Network" xmlns:date="http://www.tuftshealth.com/Base/DateRange" xmlns:contact="http://www.tuftshealth.com/Base/Contact" xmlns:address="http://www.tuftshealth.com/Base/Address" xmlns:reference="http://www.tuftshealth.com/Base/Reference" xmlns:member="http://www.tuftshealth.com/Base/Member" xmlns:benefit="http://www.tuftshealth.com/Base/Benefit" xmlns:covlimit="http://www.tuftshealth.com/Base/CoverageLimitations" xmlns:groupriders="http://www.tuftshealth.com/Base/GroupRiders" xmlns:buslninfo="http://www.tuftshealth.com/Base/BusinessLineInfo" xmlns:phone="http://www.tuftshealth.com/Base/Phone" targetNamespace="http://www.tuftshealth.com/Container/ProviderListService" elementFormDefault="qualified">
<import namespace="http://www.tuftshealth.com/Base/MessageHeader" schemaLocation="../Base/MessageHeader.xsd"/>
<element name="ProviderListRequest" type="this:PrivderListServiceRequestType"/>
<complexType name="PrivderListServiceRequestType">
<sequence>
<element name="MessageHeader" type="messageheader:MessageHeaderType"/>
<element name="providerRequestInfo" type="this:ProviderListRequestParamsType"/>
=================================
This results in exceptions at run time when we call a Tibco using a generic broker class.
The broker uses following method to return class to us:
obj = XmlObjectBase.Factory.parse(XMLString);
XMLString contains following payload:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:ProviderListResponse xmlns:ns0="http://www.tuftshealth.com/Container/ProviderListService">
Debug Info:
PACKAGE NAME: **** com.tuftshealth.www.container.providerlistservice.impl
CLASS NAME: ****** com.tuftshealth.www.container.providerlistservice.impl.ProviderListResponseDocumentImpl
java.lang.ClassCastException: com.tuftshealth.www.container.providerlistservice.impl.ProviderListResponseDocumentImpl
XmlObjectBase is returning the class with www in package name. This causes ClassCastException.
We tried to use XmlObject and XmlOptions is various combinations to see if "www" in package name goes away but it stays the same.
Can someone please help us here ? It seems that behavior of XmlObject or XmlObjectBase has changed between two versions. Our apps can't work without the broker to return correct class type.
Thanks for your help,
ShikharHi,
You can get rid of JSP version specific problems by using the following weblogic.xml file:-
<weblogic-web-app>
<jsp-descriptor>
<jsp-param>
<param-name>backwardCompatible</param-name>
<param-value>true</param-value>
</jsp-param>
</jsp-descriptor>
<weblogic-web-app>
It will also confirm if the error you are seeing is due to JSP version differences in 8.1 and 9.x.
Regards. -
How to handle abstract XML elements with XMLBeans
Hello,
I have an xsd that uses abstract elements, and i wanted to ask you how can i create new XML Documents with XMLBeans? My problems is that i don't know how to handle abstaction with XMLBeans.
Let me show you a very simple example to make you understand my problem :
Suppose we have the following schema :
<xsd:schema targetNamespace="http://www.example.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org">
<xsd:element name="Customer" type="CustomerType" />
<xsd:complexType name="CustomerType" abstract="true" />
<xsd:complexType name="PremiumCustomerType">
<xsd:complexContent>
<xsd:extension base="CustomerType">
<xsd:sequence>
<xsd:element name="CreditCard" type="xsd:string" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>I use XMLBeans to create a jar with java classes according the xsd above. Then, in order to create a new xml document i use the following code :
CustomerDocument cd = CustomerDocument.Factory.newInstance();
CustomerType ct = cd.addNewCustomer();
PremiumCustomerType pct = PremiumCustomerType.Factory.newInstance();
ct.changeType(pct.schemaType());With this code i get an XML Document like the following :
<Customer type="PremiumCustomerType" />But after that, i cannot add an element CreditCard into this Customer element. Can anyone help me?In Indesign there is no way you can directly work on the XML-IN footnote, since indesign won't support XML tags in footnote stream.
To achive that you need to have XSLT/Perl/Indesign Scripting.
This task is achievable, you can create a auto footnote for XML workflow projects.
1. Create an XSLT to transform the footnote to the respective places
2. Change all the "<" ">" to some standard names, since indesign won't accept XML tags in the footnote stream.
3. Import it in indesign and using script convert it to autofootnote.
Shaji -
Problem mapping to XMLBean using database control
Hi
I have to generate an XML document based on the values returned from the database. I have an industry standard XSD with me and Im trying to use the database control to automatically map the resultset data to the XMLBean. While doing so, it works fine for flat structures that doesnt contain any complex types and attributes. But, when the XSD contains attributes or nested complex types it creates XMLBean with a flat structure and generates an invalid XML document. All the attributes get mapped to elements and thus when i try to validate, it fails.
I would appreciate if anyone can let me know if this is a limitation in weblogic 8.1 or do i need to configure something. This problem has been bugging me for a very long time and i have posted in all forums and i strongly feel that there is no point checking for everyfield value and setting into XMLBean manually. Also the number of fields in our XSD is 400. So any help would be greatly appreciated.
Thanks
KishoreHi Kishore,
This is vinod.I have same problem but not too complicated as yours.It is written u got simple values from database using flat structures.could u please post the code for me.
We have this requirement:
We have to retrieve the each row from the database and display in form of a tree.how do we get it.
Thanx in advance.
Vinodh -
How to covert XSD to XmlBeans classes in a Java class
Hi,
I have a xsd and need to get getter and setter methods for the elements in the xsd in a Java Class. Please help.
Regards,
Anujhttp://xmlbeans.apache.org/docs/2.4.0/reference/index.html
http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlObject.html
We should set schema type and populate the data as necessary.
Manoj
Edited by: Manoj Neelapu on May 10, 2010 11:14 AM -
Workshop ANT Script Error in JAX-WS and XMLBeans Facet
I am having a strange problem. I have a web service project created in Eclipse BEA Weblogic 9.2 Workshop IDE. The structure is:
-EAR...which consitutues
-JAX-WS WAR project
-EJB Project
The JAX-WS WAR has XMLBeans/XMLBuilder facets enabled to be used for compiling my XSD schemas being used in my web service.
When I build the project and export the ear through the IDE it works fine. I wanted to generate ANT scripts for all these projects so I can build and export the EAR through the command prompt. I was able to that. Now I wanted to check-in the project code in a source control management tool. Naturally I shouldn't check-in the .xbean_bin and .xbean_src folders generated by the the JAXB API against my schemas. The problem happens that when I delete these folders and then run my ANT build script through command prompt I get the following error:
assembly: [mkdir] Created dir: C:\Projects\kc\kces2\kcesWs\build\assembly\.src
[assemble] Input fileset contained no files, nothing to do. init.env: init.typedefs: init: generated.root.init: webservice.build:
[jwsc] JWS: processing module weboutput
[jwsc] Parsing source files
[jwsc] Parsing source files
[jwsc] 1 JWS files being processed for module weboutput [AntUtil.deleteDir] Deleting directory C:\DOCUME~1\Syunus\LOCALS~1\Temp\_5l950r10
BUILD FAILED
C:\Projects\KEYCOM~1\kces2\kcesEar\build.xml:184: The following error occurred while executing this line: jar:file:/C:/bea/WEBLOG%7e2/workshop/lib/wlw-antlib.jar!/com/bea/wlw/antlib/antlib.xml:91:
The following error occurred while executing this line: C:\Projects\KEYCOM~1\kces2\kcesEar\build.xml:196:
The following error occurred while executing this line: C:\Projects\kc\kces2\kcesWs\build.xml:401:
The following error occurred while executing this line: C:\Projects\kc\kces2\kcesWs\build.xml:293:
The following error occurred while executing this line: C:\Projects\kc\kces2\kcesWs\build.xml:490: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
Total time: 13 seconds
The above mentioned XMLBean folders are created, my schemas are compiled but the build process terminates at that point when trying to compile the web service code file i.e. the jwsc task fails. Right after that, if I again initiate the build everything goes fine. Apparently the build script expects these 2 XMLBean folders to be present before hand?
The ANT build chain goes like this:
-ANT build script for the EAR project -> which calls child ANT build scripts for all referenced sub projects, which are the WAR (here it fails on the first run) and the EJB projects in my case.
Any idea why it is happening? Thanks a lot.
cross-posted at
http://www.coderanch.com/t/485654/Ant-Maven-Other-Build-Tools/ANT-Script-Error-JAX-WS:Hi,
Hope you are doing good.
I needed some information on how to write a ANT script to create a deployable WAR file of web service built using JAX WS.
Could you help me with steps / ANT tasks / sample if any.
Thanks in advance.
Chandan
PWC -
Dynamic class loading issue with XmlBeans and Axis2
Hi,
Since support to web services is not enough in JDeveloper I am using apache axis2 to consume web services from an ADF web application.
Everything works fine if I use jdk 1.5 but our app servers require jdk 1.4.2_08-b03 so I switched jre settings to jdk 1.4.2_08-b03 in the JDeveloper and I started to get these issues.
I debugged the application and this line is the cause of the exception. It is in request document class.
return (org.htng.pws._2008a.guestselfservice.name.types.FetchProfileRequestDocument)org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance(type,
null);
I did some further testing and found that it is happening when I call org.apache.xmlbeans.XmlBeans.getContextTypeLoader()
The error messages that I am getting are
1. J*BO-29000: Unexpected exception caught: java.lang.IllegalAccessError, msg=tried to access field* org.htng.pws._2008a.guestselfservice.name.types.FetchProfileRequestDocument$1.class$org$htng$pws$_2008a$guestselfservice$name$types$FetchProfileRequestDocument from class org.htng.pws._2008a.guestselfservice.name.types.FetchProfileRequestDocument
2. tried to access field org.htng.pws._2008a.guestselfservice.name.types.FetchProfileRequestDocument$1.class$org$htng$pws$_2008a$guestselfservice$name$types$FetchProfileRequestDocument from class org.htng.pws._2008a.guestselfservice.name.types.FetchProfileRequestDocument
As I understand somehow the application server is not allowing the XMLBeans APIs to dynamically load the classes ..But I couldn’t find a way to convince it..
Does anybody have any idea by any chance?
Thanks a lotSome more details ..
I could make it work if I change the below getClassLoader with Thread.currentThread().getContextClassLoader()
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(FetchProfileResponseDocument.class.getClassLoader()This is a generated code and normally works fine with jdk 1.5 .. I guess there should be some setting to make it work in 1.4 as well..
Any Idea ?
Maybe you are looking for
-
How to display sub total text in ALV grid display reporting
Hi, I want to display a text 'SUB TOTAL' in Sub total row of an ALV report. Presently I am getting the name of the field used in sorting to get sub totals. But I required to display own text. Could you please give me solution. Thanks Giridhar Karn
-
Mail messages appear garbled in some parts of the text.
I carried out the upgrade this morning as it was suggested I do this. Now at least some messages are appearing with garbled text BUT not the whole page. when I say garbled I mean some text is overlapping other parts. Looking at one particular message
-
Derive Calendar Year/Month from FiscalYear/Period
Hi, I have ODS A and Cube A. Cube A has time characteristics which are not exist in ODS A. The Fiscal year/period characteristic in Cube A is based on a date infoobject (called Date1) in ODS A. For Calendar Year/Month, I want to derive it from fiscal
-
I installed Inbox Dollars toolbar, now Firefox won;t open at all. Using OS 3.6.8. Someone responded but I forgot to bookmark the answer, now I can't find it.
-
Hi there, I am using Captivate 6. I have been building a course using several Advanced Actions on specific click boxes and on entering and exiting slides, which have been working as expected. However, now, when trying to assign an action to any slide