How does php call. net webservice? 100 sub-delivery

Source: Internet
Author: User
How does php call. net webservice ??? 100. how does one call. net webservice on php? Please kindly advise me. I wrote a program, but I always prompted an error: I didn't create an instance object. let's take a look at it. what's wrong? Client php program: & lt ;? Php & nbsp; require ('. php how to call. net webservice ??? 100 sub-delivery
How does php call. net webservice? Please kindly advise me. I wrote a program, but I always prompted an error: I didn't create an instance object. let's take a look at it. what's 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;
?>
Webservice program of server. net:
Using System;
Using System. Collections;
Using System. Web;
Using System. Web. Services;
Using System. Web. Services. Protocols;

Using com. Basic;

///
/// Summary of MemberInfo
///
[WebService (Namespace = "http://tempuri.org/")]
[WebServiceBinding (ConformsTo = WsiProfiles. BasicProfile1_1)]
// To allow ASP. net ajax to call this Web service from a script, cancel the comments to 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 use the designed component, uncomment the following 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;
}

///
/// Return the series name based on the series code
///
/// Code series
/// Series Name
[WebMethod (Description = "enter a new user login name to determine whether 0 has been registered; 0 has not been registered; non-0 has been 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;
}

}
// Customize the Soap Header Class
Public class SecurityHeader: System. Web. Services. Protocols. SoapHeader
{
Public String UserName;
Public String UserPass;
}

------ Solution --------------------

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.