dongsu3664 2011-02-17 19:44
浏览 43
已采纳

使用.net和nusoap的Web服务

I am using nusoap to connect to .net service, but i get error "Notice: Undefined variable: HEADER in C:\xampplite\htdocs ewsoap\searchwwcc.php on line 54

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

Here is reference code what i am 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;
  • 写回答

1条回答 默认 最新

  • doutuo8800 2011-02-18 19:00
    关注

    I found out what was wrong :

    i change line :

    $SOAPClient =  new soapclient($serverpath);
    

    to

    $SOAPClient =  new nusoap_client($serverpath);
    

    Which fixed error i was getting and it started giving me blank page. I found blank page was because curl was not installed.

    Used following code to echo error:

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

    After all started working i was getting warning :

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

    I went to nusoap.php and before that line i inserted :

    if(empty($this->operation)) {
       $this->operation = "";
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备