Jump to content
Fórum Script Brasil
  • 0

Consumindo web Server


Rafael P.C

Question

Pessoal estou tendo dificuldades para consumir um Web Server.

Sendo mais especifico o problema esta na comunicação entre meu script e o serviço a mesma tem que ser feita em SOAP 1.2 mais não estou conseguindo alterar isto no PHP estou utilizando PHP 5.3.10.

<?php
   
$url_wsdl    ='http://localhost/Service.svc?wsdl';

$option     = array(
                    'soap_version'    => 'SOAP_1_2',
                    'encoding'          => 'utf-8',
                    'exceptions'        => false,
                    'trace'                => true,
                    'cache_wsdl'       => 'WSDL_CACHE_NONE'                
                    );

$soapClient     = new SoapClient($url_wsdl, $option);

$Credentials = array( 
                'Username'           =>        'admin', 
                'Password'            =>        'admin',
                'passwordType'     =>         'basic'
            ); 

$headers = new SoapHeader('http://localhost/Service.svc?wsdl', 'UserCredentials', $Credentials);

// Prepare Soap Client
$soapClient->__setSoapHeaders(array($headers));

var_dump($soapClient->teste());

?>

A mensagem de retorno é esta: Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.

Nas minhas pesquisas identifiquei que a versão do SOAP 1.1 utiliza Content-Type: text/XML e o SOAP 1.2 Content-Type: application/soap+XML. Até tentei utilizar o NUSOAP mais o mesmo não da suporte para SOAP 1.2.

Alguém sabe como resolver este problema?

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...