[ 
https://issues.apache.org/jira/browse/AXIS2-2088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472149
 ] 

Dennis Sosnoski commented on AXIS2-2088:
----------------------------------------

The exception looks to be caused by not using the prefix assigned to the 
namespace on the type-names within the JiBX binding. The binding defines types 
used by the WSDL with names:

<binding forwards="false" value-style="attribute"  
xmlns:ns2="http://login/types";>
  <namespace uri="http://login/types"; default="elements"/>
  <mapping class="login.types.ReturnWebLoginElement" 
type-name="return-web-login-element">
    <value style="element" name="local-soap_session_id-element" 
field="localSoap_session_idElement" usage="optional"/>
    <value style="element" name="local-web_user_name-element" 
field="localWeb_user_nameElement" usage="optional"/>
  </mapping>
  ...

But the types are expected to be defined within the http://login/types 
namespace, and this doesn't do it. To have the type-name be in the proper 
namespace you need to actually use the prefix declared for that namespace as 
part of the value of the type-name. In this case, the <mapping> element should 
be changed to:

  <mapping class="login.types.ReturnWebLoginElement" 
type-name="ns2:return-web-login-element">

With this change, the NPE should be avoided. I've entered a JiBX bug 
(http://jira.codehaus.org/browse/JIBX-152) to address the NPE issue itself.

There are other problems with the supplied samples, though. The WSDL schema 
component does not specify elementFormDefault="qualified", so only the 
top-level elements (WebLoginElement and ReturnWebLoginElement) should be 
namespaces. The supplied binding applies the namespace to all element names. 
For use without the '-uw' option the binding would also need to be changed to 
use element names in the proper namespace on the <mapping> components 
(unwrapped matches type-names in the binding definition, wrapped matches 
element names)

I don't have any response to the first point raised, about the ant task, so I'm 
not marking this bug resolved even though this comment should take care of the 
"big one" part of the issue.

> wsdl2java  JiBX code generator and -Ebindingfile option unavailable in ant 
> task
> -------------------------------------------------------------------------------
>
>                 Key: AXIS2-2088
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2088
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.1.1
>         Environment: Windows XP SP2, jre 1.5 update 10, and 1.7.0
>            Reporter: Jorge Fernández
>         Attachments: binding.xml, build.xml, LoginServiceJiBX.wsdl, 
> ReturnWebLoginElement.java, WebLoginElement.java
>
>
> First the little question:  is there any way for passing the -Ebindingfile in 
> the ant task of wsdl2java? because I didn't find it.
> The big one: I'm having a problem with wsdl2java code generation. I'm trying 
> JiBX databinding in wrapped mode. I've got my objects defined, my wsdl 
> definition of the service and  I made my binding definition manually. I also 
> made an ant task, following the steps of the jibx tutorial. I generated the 
> binding definition with JiBX tools.
> This is the problem:
> When I use the ant task for compiling the binding definition with the 
> build.xml, everything seems to go alright. After that, I would have to type 
> some code for running the service and that's why I decided to use wsdl2java.  
> When I use wsdl2java for code generation I get this error:
> I use the command like this:
> wsdl2java -uri LoginServiceJiBX.wsdl -o src\ -p loginjibx -ss -sd -d jibx -g 
> -sn LoginServiceJiBX -pn LoginEndpointPort -ns2p 
> http://login=login,http://www.w3.org/2001/XMLSchema=org.w3.www._2001.xmlschema,http://login/types=login.types,http:/
> /schemas.xmlsoap.org/wsdl/soap=org.xmlsoap.schemas.wsdl.soap,http://schemas.xmls
> oap.org/wsdl=org.xmlsoap.schemas.wsdl -ssi -Ebindingfile binding.xml
> This is the trace:
> Using AXIS2_HOME:   D:\Programas\PFC\axis2-1.1.1
> Using JAVA_HOME:    D:\Programas\Java\jdk1.5.0_09
> Exception in thread "main" 
> org.apache.axis2.wsdl.codegen.CodeGenerationException
> : java.lang.NullPointerException
>         at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener
> ationEngine.java:224)
>         at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
>         at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
> Caused by: java.lang.NullPointerException
>         at 
> org.jibx.runtime.impl.StAXReaderWrapper.getNamespace(StAXReaderWrappe
> r.java:455)
>         at 
> org.jibx.runtime.impl.UnmarshallingContext.getNamespaceUri(Unmarshall
> ingContext.java:3125)
>         at org.jibx.runtime.QName.deserialize(QName.java:234)
>         at 
> org.jibx.binding.model.MappingElement.setQualifiedTypeName(MappingEle
> ment.java:261)
>         at 
> org.jibx.binding.model.MappingElement.JiBX_binding_unmarshalAttr_5_0(
> MappingElement.java)
>         at 
> org.jibx.binding.model.JiBX_bindingMappingElement_access.unmarshal()
>         at 
> org.jibx.binding.model.BindingElement.JiBX_binding_unmarshal_3_0(Bind
> ingElement.java)
>         at 
> org.jibx.binding.model.JiBX_bindingBindingElement_access.unmarshal()
>         at 
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(Unmarshal
> lingContext.java:2538)
>         at 
> org.jibx.binding.model.BindingElement.readBinding(BindingElement.java
> :609)
>         at 
> org.jibx.binding.model.BindingElement.readBinding(BindingElement.java
> :625)
>         at 
> org.apache.axis2.jibx.CodeGenerationUtility.engage(CodeGenerationUtil
> ity.java:240)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at 
> org.apache.axis2.wsdl.codegen.extension.JiBXExtension.engage(JiBXExte
> nsion.java:74)
>         at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGener
> ationEngine.java:177)
>         ... 2 more
> I made it also in unwrapped mode and there was no problem with that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to