Я взял ваш php-пример для тестирования:
Код | // load SOAP library require_once("/usr/local/php/lib/nusoap-0.9.5/lib/nusoap.php"); function service_server() { $wsdl->soap_def_encoding = "UTF-8"; // set namespace $ns="";//"http://hqmskcontrol/wsdl/"; // create SOAP server object $server = new soap_server(); $wsdl->soap_defencoding = "UTF-8"; // setup WSDL file, a WSDL file can contain multiple services $server->configureWSDL('Calculator',$ns); $server->wsdl->schemaTargetNamespace=$ns; // register a web service method $server->register('ws_add', array('int1' => 'xsd:int','int2' => 'xsd:int'), // input parameters array('total' => 'xsd:int'), // output parameter $ns, // namespace "$ns#ws_add", // soapaction 'rpc', // style 'encoded', // use 'adds two integer values and returns the result' // documentation ); function ws_add($int1, $int2){ return $int1 + $int2; //return new soapval('return','xsd:integer', $int1 + $int2); } // service the methods $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service( utf8_encode($HTTP_RAW_POST_DATA) ); }
|
web-сервис прекрасно работает...
Создаю ссылку на службу - тоже все прекрасно, но вот след. код:
Код | phpcalc.CalculatorPortTypeClient client = new phpcalc.CalculatorPortTypeClient(); int res = 0; try { res = client.ws_add(2, 2); } // вызывается при ошибке связи в службе или клиентском приложении catch (System.ServiceModel.CommunicationException e) { Console.WriteLine(e.Message); Console.WriteLine(e.InnerException); //Console.WriteLine(e.StackTrace); } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine(res);
|
выдает исключение:
Код | Сервер вернул недопустимое сообщение об ошибке SOAP. Дополнительные сведения см. в описании внутреннего исключения.
System.Xml.XmlException: Элемент "faultstring" с пространством имен "" не найден . Строка 6, позиция 126. в System.Xml.XmlReader.CheckElement(String localName, String namespaceURI) в System.Xml.XmlReader.ReadElementContentAsString(String localName, String na mespaceURI) в System.ServiceModel.Channels.ReceivedFault.CreateFault11(XmlDictionaryReade r reader, Int32 maxBufferSize) в System.ServiceModel.Channels.MessageFault.CreateFault(Message message, Int3 2 maxBufferSize) 0
|
подскажите, как исправить? |