How does PHP call the. NET WebService? 100 Distribute on

Source: Internet
Author: User
How does PHP call the. NET WebService??? 100 Distribute on
How does PHP call the. NET WebService? Please enlighten me, I wrote a part of the program, but always prompt error: Not created instance object, everyone help me to see, where is wrong?
Client PHP Program:
Require ('./require/nusoap/lib/nusoap.php ');
$userinfo =array (' username ' = ' fiekscos ');
$s =new soapclient (' Http://www.yy-sports.com/webservice/memberinfo.asmx?WSDL ');
$s->soap_defencoding = ' UTF-8 ';
$s->decode_utf8 = false;
$result = $s->__soapcall (' validuserloginname ', Array (' userloginname ' = $userinfo));
echo $result;
?>
Server-side. NET WebService Program:
Using System;
Using System.Collections;
Using System.Web;
Using System.Web.Services;
Using System.Web.Services.Protocols;

Using COM. Basic;

///
Summary description of MemberInfo
///
[WebService (Namespace = "http://tempuri.org/")]
[WebServiceBinding (ConformsTo = wsiprofiles.basicprofile1_1)]
To allow the Web service to be called from the script using ASP. NET AJAX, uncomment the downstream.
[System.Web.Script.Services.ScriptService]
public class MemberInfo:System.Web.Services.WebService
{
//
SOAP Authentication Class
///
Public Securityheader CurrentUser
{
get {return _currentuser;}
set {_currentuser = value;}
}
Private Securityheader _currentuser;

Public MemberInfo ()
{

If you are using a design component, uncomment the line
InitializeComponent ();
}

private bool ValidateUser (string user, String pass)
{
Boolean Reval=false;

Edboperator oo = new Edboperator ();
Try
{
String sql = "Select Count ([ID]) from Webservice_user Where [name]= ' {0} ' and pass= ' {1} ' and [Status] = 1";
user = Tools.filtersql (user. Trim ());
pass = Tools.filtersql (pass. Trim ());
sql = String.Format (SQL, user, pass);
Int32 Count = Convert.ToInt32 (oo. Dboperator.execscalar (SQL));
if (Count > 0)
{
ReVal = true;
}
}
Finally
{
Oo. Dispose ();
}

return reVal;
}

///
Returns the series name according to the series code
///
/// Series Code
/// Series name
[WebMethod (Description = "Enter a new user login name to determine if 0 is unregistered, not 0 is registered or error"), SoapHeader ("CurrentUser")]
Public Int32 validuserloginname (String userloginname)
{
if (! ValidateUser (Currentuser.username, Currentuser.userpass)) {throw new Exception ("Error");}

Int32 reVal = 1;

Edboperator oo = new Edboperator ();
Try
{
String SQL;
sql = "Select Count ([ID]) from Yy_user Where [UserName] = '" + userloginname + "'";
ReVal = Convert.ToInt32 (oo. Dboperator.execscalar (SQL));
}
Finally
{
Oo. Dispose ();
}

return reVal;
}

}
Customizing the SOAP Header Class
public class SecurityHeader:System.Web.Services.Protocols.SoapHeader
{
Public String UserName;
Public String Userpass;
}

------Solution--------------------
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.