dongxun8189 2014-07-15 10:32
浏览 107

WSDL- PHP SOAP HTTP请求

Despite being a PHP developer, I'm just now getting my first taste of web services. I was hoping to get a little help, as the book I am using is not much help. One of the companies we are doing business with gave me an WSDL XML document in the format in needs to be in (I'll post a link of it). Due to my inexperience in this particular subject, I'm not really sure what to do. I need to know how to implement the WebService interface between my system and their used car management system. Any help or direction would be so greatly appreciated, and please, don't just send a link to the php manual. I've obviously been there, as it is typically the go-to place for help. I have been reading about the curl which will help me to communicate and transfer http request. To access their system they have given me access and i have to use credentials :

The credentials are:

Group ID

Dealer Number:

User:

Password:

The WebService address is:

http://uvm-aw.bmwgroup.com/awonline/de/service2/SNWebService.php

And the WSDL is:

http://uvm-aw.bmwgroup.com/awonline/de/service2/SNWebService.php?wsdl

So my login request and response will look like this :

Login request :

<LoginRequest> 
<user> user </ user> 
<password> pass </ password> 
<corporate_group_id> 101 </ corporate_group_id> 
<dealer_number> 11111 </ dealer_number> 
<dms_id> 12345678 </ dms_id> 
</ Login Request>

The answer for success looks like

<LoginResponse> 
<token> uiih37 </ token> 
<login_id> 8487292 </ login_id> 
<status> 
<success> true </ success> 
<code> 0 </ code> 
<message/> 
<browserURL/> 
</ status> 
</ Login Response>

trying to retrive data from wsdl not working:

$reference = array(
    'Credentials' => array('UserName' => '', 'Password' => ''),
    'corporate_group_id => '101',
     'dealer_number' => '11111' , 
     'DMS-ID' => 'A13T2D19'
     );
$client = new SoapClient("http://uvm-aw.bmwgroup.com/awonline/de/service2/SNWebService.php?wsdl");
$result = $client->GetTuDetail($reference);

print_r($result);
  • 写回答

1条回答 默认 最新

  • dongzhizhai4070 2014-07-15 11:01
    关注

    Here is simple implementation example This will help you to start :)

    //path to wsdl file
    $wsdl = 'http://uvm-aw.bmwgroup.com/awonline/de/service2/SNWebService.php?wsdl';
    
    //this will help you to debug 
    $options = array('trace' => true);
    
    $client = new SoapClient($wsdl, $options);
    
    //Returns list of available SOAP functions described in the WSDL for the Web service. 
    print_r($client->__getFunctions());
    
    //some parameters to send
    $params = array();
    $response = $client->Login($params);
    
    echo("<pre>"); //to format it legibly on your screen
    
    echo 'RESPONSE <br />';
    print_r($response);
    
    echo 'REQUEST HEADERS <br />';
    var_dump($client->__getLastRequestHeaders()); //the headers of your last request
    
    echo 'REQUEST BODY <br />';
    var_dump($client->__getLastRequest()); //your last request
    
    echo 'RESPONSE HEADERS <br />';
    var_dump($client->__getLastResponseHeaders()); //response headers
    
    echo 'RESPONSE BODY <br />';
    var_dump($client->__getLastResponse()); //the response
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题