这个WSDL定义了什么风格的SOAP,以及如何使用PHP使用它?
我们有一个PHP应用程序需要连接到此SOAP web服务以下是WSDL: 供应商声称它使用了“WS-Security(wsHttpBinding)”。这对我来说意义不大,因为除了“正常的”未经验证的SOAP之外,我没有其他经验。此外,我知道可能有几种实现WS-Security的方法,而供应商还没有提供完整的规范 到目前为止,由于中提供的WSSoap类,我已经能够成功地连接、验证和运行这个WSDL定义了什么风格的SOAP,以及如何使用PHP使用它?,php,soap,wsdl,ws-security,Php,Soap,Wsdl,Ws Security,我们有一个PHP应用程序需要连接到此SOAP web服务以下是WSDL: 供应商声称它使用了“WS-Security(wsHttpBinding)”。这对我来说意义不大,因为除了“正常的”未经验证的SOAP之外,我没有其他经验。此外,我知道可能有几种实现WS-Security的方法,而供应商还没有提供完整的规范 到目前为止,由于中提供的WSSoap类,我已经能够成功地连接、验证和运行GetAllRequests方法。但是,我在尝试运行GetRequestDetail方法时遇到了问题,因为我不知道
GetAllRequests
方法。但是,我在尝试运行GetRequestDetail
方法时遇到了问题,因为我不知道要使用哪种参数参数。供应商提供了以下.NET代码片段作为示例:
DriveAwayClient client = new DriveAwayClient();
client.ClientCredentials.UserName.UserName = "…";
client.ClientCredentials.UserName.Password = "…";
ARIRqst rqst = new ARIRqst();
rqst.RqstType = "ORDER";
rqst.OrderID = "12345";
string RequestDetail;
RequestDetail = client.GetRequestDetail(rqst);
这段代码不能用PHP重写(至少使用WSSoap类),因为我无法使用WSSoap注入ARIRqst
对象。此外,我不知道如何实例化ARIRqst
对象,因为我无法访问PHP中的ARIRqst()
类
我想,如果我更多地了解这个web服务的具体需求,如WSDL所定义的,它的具体类型是什么,以及使用的身份验证是什么,我会更幸运地在PHP中找到一个可以使用它的示例,或者至少找到规范,以便我可以编写自己的实现
更新:具体来说,我最终只需要知道如何格式化此web服务的GetRequestDetail
方法的请求。以下是我要发送的内容:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://tempuri.org/">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/IDriveAway/GetRequestDetail</a:Action>
<a:MessageID>urn:uuid:eacedde2-cec5-4da1-afbf-822fe2e92793</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://arixss.arifleet.com/QA/DriveAwayWS/DriveAwaySrvc.svc?wsdl</a:To>
<o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
<u:Timestamp u:Id="_0">
<u:Created>2014-04-08T23:20:00Z</u:Created>
<u:Expires>2014-04-08T23:25:00Z</u:Expires>
</u:Timestamp>
<c:SecurityContextToken xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc" u:Id="uuid-85c09ef0-83e1-417c-b9c7-5892798ee739-197">
<c:Identifier>urn:uuid:24d56285-84f1-4c74-8093-5f72090ab92f</c:Identifier>
</c:SecurityContextToken>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1"/>
<Reference URI="#_0">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>[REDACTED]</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>[REDACTED]</SignatureValue>
<KeyInfo>
<o:SecurityTokenReference>
<o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" URI="#uuid-85c09ef0-83e1-417c-b9c7-5892798ee739-197"/>
</o:SecurityTokenReference>
</KeyInfo>
</Signature>
</o:Security>
</s:Header>
<s:Body>
<ns1:GetRequestDetail xsi:type="ns1:ARIRqst">
<RqstType>ORDER</RqstType>
<RqstID>1234</RqstID>
<OrderID>1234-1</OrderID>
<QuoteID>1</QuoteID>
</ns1:GetRequestDetail>
</s:Body>
</s:Envelope>
来自php.net
只需将wsdl插入到SoapClient调用中…它应该返回所有方法和参数
您也可以将其包装在try-catch块中Ugh。。。我同情你。SOAP是我唯一痛惜的API机制。谢谢,我感觉好多了。你必须善于与女士相处,体谅他人,而不仅仅是试图解决问题我是同性恋,所以。。。更相关的是,SOAP可以修复吗?我只是想对你的痛苦表示感谢,伙计,没什么。是的,这会显示所有的方法和参数。我有那些。我需要的是了解WS-Security实现的详细信息:使用什么类型的身份验证?是否正在使用PKI密钥和证书?请求是否需要签名?加密的?内置PHP SoapClient不支持WS-Security,也没有太多文档或第三方工具可用于将WS-Security与PHP一起使用。
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault</a:Action>
<a:RelatesTo>urn:uuid:c0af2ed0-9afb-4c77-a09f-2463bf5cbc52</a:RelatesTo>
<o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
<u:Timestamp u:Id="_0">
<u:Created>2014-04-08T23:20:26.872Z</u:Created>
<u:Expires>2014-04-08T23:25:26.872Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Receiver</s:Value>
<s:Subcode>
<s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">Object reference not set to an instance of an object.</s:Text>
</s:Reason>
<s:Detail>
<ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<HelpLink i:nil="true"/>
<InnerException i:nil="true"/>
<Message>Object reference not set to an instance of an object.</Message>
<StackTrace> at ARI.DriveAwayMgr.DriveAwaySrvc.GetRequestDetail(ARIRqst rqst) in d:\[REDACTED]\DriveAwaySrvc.svc.cs:line 189
at SyncInvokeGetRequestDetail(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
<Type>System.NullReferenceException</Type>
</ExceptionDetail>
</s:Detail>
</s:Fault>
</s:Body>
</s:Envelope>
<?php
$client = new SoapClient('http://soap.amazon.com/schemas3/AmazonWebServices.wsdl');
var_dump($client->__getFunctions());
?>