[請益] SOAP金流串接

看板PHP作者 (basistravel)時間9年前 (2014/12/05 09:50), 編輯推噓0(004)
留言4則, 1人參與, 最新討論串1/1
web service 需求 ---------------------------------------------------------------------------------------------------------- <tran:getTokenIdRequest xmlns:tran="" rel="nofollow">http://www.pockii.chinatrust.com.tw/api/trans"> <tran:apiRqHeader> <api:apiUserId xmlns:api="leannwu19780413" rel="nofollow">http://www.pockii.chinatrust.com.tw/api">leannwu19780413</api:apiUserId> <api:apiUserPwd xmlns:api="1qaz2wsx3edc4rfv5tgb" rel="nofollow">http://www.pockii.chinatrust.com.tw/api">1qaz2wsx3edc4rfv5tgb</api:apiUserPwd> <api:encryption xmlns:api="N" rel="nofollow">http://www.pockii.chinatrust.com.tw/api">N</api:encryption> <api:requestTime xmlns:api="2013-08-08T18:42:52.666+08:00" rel="nofollow">http://www.pockii.chinatrust.com.tw/api">2013-08-08T18:42:52.666+08:00</api:requestTime> </tran:apiRqHeader> <tran:apiRqBody> <tran:apiUserId>leannwu19780413</tran:apiUserId> <tran:apiUserPassword>1qaz2wsx3edc4rfv5tgb</tran:apiUserPassword> </tran:apiRqBody> </tran:getTokenIdRequest> code ----------------------------------------------------------------------------------------------------------- <?php $t = microtime(true); $micro = sprintf("%06d",($t - floor($t)) * 1000000); $d = new DateTime( date('Y-m-d H:i:s.'.$micro,$t) ); $date = $d->format("Y-m-d\TH:i:s.uP"); $client = new SoapClient('https://www.pockii.com:9443/ctcb-olp-api-webservice/ws/sandbox/trans.wsdl'); $config = array( 'apiUserId' => 'test', 'apiUserPwd' => 'test', 'encryption' => 'N', 'requestTime' => $date ); $header = new SoapHeader('http://www.pockii.chinatrust.com.tw/api/trans', 'apiRqHeader',$config); $client->__setSoapHeaders($header); $param = array( 'apiUserId' => 'test', 'apiUserPassword' => 'test' ); $result = $client->__soapCall('getTokenId', $param); echo $result; ?> 出現以下錯誤 ---------------------------------------------------------------------------------------------------------------- Fatal error: Uncaught SoapFault exception: [ns0:Client] cvc-complex-type.2.4.b: The content of element 'ns1:getTokenIdRequest' is not complete. One of '{"http://www.pockii.chinatrust.com.tw/api/trans":apiRqHeader}' is expected. in C:\htdocs\pockii.php:42 Stack trace: #0 C:\htdocs\pockii.php(42): SoapClient->__soapCall('getTokenId', Array) #1 {main} thrown in C:\xampp\htdocs\b2c\pockii.php on line 42 錯誤好像是說參數不完整,請問是哪裡有問題?謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.250.214.51 ※ 文章網址: http://www.ptt.cc/bbs/PHP/M.1417744202.A.DAA.html

12/07 01:53, , 1F
中信第三方支付的文件是錯的,(尤其是xml範例的部分)
12/07 01:53, 1F

12/07 01:53, , 2F
建議你先裝chrome的wdsl的插件去解析正確的xml然後對co
12/07 01:53, 2F

12/07 01:53, , 3F
de做調整
12/07 01:53, 3F

12/07 11:36, , 4F
然後你的時間格是錯誤,他是ISO 8601 date
12/07 11:36, 4F
文章代碼(AID): #1KWGzAsg (PHP)