Re: SOAP client connecting to .net webservice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <milo@3dsite.nl> 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

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux