Re: SOAP client connecting to .net webservice

[email protected] (Milo van der Linden)
Newsgroups php.soap
Message-ID <[email protected]>
Hello list!

It seems I got my soap webservice client up and running with header 
authentication. Thank you all for the support. It leaves me with one 
question:

Allthough the .net server doesn't have any problem with it, there is a 
mismatch in the namespace

my php request:
xmlns:ns1="http://www.itworks.nl/"

the definition with the .net server:
xmlns:itw="http://www.itworks.nl/"

I would like to know if it is possible to give the alias "itw" to the 
namespace so it is replacing the default ns1 notation. Is it possible?

<?php

error_reporting(E_ALL);
$ini = ini_set("soap.wsdl_cache_enabled","0");

//set up the service client using WSDL
echo "Connecting to server using WSDL\n";
$client = new 
SoapClient("http://10.0.0.56:81/wssoilution/wsSoilution.asmx?WSDL", 
array('trace' => 1));

//var_dump($client->__getFunctions());
//var_dump($client->__getTypes());

$x["Username"]="milo";
$x["PasswordHash"]="111";
$x["Database"]="?";

//$x = new SoapVar($x, SOAP_ENC_OBJECT, "AuthenticationHeader", 
"http://www.itworks.nl/");

$header=new SoapHeader('http://www.itworks.nl/','AuthenticationHeader',$x);
$client->__setSoapHeaders(array($header));
echo "SoapHeaders set sucessfully\n";

$params2 = array('yourName'=> 'T.Estuser');

try {
	//$result2 = $client->__soapCall('Hello',$params2, NULL,$header, 
$output_headers);
	$result = $client->Hello($params2);
	echo("REQUEST :\n" . $client->__getLastRequest() . "\n\n");
	echo("RESPONSE:\n" .$client->__getLastResponse() . "\n\n");

} catch (SoapFault $exception) {
  echo $client->__getLastRequest();
  echo $exception;

}

?>

Milo van der Linden schreef:
> Thanks all, this seems to work. However I am stuck with trying to get 
> authentication that is in the header now.
> 
> What I want to see very desperatly is the content of the SoapClient in 
> XML BEFORE it is sent, is this possible?
> 
> Ammarmar schreef:
>> Dnia 27-08-2007 o 21:32:21 Milo van der Linden <[email protected]> 
>> napisał(a):
>>
>>> $x=new SoapVar($x,SOAP_ENC_OBJECT);
>>> $y["AuthenticationHeader"]=$x;
>>> $y=new SoapVar($y,SOAP_ENC_OBJECT);
>>>
>>>
>>> I cannot figure out how to set the namespace parameters!
>>>
>>
>> You can specify the namespace (and type name) in SoapVar constructor, 
>> e.g:
>>
>> $x = new SoapVar($x, SOAP_ENC_OBJECT, "AuthenticationHeader", 
>> "http://www.itworks.nl/");
>>
>> see manual:
>>
>> http://php.net/manual/en/function.soap-soapvar-construct.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.