0
I have a Webservice written C# and need to connect to it from Java to invoke some methods.
It is possible?
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
public class SoapClient {
public static void main(String[] args) {
URL wsdlLocation = null;
try {
wsdlLocation = new URL("http://localhost:8000/eamsLink/RepositoryService/?wsdl");
} catch (MalformedURLException ex) {
Logger.getLogger(SoapClient.class.getName()).log(Level.SEVERE, null, ex);
}
QName qname = new QName("http://tempuri.org/", "RemoteSourceService");
Service service = Service.create(wsdlLocation, qname);
}
}
I’m trying this way but I’m having this error on the console:
Exception in thread "main" java.lang.NullPointerException
at com.sun.xml.internal.ws.model.wsdl.WSDLOperationImpl.freeze(Unknown Source)
at com.sun.xml.internal.ws.model.wsdl.WSDLPortTypeImpl.freeze(Unknown Source)
at com.sun.xml.internal.ws.model.wsdl.WSDLBoundPortTypeImpl.freeze(Unknown Source)
at com.sun.xml.internal.ws.model.wsdl.WSDLModelImpl.freeze(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(Unknown Source)
at javax.xml.ws.Service.<init>(Unknown Source)
at javax.xml.ws.Service.create(Unknown Source)
at SoapClient.main(SoapClient.java:22)
What is
NullPointerException
and what its main causes?– Renan Gomes
@Renan is not null. I have checked the whole object.
– Zinid