What flavor of SOAP is defined by this WSDL, and how to consume it with PHP? -
we have php application needs connect soap web service—here's wsdl: https://arixss.arifleet.com/qa/driveawayws/driveawaysrvc.svc?wsdl
the vendor claims uses "ws-security (wshttpbinding)". doesn't mean me, don't have experience beyond "normal" unauthenticated soap. furthermore, understand there several ways implement ws-security, , vendor hasn't provided full specification.
so far, wssoap class given in this answer, have been able connect, authenticate, , run getallrequests
method successfully. however, i'm stuck when trying run getrequestdetail
method, because don't know kind of parameter argument use. vendor offers snippet of .net code example:
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);
this code can't rewritten in php (at least using wssoap class) because have no way of injecting arirqst
object using wssoap. furthermore, wouldn't know how instantiate arirqst
object, because don't have access arirqst()
class in php.
i thought if knew more specific requirements of web service, defined wsdl—what specific type is, , authentication used—i have better luck finding example in php can consume it, or @ least find specifications write own implementation.
update: specific, need know how format request web service's getrequestdetail
method. here's i'm sending:
<?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>
and here response server, containing internalservicefault
of "object reference not set instance of object" (which assume means i'm not encoding arirqst
object correctly in request):
<?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 instance of 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 instance of object.</message> <stacktrace> @ ari.driveawaymgr.driveawaysrvc.getrequestdetail(arirqst rqst) in d:\[redacted]\driveawaysrvc.svc.cs:line 189
 @ syncinvokegetrequestdetail(object , object[] , object[] )
 @ system.servicemodel.dispatcher.syncmethodinvoker.invoke(object instance, object[] inputs, object[]& outputs)
 @ system.servicemodel.dispatcher.dispatchoperationruntime.invokebegin(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage5(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage41(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage4(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage31(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage3(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage2(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage11(messagerpc& rpc)
 @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage1(messagerpc& rpc)
 @ 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()); ?>
from php.net.
just insert wsdl soapclient call...it should return methods , parameters...
you can wrap in try catch block also
Comments
Post a Comment