tutorial example ejemplos ejemplo descargar php web-services soap

php - example - Error fatal: excepción de SoapFault no capturada:



web service ejemplo (4)

Tengo problemas para llamar a un servicio web que he configurado desde PHP. La dirección ofuscada http://XXX.XXX.XXX.XXX/test.asmx?wsdl en el siguiente mensaje de error devuelve un WSDL válido. Intenté llamarlo como un servicio web con un cliente de VB.net, pero cuando lo llamo desde PHP en Debian recibo el siguiente mensaje:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn''t load from ''http://XXX.XXX.XXX.XXX/test.asmx?wsdl'' in /var/www/domain/mywebsite.com/public_html/catalog/fomeus/orders.php:101 Stack trace: #0 /var/www/domain/mywebsite.com/public_html/catalog/fomeus/orders.php(101): SoapClient->SoapClient(''http://XXX.XXX.XXX.XXX/'', Array) #1 {main} thrown in /var/www/domain/mywebsite.com/public_html/catalog/fomeus/orders.php on line 101

¿Cuál podría ser el problema? He incluido mi código para el servicio web y el cliente PHP a continuación.

Servicio web:

Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel ... '' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. '' <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem(False)> _ Public Class WebService1 Inherits System.Web.Services.WebService <WebMethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function End Class

Cliente de PHP:

require_once($_SERVER[''DOCUMENT_ROOT'']."/catalog/fomeus/includes/soap/nusoap.php"); $objClient = new soapclient("http://XXX.XXX.XXX.XXX/test.asmx?wsdl", array(''trace'' => 1, ''exception'' => 0, ''cache_wsdl'' => 0)); print_r($objClient -> HelloWorld());

Estoy usando la versión 5.2.6 de PHP si eso es de alguna ayuda. He estado revisando muchas publicaciones en diferentes foros tratando de descubrir cuál es el problema. Muchas personas han tenido el mismo problema, pero ninguna de las soluciones que he encontrado hasta ahora me funciona. Cualquier ayuda sería muy apreciada.


Agregar index.php funcionó para mí trabajando en la aplicación php

$client = new SoapClient(''http://www.domain.com/api/v2_soap/?wsdl''=1) $client = new SoapClient(''http://www.domain.com/index.php/api/v2_soap/?wsdl''=1)


Otra opción para mirar es cURL. Puede crear su carga útil como una cadena XML y enviarla a la misma URL usando cURL. Debería capturar el código de respuesta y procesarlo según corresponda. Cuando tuve problemas con SOAPClient, me mudé a cURL, funciona como un encanto.


Si está usando nusoap (php 5.2 tiene un soapclient nativo, que prefiero), lo primero que veo son sus argumentos. El argumento # 2 para el constructor soapclient de nusoap debe ser booleano TRUE aquí, si está utilizando WSDL, y no una matriz. Tratar:

$objClient = new soapclient("http://XXX.XXX.XXX.XXX/test.asmx?wsdl",true); print_r($objClient->HellowWorld());

Así es como he podido trabajar con wsdl en el pasado.

Si está utilizando el cliente nativo y tiene problemas con el wsdl, siempre puede omitirlo y realizar llamadas directas, de la siguiente manera:

$objClient = new soapclient(null,array(''uri''=>''http://xxx/test.asmx'',''location''=>''http://xxx/test.asm'')); $objClient->__call(''HelloWorld'',array());

Eso debería funcionar, pero no es tan fácil de navegar como wsdl.


intente activar php_soap.dll y php_openssl.dll en su php.ini. Situado en la carpeta apache / apache / apache2.4.2 / bin

eliminar el ";"