首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >正在分析WSDL:无法绑定到服务

正在分析WSDL:无法绑定到服务
EN

Stack Overflow用户
提问于 2013-06-11 04:10:32
回答 1查看 5.5K关注 0票数 2

目前,我正在尝试与一个基于SOAP的相机系统接口,以绑定到它的action API中,这样我就可以通过编程来控制它的灯何时打开等等。然而,当我使用下面的代码时,它说它不能绑定到服务,并且似乎不能正确地消化与API关联的WSDL文件,该文件可以在这里找到:

http://www.axis.com/vapix/ws/action1/ActionService.wsdl

是我的代码有问题,还是WSDL文件本身有问题?非常感谢您的帮助!在此之前,在构造函数中实例化SoapClient对象时生成的错误生成如下:

SOAP-错误:正在分析WSDL:无法绑定到服务

代码语言:javascript
复制
<?php
/**
 * The purpose of this class is to act as a means to interface with a Vapix camera
 * using SOAP requests so that events may be broadcast to it.
 */

$vapix = new Vapix("http://www.axis.com/vapix/ws/action1/ActionService.wsdl",
                   "<http://camera.address.edu>",
                   "<username>", "<password>");
if ($vapix)
{
    echo "Connection to VAPIX successful!\n";
}
else
{
    echo "Connection to VAPIX unsuccessful!\n";
}

/**
 * The constructor takes in a WSDL address, the actual interfacing address of the
 * server we are connecting to, a username, and a password, and establishes the
 * SOAP client we need to interface with said address.
 *
 * @param   $wsdl       The WSDL specification for the service we are interacting with.
 * @param   $address    The actual server address we are interfacing with.
 * @param   $username   The username we need to access the server.
 * @param   $password   The password we need to access the server.
 *
 * @return              New Vapix object ready to interface with SOAP service.
 */
class Vapix
{
    // the soap client variable we will be using to store our Vapix connection
    private $soapClient;

    public function __construct($wsdl, $address, $username, $password)
    {
        try
        {
            $soapClient = new SoapClient($wsdl, array("soap_version" => SOAP_1_2));
        }
        catch (SoapFault $fault)
        {
            echo "Error instantiating SOAP object!\n";
            echo $fault->getMessage() . "\n";
        }

        // prepare SOAP headers
        $sh_param = array(
            "username" => $username,
            "password" => $password
        );

        $headers = new SoapHeader($address, "UserCredentials", $sh_param);


        // prepare SOAP client
        $soapClient->__setSoapHeaders(array($headers));
    }

    /**
     * This function is a generalized function used for calling a SOAP request to
     * whatever service or server we are linked up to (in this case a VAPIX camera)
     * so that other more specialized functions can derive from it. It will take in
     * the name of the function, as well as a list of parameters.
     *
     * @param   $funcName   The name of the function we want to call.
     * @param   $parameters The parameters for the function we want to call.
     *
     * @return  $info       Returns info from the call if successful, NULL otherwise.
     */
    public function callSoapFunction($funcName, $parameters)
    {
        try 
        { 
            $info = $soapClient->__call($funcName, array($parameters)); 
        } 
        catch (SoapFault $fault) 
        {   
            print( 
                "alert('Sorry, blah returned the following ERROR: " . $fault->faultcode . "-" .
                    $fault->faultstring.". We will now take you back to our home page.'); 
                window.location = 'main.php';"
            ); 

            return NULL;
        }

        if ($error == 0) 
        {        
            return $info;
        }
    }
}
?>
EN

回答 1

Stack Overflow用户

发布于 2013-06-11 23:43:04

至少所提供的wsdl--area在wsdl--area的末尾紧跟在<binding>块之后。但是这个缺失的<service>-block是必需的,因为它包含具体的服务特定信息(例如,它的webservice URL/端点在那里列出)。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17031977

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档