PHP SOAP web服务调用

PHP SOAP web服务调用,php,soap,soap-client,nusoap,Php,Soap,Soap Client,Nusoap,首先,我要说我以前从未用过肥皂 无论如何,这是我试图创建的代码 <soapenv:Body> <Circuits xmlns="http://www.qpricer.com/Services/Pricing"> <Circuit bandwidth="DS-3" port-billing-type="Flat" product="Dedicated Voice" term="1-Year"> <ns1:Loop npanxx="212255" xm

首先,我要说我以前从未用过肥皂

无论如何,这是我试图创建的代码

<soapenv:Body> 
<Circuits xmlns="http://www.qpricer.com/Services/Pricing"> 
<Circuit bandwidth="DS-3" port-billing-type="Flat" product="Dedicated Voice" term="1-Year"> 
<ns1:Loop npanxx="212255" xmlns:ns1="http://www.qpricer.com/Schema/Pricing"> 
<ns1:Address city="MANHATTAN" postal-code="10011" state="NY" street="111 8 AV FLR 1"/> 
</ns1:Loop> 
</Circuit> 
</Circuits> 
</soapenv:Body>
这是否有效:

$result = $client->Price('Circuits',
    array(
    'Circuit'           =>  array(
        '_'                 => array(
            'Loop'              =>  array(
                '_' => '',
                'npanxx'            =>  '212255'
            ),
            'Address'           =>  array(
                '_' => '',
                'street'            =>  '111 8 AV FLR 1',
                'city'              =>  'MANHATTAN',
                'state'             =>  'NY',
               'postal-code'       =>  '10011'
            ) 
         ),
        'product'           =>  'Dedicated Voice',
        'port-billing-type' => 'flat',
        'term'              =>  '1-Year',
        'bandwidth'         =>  'DS-3'
        )
    ));

似乎没有记录,但可以使用。如果不起作用,请尝试在上的注释。

不幸的是,没有。仍然是相同的错误。“致命错误:未捕获的SoapFault异常:[soap:Client]QPricer.API.Common.Model.ApiException:在定价请求中未检测到任何回路。请检查您的XML名称空间,也许可以?在C:\wamp\www\soap.php:79堆栈跟踪:#0[内部函数]:SoapClient->u调用('Price',Array)#1 C:\wamp\www\soap.php(79):SoapClient->Price('Circuits',Array)#2{main}在C:\wamp\www\soap.php的第79行抛出“啊,那么它可能只适用于simpleType。您是否尝试了我最后链接的soapvar示例(查看注释)?生成的请求体是什么?我尝试了第二个示例。它返回了这个。“SOAP错误:QPricer.API.Common.Model.ApiException:在定价请求中未检测到电路。请检查您的XML名称空间,也许可以?在QPricer.API.QPricer.Price(电路)
我的令牌在这里:)“看起来它并没有发送xml文档的其余部分。嗯,在进一步研究这个问题之后,我几乎可以让它工作了。我的标题显然是错的。这就是他们需要的。" "
$result = $client->Price('Circuits',
    array(
    'Circuit'           =>  array(
        '_'                 => array(
            'Loop'              =>  array(
                '_' => '',
                'npanxx'            =>  '212255'
            ),
            'Address'           =>  array(
                '_' => '',
                'street'            =>  '111 8 AV FLR 1',
                'city'              =>  'MANHATTAN',
                'state'             =>  'NY',
               'postal-code'       =>  '10011'
            ) 
         ),
        'product'           =>  'Dedicated Voice',
        'port-billing-type' => 'flat',
        'term'              =>  '1-Year',
        'bandwidth'         =>  'DS-3'
        )
    ));