将SOAP请求从XML转换为PHP

I am getting desperate here, I am trying to convert an XML SOAP request which works in SoapUI to PHP. I went through so much documentation online and still cannot get to creating a correct request from within PHP. I tried using the SOAP class provided in PHP together SoapVars, SoapParams and SoapHeaders. This is the request I need to send (in XML form):

<soapenv:Envelope 
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' 
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/03/addressing' 
xmlns:gen='http://www.polaris-uk.co.uk/GenericSchema/1_1/GenericTypes' 
xmlns:Detail='http://www.polaris-uk.co.uk/GenericSchema/2/PEMFault' 
xsi:SchemaLocation='http://www.polaris-uk.co.uk/GenericSchema/2/PEMFault http://ppw.imarket.co.uk/Polaris/Schema/PEMFault.xsd'>
<soapenv:Header>
  <wsse:Security 
  xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis- 200401-wss-wssecurity-secext-1.0.xsd" 
  soapenv:mustUnderstand="1" 
  soapenv:actor="http://www.imarket.co.uk/soap/actor">
    <wsse:UsernameToken>
      <wsse:Username>XXXXXXXXXX</wsse:Username>
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-ns2curity-secext-1.0.xsd#PasswordText">XXXXXXXXXX</wsse:Password>
    </wsse:UsernameToken>
  </wsse:Security>
</soapenv:Header>

<soapenv:Body>
  <ConfirmImarketUserIDReq xmlns="http://www.polaris-uk.co.uk/Schema/1_1/ConfirmImarketUserIDReq"> 
    <ns1:UserID xmlns:ns1="http://www.polaris-uk.co.uk/GenericSchema/1_1/GenericTypes">XXXXXXXXXX</ns1:UserID> 
    <ns2:Password xmlns:ns2="http://www.polaris-uk.co.uk/GenericSchema/1_1/GenericTypes">XXXXXXXXXX</ns2:Password> 
  </ConfirmImarketUserIDReq>
</soapenv:Body>
</soapenv:Envelope>

I will not post any code I did until now because it is just a mess since I tried writing bits and pieces without actually putting them together at one point and it will just spam this whole post.

Please, if anyone could help with converting this into a PHP code it will be much appreciated.

Thank you in advance!

After headaches over this, I finally found a working solution, might not be the best but it works by providing Raw XML to the SOAP call:

$wsdl   = "XXXX.wsdl"; 
$client = new SoapClient($wsdl, array(  'soap_version' => SOAP_1_1,'trace' => true,)); 

//=========== Header Settings ============\\

//Namespace of the Web Service
$namespace = 'http://schemas.xmlsoap.org/soap/envelope/'; 

$headerXML = <<<XML
<wsse:Security 
  xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
  SOAP-ENV:mustUnderstand="1" SOAP-ENV:actor="http://www.imarket.co.uk/soap/actor">
    <wsse:UsernameToken>
      <wsse:Username>XXXXXX</wsse:Username>
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-ns2curity-secext-1.0.xsd#PasswordText">XXXXXX</wsse:Password>
    </wsse:UsernameToken>
</wsse:Security>
XML;

$headerObj = new SoapVar($headerXML, XSD_ANYXML, null, null, null);
$header = new SoapHeader($namespace , 'SessionHeader', $headerObj);

// More than one header can be provided in this array.
$client->__setSoapHeaders(array($header));

//============== Request ================\\

$xml = <<<XML
  <ConfirmImarketUserIDReq xmlns="http://www.polaris-uk.co.uk/Schema/1_1/ConfirmImarketUserIDReq"> 
    <ns1:UserID xmlns:ns1="http://www.polaris-uk.co.uk/GenericSchema/1_1/GenericTypes">XXXXXX</ns1:UserID> 
    <ns2:Password xmlns:ns2="http://www.polaris-uk.co.uk/GenericSchema/1_1/GenericTypes">XXXXXX</ns2:Password> 
  </ConfirmImarketUserIDReq>
XML;

$args = array(new SoapVar($xml, XSD_ANYXML));

try {

    $response = $client->__soapCall( 'ConfirmImarketUserIDOp', $args);
    var_dump($response);
}
catch (SoapFault $e) {
  trigger_error("SOAP Fault: (faultcode: {$e->faultcode}, faultstring: {$e->faultstring})", E_USER_ERROR);
}

Hope this helps anyone, Cheers!