Hi Alex,

I created a Fault example at http://www.sosnoski.com/jibx-wiki/space/axis2-jibx This has a fairly detailed analysis of how the Fault handling works, so hopefully it'll help you out. Faults are handled for both wrapped and unwrapped cases, but the Faults themselves are essentially always wrapped due to the Axis2 handling.

 - 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



Alexander Grivnin wrote:
Dennis,

 Yes the NPE went away and now I'm getting a different exception.

 Can it be that faults supported only for wrapped generation style?

Thanks,
Alex
Exception:
-------------------------------
[java] org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: No mapping defined for element {
http://mercury.com/ppm/common/1.0}PPMFault
     [java]     at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerati
onEngine.java:224)
     [java]     at
org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
     [java]     at org.apache.axis2.wsdl.WSDL2Java.main
(WSDL2Java.java:21)
     [java] Caused by: java.lang.RuntimeException: No mapping defined
for element { http://mercury.com/ppm/common/1.0}PPMFault
     [java]     at
org.apache.axis2.jibx.CodeGenerationUtility.mapQName(CodeGenerationUtili
ty.java:928)
     [java]     at
org.apache.axis2.jibx.CodeGenerationUtility.mapMessage(CodeGenerationUti
lity.java:914)
     [java]     at org.apache.axis2.jibx.CodeGenerationUtility.engage
(CodeGenerationUtility.java:396)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [java]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a :39)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:324)
     [java]     at
org.apache.axis2.wsdl.codegen.extension.JiBXExtension.engage
(JiBXExtension.java:74)
     [java]     at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerati
onEngine.java:177)
     [java]     ... 2 more
     [java] Exception in thread "main"
     [java] Java Result: 1


-------------------------------



-----Original Message-----
From: Dennis Sosnoski [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 10, 2007 6:10 PM
To: [email protected]
Subject: Re: [Axis2] JiBX with Faults

You should probably update to the new Axis 1.1.1 release - I haven't
seen this exception before, but I know there was an Axiom change for
1.1.1 that was related to NPEs with namespaces.

  - Dennis

Alexander Grivnin wrote:
Thanks Dennis,

 After I removed the abstract keyword from the mapping it started to
throw NPE. And it seems to be from namespace resolution. I'm posting
the
stack here.

Thanks very much for your help,
Alex

---------------------------
[java] java.lang.NullPointerException
[java]     at

org.jibx.runtime.impl.StAXReaderWrapper.getNamespace(StAXReaderWrapper.j
ava:455)
[java]     at

org.jibx.runtime.impl.UnmarshallingContext.getNamespaceUri(Unmarshalling
Context.java :3125
[java]     at org.jibx.runtime.QName.deserialize(QName.java:234)
[java]     at

org.jibx.binding.model.MappingElement.setQualifiedTypeName(MappingElemen
t.java:261)
[java]     at
org.jibx.binding.model.MappingElement.JiBX_binding_unmarshalAttr_5_0
(MappingElement.java)
[java]     at
org.jibx.binding.model.JiBX_bindingMappingElement_access.unmarshal()
[java]     at

org.jibx.binding.model.BindingElement.JiBX_binding_unmarshal_3_0(Binding
Element.java)
[java]     at
org.jibx.binding.model.JiBX_bindingBindingElement_access.unmarshal()
[java]     at

org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unmarshallin
gContext.java:253
[java]     at org.jibx.binding.model.BindingElement.readBinding
(BindingElement.java:609)
[java]     at

org.jibx.binding.model.IncludeElement.prevalidate(IncludeElement.java:15
1)
[java]     at

org.apache.axis2.jibx.CodeGenerationUtility$IncludePrevalidationVisitor.
visit(CodeGenerat
[java]     at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:163)
[java]     at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:232)
[java]     at org.jibx.binding.model.TreeContext.tourTree
(TreeContext.java:122)
[java]     at

org.apache.axis2.jibx.CodeGenerationUtility.engage(CodeGenerationUtility
.java:244)
[java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java]     at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
[java]     at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
[java]     at java.lang.reflect.Method.invoke(Method.java:324)
[java]     at

org.apache.axis2.wsdl.codegen.extension.JiBXExtension.engage(JiBXExtensi
on.java:74)
[java]     at

org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerati
onEngine.java:177
[java]     at org.apache.axis2.wsdl.WSDL2Code.main (WSDL2Code.java:32)
[java]     at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
[java] org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: invalid jibx
[java]     at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate
(CodeGenerationEngine.java:224
[java]     at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
[java]     at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
[java] Caused by: java.lang.RuntimeException : invalid jibx binding
definition file N:\Kintana\KntaDev\S
[java]     at

org.apache.axis2.jibx.CodeGenerationUtility.engage(CodeGenerationUtility
.java:246)
[java]     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native
Method)
[java]     at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
[java]     at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
[java]     at java.lang.reflect.Method.invoke(Method.java:324)
[java]     at

org.apache.axis2.wsdl.codegen.extension.JiBXExtension.engage(JiBXExtensi
on.java:74)
[java]     at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate
(CodeGenerationEngine.java:177
[java]     ... 2 more
[java] Exception in thread "main"
---------------------------


-----Original Message-----
From: Dennis Sosnoski [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 10, 2007 5:23 PM
To: [email protected]
Subject: Re: [Axis2] JiBX with Faults

Hi Alex,

Because of the way Axis2 handles faults, you need to use a
non-abstract
mapping for the fault element even when unwrapping. I'll post an
example
on the JiBX-Axis2 wiki page later today to illustrate.

  - 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



Alexander Grivnin wrote:

Hi,

 We are using JiBX serialization mechanism (from 1.1.1-RC1) and

decided

to add custom faults to the WSDL. For some reason the wsdl2java
compilation fails complaining that it does not find any corresponding
mapping for the fault type.

 Any ideas?

Thanks in advance,
Alex


Here is the WSDL fragment:
--------------------------

<wsdl:message name="PPMFaultMessage">
        <wsdl:part name="fault" element="common:PPMFault"/>
</wsdl:message>
...
<wsdl:operation name="fetchRequests">
        <wsdl:input message="axis2:fetchRequestsMessage"/>
        <wsdl:output message="axis2:fetchRequestsResponseMessage"/>
                <wsdl:fault name="PPMFaultException"
message="axis2:PPMFaultMessage"/>
</wsdl:operation>


The xsd fragment:
-----------------

<complexType name="PPMFault">
        <sequence>
                <element name="message" type="xs:string"/>
        </sequence>
</complexType>


The mapping fragment:
---------------------

<binding xmlns:common="http://mercury.com/ppm/common/1.0";>

        <namespace uri="http://mercury.com/ppm/common/1.0";
prefix="common"  />

<mapping abstract="true" class="com.mercury.PPMFault"

type-name="common:

PPMFault" ordered="false" >
        <value name="message" field="message" usage="optional"/>
</mapping>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to