You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Dennis Sosnoski <dm...@sosnoski.com> on 2007/01/15 23:49:38 UTC

[Axis2] JiBX unwrapped with Fault example

I've posted an example of using JiBX unwrapped handling with Axis2 1.1.1 
at http://www.sosnoski.com/jibx-wiki/space/axis2-jibx The Fault handling 
is especially confusing, so I included a detailed breakdown of how this 
works.

  - Dennis

-- 
Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2] JiBX unwrapped with Fault example

Posted by david2 <Da...@l-3comcept.com>.
Dennis,

One other thing:  after I successfully ran the web service generated by the
library example, I added a simple unmarshall/marshall target to the
build.xml.  However, I can't get an XML file containing a Type element to
successfully marshall or unmarshall.

This is the ant target I am using to marshall/unmarshall (based upon your
run target, and added to your existing build.xml):

  <target name="run-jibx">  
    <java classname="test.JiBXTest"
        fork="true">
      <classpath path="${build-client}/bin"/>
      <classpath refid="axis-classpath"/>
      <classpath refid="jibx-classpath"/>
      <classpath path="${build-client}/lib/shared.jar"/>
      <arg value="${build-client}\data.xml"/>
      <arg value="${build-client}\out.xml"/>
    </java>
  </target>


Here is the XML file to be unmarshalled (data.xml):

     <?xml version="1.0" encoding="UTF-8"?>
     <Type name="java" count="5">About Java</Type>


The test client I am using (based upon an existing JiBX example) is as
follows:

    package test;

    import java.io.FileInputStream;
    import java.io.FileOutputStream;

    import org.jibx.runtime.BindingDirectory;
    import org.jibx.runtime.IBindingFactory;
    import org.jibx.runtime.IMarshallingContext;
    import org.jibx.runtime.IUnmarshallingContext;

    import com.sosnoski.ws.library.jibx.Type;

    public class JiBXTest {

        public static void main(String[] args) throws Exception {

            IBindingFactory bfact = BindingDirectory.getFactory(Type.class);
            IUnmarshallingContext uctx = bfact.createUnmarshallingContext();

            FileInputStream in = new FileInputStream(args[0]);
            Type object = (Type) uctx.unmarshalDocument(in, null);

            IMarshallingContext mctx = bfact.createMarshallingContext();
            mctx.setIndent(2);
            FileOutputStream out = new FileOutputStream(args[1]);
            mctx.marshalDocument(object, "UTF-8", null, out);
        }
    }


and the error generated is:

     C:\development\Axis2\jibx-library>ant run-jibx
     Buildfile: build.xml

     run-jibx:
          [java] unmarshalling file:
C:\development\Axis2\jibx-library\client\data.xml
          [java] Exception in thread "main" org.jibx.runtime.JiBXException:
No unmarshaller for element "Type" (line 2, col 29)
          [java]     at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2535)
          [java]     at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2681)
          [java]     at test.JiBXTest.main(JiBXTest.java:24)
          [java] Java Result: 1


I have successfully run similar tests on some of my other bindings.  Any
idea why it may be failing on Type?

-David
-- 
View this message in context: http://www.nabble.com/-Axis2--JiBX-unwrapped-with-Fault-example-tf3017807.html#a9939598
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Validation Error with library.wsdl in Example

Posted by david2 <Da...@l-3comcept.com>.
Anil,

What exactly is being overwritten?

I'm new at this, but I believe that the Skeleton is the only thing you
should be providing if you are using WSDL2Java.  All of the other classes
that are generated by WSDL2Java should be used as-is.

-David
-- 
View this message in context: http://www.nabble.com/-Axis2--JiBX-unwrapped-with-Fault-example-tf3017807.html#a9949177
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Validation Error with library.wsdl in Example

Posted by Anil VVNN <vv...@yahoo.com>.
Hi,

I have a question  about WSDL2Java code generation tool, I have a
requirement to change the generated files i.e. wrapper objects of complex
types and skeleton code. 

But after modifying the generated files, if I run WSD2Java again it is
overriding all the changes except for skeleton code.

So, any option to not to override files if the files are already present.
Thanks.

- Anil


david2 wrote:
> 
> Dennis,
> 
> Bless you my son for the incredible insight you have provided in this
> example.  I had wrestled with the issue of JiBX mapping for non-trivial
> types for many hours before I stumbled on your example.  I am well on my
> way now.
> 
> One thing:  Although I can get your example to work, and I have been able
> to duplicate the approach in my own application, I was not able to get
> either your WSDL or my similarly constructed WSDL to validate in NetBeans.
> 
> The error generated is:
> 
> 
>      XML validation started.
> 
>      C:/netBeansWorkspace/Sandbox/library.wsdl:26,12
>      src-resolve: Cannot resolve the name 'tns:BookInformation' to a(n)
> 'type definition' component.
> 
>      1 Error(s),  0 Warning(s).
>      XML validation finished.
> 
> Any idea what might be going wrong, or is it possibly just a NetBeans
> issue?
> 
> -David
> 

-- 
View this message in context: http://www.nabble.com/-Axis2--JiBX-unwrapped-with-Fault-example-tf3017807.html#a9940228
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Validation Error with library.wsdl in Example

Posted by david2 <Da...@l-3comcept.com>.
Dennis,

Bless you my son for the incredible insight you have provided in this
example.  I had wrestled with the issue of JiBX mapping for non-trivial
types for many hours before I stumbled on your example.  I am well on my way
now.

One thing:  Although I can get your example to work, and I have been able to
duplicate the approach in my own application, I was not able to get either
your WSDL or my similarly constructed WSDL to validate in NetBeans.

The error generated is:


     XML validation started.

     C:/netBeansWorkspace/Sandbox/library.wsdl:26,12
     src-resolve: Cannot resolve the name 'tns:BookInformation' to a(n)
'type definition' component.

     1 Error(s),  0 Warning(s).
     XML validation finished.

Any idea what might be going wrong, or is it possibly just a NetBeans issue?

-David
-- 
View this message in context: http://www.nabble.com/-Axis2--JiBX-unwrapped-with-Fault-example-tf3017807.html#a9938387
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org