remove namespace from xml
am 02.12.2009 19:12:57 von Augusto Flavio
Hi all,
i'm trying to connect to a SOAP Server but i'm having a problem. Look
the xml that i need send to the server:
// THIS IS THE XML CORRECT THAT NEED BE SENT TO THE SERVER
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
XXXXX
XXXXXX
40010
30840300
30840280
10
1
20
5
10
>0
S
300
S
And now the xml that i'm sending to the SOAP Server.
//THIS IS THE XML THAT THE PHP IS SENDING
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://tempuri.org/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/enco ding/">
// HOW CAN I REMOVE THIS NAMESPACE? ns1:
XXXXX
XXXXXX
40096
30840280
30840300
10
1
5
10
0
300
N
300
N
How can i remove the ns1 from the Child CalcPrecoPrazo?
Some idea?
//here is the php code:
$client = new SoapClient(null, array('location' => $url,
'uri' =>
"http://tempuri.org/CalcPrecoPrazo",
'trace' => 1 ));
$results = $client->CalcPrecoPrazo($empresaCod, $empresaSenha,
$codigoFrete, $cepOrigem, $cepDestino, $peso,
(int)$formatoCd, (int)$comprimento, (int)$altura, (int)$largura,
(int)$VlDiametro,
$codMaoPropria, (float)$valor, $codAvisoRecebimento);
thanks
Augusto Morais
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: remove namespace from xml
am 03.12.2009 10:06:30 von Frank Arensmeier
2 dec 2009 kl. 19.12 skrev Augusto Flavio:
> Hi all,
>
>
> i'm trying to connect to a SOAP Server but i'm having a problem. Look
> the xml that i need send to the server:
>
> // THIS IS THE XML CORRECT THAT NEED BE SENT TO THE SERVER
>
>
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>
>
> XXXXX
> XXXXXX
> 40010
> 30840300
> 30840280
> 10
> 1
> 20
> 5
> 10
> >0
> S
> 300
> S
>
>
>
>
>
> And now the xml that i'm sending to the SOAP Server.
>
>
> //THIS IS THE XML THAT THE PHP IS SENDING
>
>
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ns1="http://tempuri.org/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/enco ding/">
>
> // HOW CAN I REMOVE THIS NAMESPACE? ns1:
> XXXXX
> XXXXXX
> 40096
> 30840280
> 30840300
> 10
> 1
> 5
> 10
> 0
> 300
> N
> 300
> N
>
>
>
>
>
> How can i remove the ns1 from the Child CalcPrecoPrazo?
>
> Some idea?
>
>
>
> //here is the php code:
>
> $client = new SoapClient(null, array('location' => $url,
> 'uri' =>
> "http://tempuri.org/CalcPrecoPrazo",
> 'trace' => 1 ));
>
> $results = $client->CalcPrecoPrazo($empresaCod, $empresaSenha,
> $codigoFrete, $cepOrigem, $cepDestino, $peso,
> (int)$formatoCd, (int)$comprimento, (int)$altura, (int)$largura,
> (int)$VlDiametro,
> $codMaoPropria, (float)$valor,
> $codAvisoRecebimento);
>
>
> thanks
>
>
>
>
> Augusto Morais
>
Although I never worked with SOAP so far, at least when it comes to
XML namespaces, you need to explicitly set those somewhere in your
code before use (which you haven't). Have you asked Google or even
looked at the MAN pages? After two minutes of googling, I found this.
From the SOAP man page:
[...]
nico
25-Aug-2006 01:20
If you want to build a Soap Server for Microsoft Office's client (like
Microsoft Office Research Service) you need to rewrite SOAP's
namespaces :
// (...)
$server = new SoapServer($wsdl, array('uri' => $uri, 'classmap' =>
$classmap));
$server->setClass($class);
function callback($buffer)
{
$s = array('', 'ns1:', 'xmlns:ns1="urn:Microsoft.Search
"');
$r = array('',
'', '');
return (str_replace($s, $r, $buffer));
}
ob_start('callback');
$server->handle();
ob_end_flush();
// (...)
?>
There are a complete example at this URL : http://touv.ouvaton.org/article.php3?id_article=104
[...]
I am sure there are other examples too.
/frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php