java - Getting null pointer when calling web serive developed in the .net using web service client -
i consuming web service developed in .net. platform ibm rad,websphere 7 , jax rpc.
i write codeto call service, getting below null pointer exception. client code:
// string // endpoint="https://pilot.id3global.com/id3gws/id3global.svc/soap11_noauth"; // string endpoint="basichttpbinding_globalauthenticatestub"; // globalauthentication globalauth =new globalauthentication(); long l = new long("0"); // globalauth.setprofileid("4a6eaf41-f9a9-44f0-9700-81aa43004dab"); // globalauth.setprofileversion(l); globalprofileidversion profileidversion = new globalprofileidversion(); profileidversion.setid("4a6eaf41-f9a9-44f0-9700-81aa43004dab"); profileidversion.setversion(l); globalinputdata iinputdata = new globalinputdata(); globalpersonal personal = new globalpersonal(); globalpersonaldetails personaldetails = new globalpersonaldetails(); personaldetails.setforename("raymond"); personaldetails.setsurname("smith"); personaldetails.setdobday(01); personaldetails.setdobmonth(11); personaldetails.setdobyear(1951); personaldetails.setgender(globalgender.male); personal.setpersonaldetails(personaldetails); globaladdresses globaladdress = new globaladdresses(); globaladdress globaladres = new globaladdress(); globaladres.setpremise("3"); // iinputdata.addresses.currentaddress.building = ""; // commented out sending through building number in // premise whereas used building names // iinputdata.addresses.currentaddress.subbuilding = ""; // commented out no flat/apartment being sent globaladres.setstreet("high street"); globaladres.setcity("westbury"); globaladres.setzippostcode("ba13 3bn"); globaladres.setcountry("united kingdom"); globaladdress.setcurrentaddress(globaladres); globalidentitydocuments identitydocuments = new globalidentitydocuments(); globalinternationalpassport internationalpassport = new globalinternationalpassport(); internationalpassport .setnumber("1234567897gbr4511012m1803035<<<<<<<<<<<<<<00"); internationalpassport.setexpiryday(03); internationalpassport.setexpirymonth(03); internationalpassport.setexpiryyear(2018); internationalpassport.setcountryoforigin("united kingdom"); identitydocuments.setinternationalpassport(internationalpassport); // basichttpbinding_globalauthenticatestub stub=new // basichttpbinding_globalauthenticatestub("https://pilot.id3global.com/id3gws/id3global.svc/soap11_noauth","dfasdf"); // iglobalauthenticate authenticate=proxy.getiglobalauthenticate(); url wsdllocationurl = new url( "https://pilot.id3global.com/id3gws/id3global.svc?wsdl"); // url wsdllocationurl = new url("web-inf/wsdl/id3global.wsdl"); // qname qname = new qname("http://www.id3global.com/id3gws/2013/04", // "authenticatesp"); // final===> qname qname = new // qname("http://www.id3global.com/id3gws/2013/04", "id3global"); qname qname = new qname("http://www.id3global.com/id3gws/2013/04", "id3global"); service service = service.create(wsdllocationurl, qname); qname portqname = new qname("http://www.id3global.com/id3gws/2013/04", "basichttpbinding_globalauthenticate"); iglobalauthenticate proxy = service.getport(portqname, iglobalauthenticate.class); /******************* username & password ******************************/ map<string, object> req_ctx = ((bindingprovider) proxy) .getrequestcontext(); // req_ctx.put(bindingprovider.endpoint_address_property, // "https://pilot.id3global.com/id3gws/id3global.svc?wsdl"); map<string, list<string>> headers = new hashmap<string, list<string>>(); headers.put("username", collections.singletonlist("nreddy")); headers.put("password", collections.singletonlist("password")); req_ctx.put(messagecontext.http_request_headers, headers); iinputdata .setaddressdocuments(new globaladdressdocuments()); iinputdata.setaddresses(new globaladdresses()); iinputdata .setbankingdetails(new globalbankingdetails()); iinputdata .setcontactdetails(new globalcontactdetails()); iinputdata.setemployment(new globalemployment()); iinputdata.setglobalgeneric(new globalgeneric()); iinputdata.setidentitydocuments(identitydocuments); iinputdata.setimages(new globalimage[1]); iinputdata.setlocation(new globallocation()); iinputdata.setpersonal(personal); // globalresultdata response = null; try { globalresultdata response = proxy.authenticatesp(profileidversion, "example12345", iinputdata); // system.out.println("out responce after proxycall"+response.getbandtext().tostring()); } catch ( remoteexception e ) { e.printstacktrace(); } catch ( exception e ) { e.printstacktrace(); } return "";
excepetion:
[28/1/16 11:21:37:584 eet] 00000023 systemerr r javax.xml.ws.webserviceexception: java.lang.nullpointerexception [28/1/16 11:21:37:584 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.exceptionfactory.createwebserviceexception(exceptionfactory.java:175) [28/1/16 11:21:37:585 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.exceptionfactory.makewebserviceexception(exceptionfactory.java:70) [28/1/16 11:21:37:585 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.exceptionfactory.makewebserviceexception(exceptionfactory.java:128) [28/1/16 11:21:37:585 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.runtime.description.marshal.impl.marshalserviceruntimedescriptionbuilder.init(marshalserviceruntimedescriptionbuilder.java:79) [28/1/16 11:21:37:585 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.runtime.description.marshal.impl.marshalserviceruntimedescriptionbuilder.create(marshalserviceruntimedescriptionbuilder.java:52) [28/1/16 11:21:37:585 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.runtime.description.marshal.marshalserviceruntimedescriptionfactory.get(marshalserviceruntimedescriptionfactory.java:53) [28/1/16 11:21:37:586 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.marshaller.factory.methodmarshallerfactory.getmarshaller(methodmarshallerfactory.java:111) [28/1/16 11:21:37:586 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.createrequest(jaxwsproxyhandler.java:458) [28/1/16 11:21:37:586 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.invokeseimethod(jaxwsproxyhandler.java:241) [28/1/16 11:21:37:586 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.invoke(jaxwsproxyhandler.java:208) [28/1/16 11:21:37:586 eet] 00000023 systemerr r @ com.sun.proxy.$proxy27.authenticatesp(unknown source) [28/1/16 11:21:37:586 eet] 00000023 systemerr r @ com.eeft.ws.ppd.authenticatewsbeanportbindingimpl.callrequest(authenticatewsbeanportbindingimpl.java:283) [28/1/16 11:21:37:587 eet] 00000023 systemerr r @ com.eeft.ws.ppd.authenticatewsbeanportbindingimpl.authenticate(authenticatewsbeanportbindingimpl.java:73) [28/1/16 11:21:37:587 eet] 00000023 systemerr r @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) [28/1/16 11:21:37:587 eet] 00000023 systemerr r @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:60) [28/1/16 11:21:37:588 eet] 00000023 systemerr r @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:37) [28/1/16 11:21:37:588 eet] 00000023 systemerr r @ java.lang.reflect.method.invoke(method.java:611) [28/1/16 11:21:37:589 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.dispatchers.java.javadispatcher.invokemethod(javadispatcher.java:203) [28/1/16 11:21:37:589 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.dispatchers.java.javadispatcher.invokeoperation(javadispatcher.java:158) [28/1/16 11:21:37:589 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.dispatchers.soaprpcprocessor.processrequestresponse(soaprpcprocessor.java:490) [28/1/16 11:21:37:589 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.dispatchers.soaprpcprocessor.processmessage(soaprpcprocessor.java:433) [28/1/16 11:21:37:589 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.dispatchers.basicdispatcher.processmessage(basicdispatcher.java:134) [28/1/16 11:21:37:589 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.dispatchers.java.sessiondispatcher.invoke(sessiondispatcher.java:204) [28/1/16 11:21:37:589 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.pivothandlerwrapper.invoke(pivothandlerwrapper.java:263) [28/1/16 11:21:37:590 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.handlers.jaxrpc.jaxrpchandler.invoke(jaxrpchandler.java:153) [28/1/16 11:21:37:590 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.handlers.wrappedhandler.invoke(wrappedhandler.java:64) [28/1/16 11:21:37:590 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.pivothandlerwrapper.invoke(pivothandlerwrapper.java:263) [28/1/16 11:21:37:590 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.pivothandlerwrapper.invoke(pivothandlerwrapper.java:263) [28/1/16 11:21:37:592 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.webservicesengine.invoke(webservicesengine.java:336) [28/1/16 11:21:37:592 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.transport.http.webservicesservlet.dopost(webservicesservlet.java:1246) [28/1/16 11:21:37:592 eet] 00000023 systemerr r @ javax.servlet.http.httpservlet.service(httpservlet.java:738) [28/1/16 11:21:37:592 eet] 00000023 systemerr r @ com.ibm.ws.webservices.engine.transport.http.webservicesservletbase.service(webservicesservletbase.java:344) [28/1/16 11:21:37:592 eet] 00000023 systemerr r @ javax.servlet.http.httpservlet.service(httpservlet.java:831) [28/1/16 11:21:37:593 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.servlet.servletwrapper.service(servletwrapper.java:1700) [28/1/16 11:21:37:593 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.servlet.servletwrapper.handlerequest(servletwrapper.java:970) [28/1/16 11:21:37:593 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.servlet.servletwrapper.handlerequest(servletwrapper.java:508) [28/1/16 11:21:37:593 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.servlet.servletwrapperimpl.handlerequest(servletwrapperimpl.java:181) [28/1/16 11:21:37:593 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.webapp.webapp.handlerequest(webapp.java:3994) [28/1/16 11:21:37:593 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.webapp.webgroup.handlerequest(webgroup.java:276) [28/1/16 11:21:37:593 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.webcontainer.handlerequest(webcontainer.java:945) [28/1/16 11:21:37:594 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.wswebcontainer.handlerequest(wswebcontainer.java:1592) [28/1/16 11:21:37:595 eet] 00000023 systemerr r @ com.ibm.ws.webcontainer.channel.wcchannellink.ready(wcchannellink.java:191) [28/1/16 11:21:37:595 eet] 00000023 systemerr r @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.handlediscrimination(httpinboundlink.java:454) [28/1/16 11:21:37:595 eet] 00000023 systemerr r @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.handlenewrequest(httpinboundlink.java:516) [28/1/16 11:21:37:595 eet] 00000023 systemerr r @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.processrequest(httpinboundlink.java:307) [28/1/16 11:21:37:596 eet] 00000023 systemerr r @ com.ibm.ws.http.channel.inbound.impl.httpinboundlink.ready(httpinboundlink.java:278) [28/1/16 11:21:37:596 eet] 00000023 systemerr r @ com.ibm.ws.tcp.channel.impl.newconnectioninitialreadcallback.sendtodiscriminators(newconnectioninitialreadcallback.java:214) [28/1/16 11:21:37:596 eet] 00000023 systemerr r @ com.ibm.ws.tcp.channel.impl.newconnectioninitialreadcallback.complete(newconnectioninitialreadcallback.java:113) [28/1/16 11:21:37:596 eet] 00000023 systemerr r @ com.ibm.ws.tcp.channel.impl.aioreadcompletionlistener.futurecompleted(aioreadcompletionlistener.java:175) [28/1/16 11:21:37:596 eet] 00000023 systemerr r @ com.ibm.io.async.abstractasyncfuture.invokecallback(abstractasyncfuture.java:217) [28/1/16 11:21:37:597 eet] 00000023 systemerr r @ com.ibm.io.async.asyncchannelfuture.firecompletionactions(asyncchannelfuture.java:161) [28/1/16 11:21:37:597 eet] 00000023 systemerr r @ com.ibm.io.async.asyncfuture.completed(asyncfuture.java:138) [28/1/16 11:21:37:597 eet] 00000023 systemerr r @ com.ibm.io.async.resulthandler.complete(resulthandler.java:204) [28/1/16 11:21:37:597 eet] 00000023 systemerr r @ com.ibm.io.async.resulthandler.runeventprocessingloop(resulthandler.java:775) [28/1/16 11:21:37:597 eet] 00000023 systemerr r @ com.ibm.io.async.resulthandler$2.run(resulthandler.java:905) [28/1/16 11:21:37:598 eet] 00000023 systemerr r @ com.ibm.ws.util.threadpool$worker.run(threadpool.java:1662) [28/1/16 11:21:37:598 eet] 00000023 systemerr r caused by: java.lang.nullpointerexception [28/1/16 11:21:37:599 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.runtime.description.marshal.impl.artifactprocessor.getpackagename(artifactprocessor.java:497) [28/1/16 11:21:37:599 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.runtime.description.marshal.impl.artifactprocessor.build(artifactprocessor.java:107) [28/1/16 11:21:37:599 eet] 00000023 systemerr r @ org.apache.axis2.jaxws.runtime.description.marshal.impl.marshalserviceruntimedescriptionbuilder.init(marshalserviceruntimedescriptionbuilder.java:77) [28/1/16 11:21:37:599 eet] 00000023 systemerr r ... 52 more
i stuck , appreciated.
thanks, naren
you may create wrong service.
first must create service:
final constructor<s> serviceconstructor = serviceclass.getconstructor(url.class, qname.class); serviceconstructor.newinstance(**null**, new qname(services_namespace, servicename));
and put param end-point:
string endpointaddress = “http://.....”; ((bindingprovider) port).getrequestcontext().put(bindingprovider.endpoint_address_property, endpointaddress); log.trace("endpoint address \"{}\".", endpointaddress);
Comments
Post a Comment