Soap error "Object reference not set to an instance of an object" while using .net service in php -
i'm trying use .net soap webservice in php, i've tried keep getting error "object reference not set instance of object". here's code i've got right now:
$client = new soapclient('http://url.com/desktopmodules/iwebcsharp/webservice.asmx?wsdl', array('trace' => true)); $head = array(); $head['portalid'] = 0; $head['userid'] = 1; $head['username'] = 'foo'; $head['password'] = 'bar'; $head['encrypted'] = 'false'; $head['webpagecall'] = 'false'; $head['moduleid'] = 523; $header = new soapheader('http://schemas.xmlsoap.org/soap/envelope/', 'iwebauthendication', $head); $client->__setsoapheaders($header); $client->getuser(array('getuser' => array('someuser', 'username'))); when run , check request sent ($client->__getlastrequest()) following:
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://webservices.dotnetnuke.com/"><soap-env:header><soap-env:iwebauthendication><!-- authentication stuff //--></soap-env:iwebauthendication></soap-env:header><soap-env:body><ns1:getuser/></soap-env:body></soap-env:envelope> the relevant part there of course this:
<soap-env:body><ns1:getuser/></soap-env:body> why not getting parameter through? doing wrong? i've searched lot, both here on , google, every solution i've seen has been working others not working me. webservice part of dotnetnuke system , can make work if use curl know webservice can't broken want use soapclient() calls instead because it's lot easier , lot less code.
here relevant code .net webservice:
public userinfo getuser(string username) { userinfo objresponse = new userinfo(); try { iwebauthendication objiwebauthendication = new iwebauthendication(iwebcredentials); if (!(objiwebauthendication.validandauthorized())) { objresponse.userid = -1; objresponse.username = "not authorized"; return objresponse; } objresponse = iwebuser.getuserinfo(iwebcredentials.portalid, username); // not return password administrator if ((objresponse.issuperuser == false & objresponse.isinrole("administrators") == false)) { objresponse.membership.password = usercontroller.getpassword(ref objresponse, "").tostring(); } else { objresponse.membership.password = "administrator password supressed"; } } catch (exception ex) { objresponse.userid = -1; objresponse.username = ex.message; } return objresponse; } and here's relevant part of wsdl:
<wsdl:operation name="getuser"> <soap:operation soapaction="http://webservices.dotnetnuke.com/getuser" style="document"/> <wsdl:input> <soap:body use="literal"/> <soap:header message="tns:getuseriwebauthendicationheader" part="iwebauthendicationheader" use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> how can make work in php soapclient()?
Comments
Post a Comment