Hi ,
It looks like the WSDLServiceFactory can 't get the WSDLManager from
the bus when you try to create a service model for the client.
public WSDLServiceFactory(Bus b, String url, QName sn) {
setBus(b);
try {
// use wsdl manager to parse wsdl or get cached definition
definition =
getBus().getExtension(WSDLManager.class).getDefinition(url); // The NPE
is thrown form here
} catch (WSDLException ex) {
throw new ServiceConstructionException(new
Message("SERVICE_CREATION_MSG", LOG), ex);
}
serviceName = sn;
}
It could be your WSDLManager does not be set to the bus.
Can you tell me how did you initialize the bus?
Did you use the spring configuration or load the bus by other means?
Maybe you can set the log level to INFO for more information.
Willem.
green804 wrote:
I have this code working in my development environment, but when I employ to
our test environment I'm getting a null pointer. I'm not sure why this is
happening. Can someone give me any pointers? I'm really desperate to find
a solution.
java.lang.NullPointerException
at
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:81)
at
org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:112)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:104)
at
org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:55)
at javax.xml.ws.Service.<init>(Service.java:57)
at com.mysite.services.news.NewsService.<init>(NewsService.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>From code:
@WebServiceClient(name = "NewsService", targetNamespace =
"http://services.mysite.com/News", wsdlLocation =
"http://mysite.com/services/NewsService.svc?wsdl")
public class NewsService extends Service {
private final static URL WSDL_LOCATION;
private final static QName SERVICE = new
QName("http://services.mysite.com/News", "NewsService");
private final static QName BasicHttpBinding = new
QName("http://services.mysite.com/News", "basicHttpBinding");
static {
URL url = null;
try {
url = new
URL("http://mysite.com/services/NewsService.svc?wsdl");
} catch (MalformedURLException e) {
System.err.println("Can not initialize the default wsdl from
http://mysite.com/services/NewsService.svc?wsdl");
// e.printStackTrace();
}
WSDL_LOCATION = url;
}
public NewsService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public NewsService() {
super(WSDL_LOCATION, SERVICE);
}
/**
*
* @return
* returns BasicHttpBinding
*/
@WebEndpoint(name = "basicHttpBinding")
public NewsServiceContract getBasicHttpBinding() {
return (NewsServiceContract)super.getPort(BasicHttpBinding,
NewsServiceContract.class);
}