Web service with .net and nusoap

I use nusoap to connect to the .net service, but I get the error message "Note: Undefined variable: HEADER in C: \ xampplite \ htdocs \ newsoap \ searchwwcc.php on line 54

Fatal error: throw SoapFault exception: function [Client] ("serializeEnvelope") is not a valid method for this service in C: \ xampplite \ htdocs \ newsoap \ searchwwcc.php: 54 Stack trace: # 0 [internal function]: SoapClient → __ call ('serializeEnvelo ...', Array) # 1 C: \ xampplite \ htdocs \ newsoap \ searchwwcc.php (54): SoapClient-> serializeEnvelope ('

Here is the link code I'm using


require_once('lib/nusoap.php');


$serverpath ='https://service.website.net/ws/bridge.asmx?wsdl';

$SOAPClient =  new soapclient($serverpath);


$SOAPACTION  = "http://connect2.askadmissions.net/webservices/GetContact";
$BODY='<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetContact xmlns="http://service.website.net/webservices/">
        <ClientName>clientname</ClientName>
        <PassKey>*******</PassKey>
        <SearchCriteriaXml>
            <![CDATA[
                <attributes>
                    <attribute>
                        <name>email</name>
                        <value>name@name.com</value>
                        <operator>equals</operator>
                    </attribute>
                </attributes>
            ]]>
        </SearchCriteriaXml>
        <AttributesXml>
            <![CDATA[
                <attributes>
                    <attribute>
                        <name>firstname</name>
                    </attribute>
                    <attribute>
                        <name>lastname</name>
                    </attribute>
                </attributes>
            ]]>
        </AttributesXml>
    </GetContact>
  </soap:Body>
</soap:Envelope>';


 $SOAPMESSAGE =  $SOAPClient->serializeEnvelope($BODY,$HEADER,array(),'document', 'literal');
 $RESULT = $SOAPClient->send($BODY, $SOAPACTION);


echo  $SOAPClient->response;
+3
source share
1 answer

I found out what is wrong:

i change line:

$SOAPClient =  new soapclient($serverpath);

to

$SOAPClient =  new nusoap_client($serverpath);

, . , .

-:

$soapError = $SOAPClient->getError();
if (! empty($soapError)) {
    $errorMessage = 'SOAPClient failed: ' . $soapError;
    throw new Exception($errorMessage);
}

:

Notice: Undefined property: nusoap_client::$operation in C:\xampplite\htdocs\newsoap\lib\nusoap.php on line 7674

nusoap.php :

if(empty($this->operation)) {
   $this->operation = "";
}
+3

Source: https://habr.com/ru/post/1792896/


All Articles