关于php soap认证的问题
时间:2011-08-29
来源:互联网
各位大牛们好,在下想请教一个问题,希望遇到此类问题的朋友给予指点,谢谢. 代码如下:
复制代码
但是运行后一直提示:An error occurred when verifying security for the message,也就是服务端认证错误。
以下是服务器端给我提供的一个完整流程
POST https://admin.jetpay-card.com/CreditAppV1.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.evo-jet.com/services/ICreditAppV1/AuthorizeCredit"
Host: admin.jetpay-card.com
Content-Length: 908
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2011-08-24T18:14:50.876Z</u:Created>
<u:Expires>2011-08-24T18:19:50.876Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-8e6ad18f-7888-4790-a21c-b69fae46b6b8-1">
<o:Username>put username here</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">put password here</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<AuthorizeCredit xmlns="http://www.evo-jet.com/services">
<vendorId>TestVend</vendorId>
<customerId>104900</customerId>
<authAmt>100</authAmt>
<currency>EUR</currency>
</AuthorizeCredit>
</s:Body>
</s:Envelope>
Server Response:
HTTP/1.1 200 OK
Content-Length: 749
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 24 Aug 2011 18:15:02 GMT
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2011-08-24T18:15:02.627Z</u:Created>
<u:Expires>2011-08-24T18:20:02.627Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body>
<AuthorizeCreditResponse xmlns="http://www.evo-jet.com/services">
<AuthorizeCreditResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AuthCode i:nil="true"/>
<AuthId>0</AuthId>
<AuthResult>InvalidCustomer</AuthResult>
</AuthorizeCreditResult>
</AuthorizeCreditResponse>
</s:Body>
</s:Envelope>[/code]
我想应该是我构造SOAPHeader时出问题了,这PHP中这部分代码没有帖出来,但不知如何跟据以上去构造它。
- $local_cert = "d:\webroot\soap\cert.pem";
-
- $ns = 'https://admin.jetpay-card.com/CreditAppV1.svc?wsdl';
-
- $client = new SoapClient($ns,
- array(
- 'local_cert' => $local_cert,
-
- )
- );
-
-
- $params = array(
- 'vendorId' => 'TestVend',
- 'customerId' => '104900',
- 'authAmt' =>'100',
- 'currency' => 'EUR'
- );
-
- $vem = $client->__soapCall('AuthorizeCredit',$params,null,$header);
-
- var_dump($vem);
但是运行后一直提示:An error occurred when verifying security for the message,也就是服务端认证错误。
以下是服务器端给我提供的一个完整流程
POST https://admin.jetpay-card.com/CreditAppV1.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.evo-jet.com/services/ICreditAppV1/AuthorizeCredit"
Host: admin.jetpay-card.com
Content-Length: 908
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2011-08-24T18:14:50.876Z</u:Created>
<u:Expires>2011-08-24T18:19:50.876Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-8e6ad18f-7888-4790-a21c-b69fae46b6b8-1">
<o:Username>put username here</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">put password here</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<AuthorizeCredit xmlns="http://www.evo-jet.com/services">
<vendorId>TestVend</vendorId>
<customerId>104900</customerId>
<authAmt>100</authAmt>
<currency>EUR</currency>
</AuthorizeCredit>
</s:Body>
</s:Envelope>
Server Response:
HTTP/1.1 200 OK
Content-Length: 749
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 24 Aug 2011 18:15:02 GMT
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2011-08-24T18:15:02.627Z</u:Created>
<u:Expires>2011-08-24T18:20:02.627Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body>
<AuthorizeCreditResponse xmlns="http://www.evo-jet.com/services">
<AuthorizeCreditResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AuthCode i:nil="true"/>
<AuthId>0</AuthId>
<AuthResult>InvalidCustomer</AuthResult>
</AuthorizeCreditResult>
</AuthorizeCreditResponse>
</s:Body>
</s:Envelope>[/code]
我想应该是我构造SOAPHeader时出问题了,这PHP中这部分代码没有帖出来,但不知如何跟据以上去构造它。
作者: yangmao726 发布时间: 2011-08-29
等啊。
作者: yangmao726 发布时间: 2011-08-29
等啊。
作者: yangmao726 发布时间: 2011-08-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28