How to use SoapUI's xml in php -


i have soapui working xml, need consume data on server using php 5.3. think need convert $string array. $xml = (array)simplexml_load_string($string); isn't throwing errors, response call null.

$string =   ' <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tran="http://www.cornerstoneondemand.com/webservices/transcriptandtask">     <soapenv:header>         <wsse:security soapenv:mustunderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">             <wsse:usernametoken wsu:id="usernametoken-115e54b97689076253912">                 <wsse:username>me</wsse:username>                 <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passwordtext">word</wsse:password>                 <wsse:nonce encodingtype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#base64binary">dvhxlfil4aoi2kq==</wsse:nonce>                 <wsu:created>2016-10-19t15:26:02.539z</wsu:created>             </wsse:usernametoken>         </wsse:security>     </soapenv:header>     <soapenv:body>       <tran:gettranscriptandtasks>          <tran:request>             <request corpname="learning">                 <user id="me">                     <requesttypes>                         <inbox/>                         <transcript inprogressonly="false" pagenumber="1"/>                         <session pagenumber="1" upcomingonly="true"/>                         <assigned assignedonly="true"/>                         <approval approvaldaterequested="1967-08-13"/>                         <task pendingtasksonly="true"/>                         <suggestedtraining pagenumber="1"/>                     </requesttypes>                 </user>             </request>          </tran:request>       </tran:gettranscriptandtasks>     </soapenv:body> </soapenv:envelope> ';   $xml = (array)simplexml_load_string($string);  $soapclient = new soapclient($wsdl, array('trace' => 1));  $response = $soapclient->gettranscriptandtasks($xml); var_dump($response); 

any appreciated!

edit: found https://github.com/sapankumarmohanty/lamp/blob/master/crate-xml-2-array turns xml nice array. result still null... copied wsdl here http://www.markforsyth.com/transcriptandtaskservice.wsdl if helps.

you can use xml code soapui allmost direct.

here code fragments code of mine:

constructor class, servs interface web service. wsdl defined constant in class:

public function __construct($username, $password) {     $this->client = new soapclient(self::wsdl);     $this->client->__setsoapheaders(self::securityheader($username, $password)); } 

function in class return security header used in constructor:

private static function securityheader($username, $password) {     $nswsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";     $nswsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";     $nonce = 'xxxxx';      $xml = '<nswsse:security xmlns:nswsse="' . $nswsse . '" xmlns:nswsu="' . $nswsu . '">'         . '<nswsse:usernametoken>'         . '<nswsse:username>' . $username . '</nswsse:username>'         . '<nswsse:password>' . $password . '</nswsse:password>'         . '<nswsse:nonce>' . $nonce . '</nswsse:nonce>'         . '<nswsu:created>' . gmdate('y-m-d\th:i:s\z') . '</nswsu:created>'         . '</nswsse:usernametoken>'         . '</nswsse:security>';      $securitytoken = new soapvar($xml, xsd_anyxml);      return new soapheader($nswsse, 'security', $securitytoken); } 

a function in class, makes request ws-function "abc":

public function abc() {     $xml = ... paste xml code soapui here ...     $param = new soapvar($xml, xsd_anyxml);     return $this->client->abc($param); } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -