PHP soap xml vs SoapUI xml -
i have working soap ui xml, , have soap request xml , identical. soap ui works, mine gets null response. here's soapui xml first
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://www.cornerstoneondemand.com/webservices/getdetailswebservice"> <soapenv:header> <get:authheader> <get:corpname>corp</get:corpname> <get:userid>1234</get:userid> <get:signature>abc123</get:signature> </get:authheader> </soapenv:header> <soapenv:body> <get:getdetails xmlns:get="http://www.cornerstoneondemand.com/webservices/getdetailswebservice"> <get:object_id>qwerty-123</get:object_id> </get:getdetails> </soapenv:body> </soapenv:envelope>
and here php code , request.
$client=new soapclient($wsdl,array('trace' => 1, 'exception' => 0)); $auth = array( 'corpname' => $corpname, 'userid' => $username, 'signature' => $signature ); $header = new soapheader('http://www.cornerstoneondemand.com/webservices/getdetailswebservice','authheader',$auth,false); $client->__setsoapheaders($header); $parm[] = new soapvar($loid, xsd_string, null, null, 'object_id' ); var_dump($client->getdetails( new soapvar($parm, soap_enc_object) )); //output null
//and php request:
print_r($client->__getlastrequest()); output is
<?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.cornerstoneondemand.com/webservices/getdetailswebservice"> <soap-env:header> <ns1:authheader> <ns1:corpname>corp</ns1:corpname> <ns1:userid>1234</ns1:userid> <ns1:signature>abc123</ns1:signature> </ns1:authheader> </soap-env:header> <soap-env:body> <ns1:getdetails> <object_id>qwerty-123</object_id> </ns1:getdetails> </soap-env:body> </soap-env:envelope>
i can't tell if i'm close creating request, or miles off. i'm working make php request match soapui's since works , mine doesn't.
the contain same information. namespace prefixes element nodes exchangeable , optional. these 3 variants resolved , element node local name envelope
in namespace http://schemas.xmlsoap.org/soap/envelope/
.
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"/>
<envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"/>
you can read element name {http://schemas.xmlsoap.org/soap/envelope/}:envelope
.
the same goes get
vs ns1
namespaces prefixes. both resolve same actual namespace.
but element object_id
has no namespace in xml. sixth argument of soapvar
constructor node namespace might want try:
$namespace = 'http://www.cornerstoneondemand.com/webservices/getdetailswebservice'; $parm[] = new soapvar($loid, xsd_string, null, null, 'object_id', $namespace);
Comments
Post a Comment