Page 1 of 1

Need Assistance Producing Soap Header Using PHP

Posted: Thu Jun 26, 2014 1:51 pm
by MICAHGUARDIAN
Can anyone show me how to produce and correctly format this soap/xml request using php?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="SPP.net/ContractData">
<soapenv:Header>
<con:AuthHeader>
<con:Username>SomeUserName</con:Username>
<con:Password>SomePassword</con:Password>
<con:contractID>123456</con:contractID>
<con:dealerCode>abcde</con:dealerCode>
</con:AuthHeader>
</soapenv:Header>
<soapenv:Body>
<con:Logon/>
</soapenv:Body>
</soapenv:Envelope>


The WSDL is: https://gmwstest.sppinc.net/VPP/Contrac ... .asmx?wsdl

Re: Need Assistance Producing Soap Header Using PHP

Posted: Mon Jun 30, 2014 6:27 pm
by techkid
Try this:

Code: Select all

<?php

$wsdl = 'https://gmwstest.sppinc.net/VPP/ContractExchange.asmx?wsdl';
$name_space = 'SPP.net/ContractData';

$client = new SoapClient($wsdl);

$auth = array(
	'Username' => 'SomeUserName',
	'Password' => 'SomePassword',
	'contractID' => '123456',
	'dealerCode' => 'abcde'
);

$header = new SoapHeader($name_space, 'AuthHeader', $auth, false);
$client->__setSoapHeaders($header);