首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP SOAP web服务调用

PHP SOAP web服务调用
EN

Stack Overflow用户
提问于 2010-08-06 03:05:53
回答 1查看 789关注 0票数 0

我首先要说的是,我以前从未使用过SOAP。

不管怎样,这是我想要创建的代码。

代码语言:javascript
复制
<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>

标头已经就位。我可以给这个服务打个电话。

我有的是这个

代码语言:javascript
复制
//Make the call  
$result = $client->Price('Circuits',
        array(
        'Circuit'           =>  array(
        'product'           =>  'Dedicated Voice',
        'port-billing-type' => 'flat',
        'term'              =>  '1-Year',
        'bandwidth'         =>  'DS-3'
        ),

        'Loop'              =>  array(
        'npanxx'            =>  '212255'
        ),

        'Address'           =>  array(
        'street'            =>  '111 8 AV FLR 1',
        'city'              =>  'MANHATTAN',
        'state'             =>  'NY',
        'postal-code'       =>  '10011')
        ));

// Display the result  
print_r($client->__getLastRequest());  
print_r($result);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-08-06 03:33:14

这样做是可行的:

代码语言:javascript
复制
$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'
        )
    ));

'_'似乎没有文档记录,但却是可行的。如果不起作用,可以试试http://www.php.net/manual/en/soapvar.soapvar.php上的评论。

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

https://stackoverflow.com/questions/3418229

复制
相关文章

相似问题

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