Friday, August 14, 2015

Error on JBoss 6.2 while calling webservice when wsdl:binding tag is before wsdl:portType in WSDL

Exception while calling webservice call Jboss server when wsdl:binding tag is before wsdl:portType tag  in wsdl. 

Stack trace for error :
13:29:59,406 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) Caused by: java.lang.NullPointerException
13:29:59,406 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parseExtensibilityAttributes(WSDLReaderImpl.java:1334)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parseOperation(WSDLReaderImpl.java:1684)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parsePortType(WSDLReaderImpl.java:1474)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:313)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2265)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2251)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:261)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:206)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:98)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:149)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.(ProviderImpl.java:509)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:204)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at javax.xml.ws.Service.(Service.java:57)

Reason:
JBoss uses wsdl4j-1.6.2.redhat-6.jar (Jboss version 6.2), which does not contain fix for the issue.
Path to jar in JBoss : \jboss-eap-6.2\modules\system\layers\base\javax\wsdl4j\api\main

[A NPE occurs when parsing a WSDL with the defined before the element. See stack trace below. The cause is in parseOperation - the line that sets 'op' to null if retrieved = true should be moved after the invocation of parseExtensibilityAttributes]

Detailed information is available at:  http://sourceforge.net/p/wsdl4j/bugs/37/


Sunday, January 4, 2015

Spring Notes : What is Spring Framework

What is Spring Framework?
Spring is a lightweight  framework for building Enterprise applications using Java. It provides all infrastructure support for developing applications. You can build your applications using POJO (Plain old java objects) without worrying about enterprise service code like transaction management, logging etc. It is a modular framework which helps you to use only those modules which are required for your application. You can easily integrate Spring features with other frameworks like Hibernate, Struts etc. Dependency Injection is main feature of Spring.

Dependency Injection:
Dependency Injection is core of Spring framework. In Dependency Injection, Container is responsible for Object Life-cycle (object creation, resolving dependencies for object etc) and enterprise applications can be built using POJO's. It can be achieved using configuration files or annotations.

Different modules of Spring:
1. Core container: Core, Beans, Context, Spring Expression language(SpEL) modules
2. Spring AOP (Aspect oriented programming) :AOP module
3. Data Access/ Integration: JDBC, ORM, OMX, JMS, Transactions modules
4. Web: Web, Web-Servlet, Web-Socket, Web-Portlet modules
5. Test : Test module for testing Spring components usinh JUnit or TestNG frameworks.