<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 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:Body> <TestResponse xmlns="namespace"> <TestResult xmlns=""> <Sukces>true</Sukces> <OpisBledu></OpisBledu> </TestResult> </TestResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
A potrzebuje, żeby zwróciła dokładnie coś takiego:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <TestResponse xmlns="namespace"> <TestResult> <Sukces>true</Sukces> <OpisBledu /> </TestResult> </TestResponse> </soap:Body> </soap:Envelope>
Dwie różnice, które wydaje mi się trzeby poprawić to:
Tego nie powinno być
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
A to powinno byc bez atrybutu xmlns=""
<TestResult xmlns="">
Mój kod to:
<?php require 'lib/nusoap.php'; $namespace = "namespace"; $server = new nusoap_server(); $server->debug_flag = false; $server->configureWSDL("nuSoapWSDL", $namespace); $server->wsdl->schemaTargetNamespace = $namespace; # TEST $server->wsdl->addComplexType( 'OdpowiedzTest', 'complexType', 'struct', 'all', '', ) ); $server->wsdl->addComplexType( 'TestResult', 'complexType', 'struct', 'all', '', ) ); $server->register('Test', // method name array('Login' => 'xsd:string', 'Haslo' => 'xsd:string', 'Filia' => 'xsd:string'), // input parameters $namespace, // namespace $namespace . 'Test', // soapaction 'document', // style rpc or document 'literal', // use literal od encoded 'Sprawdza autoryzację połączenia' // documentation ); function Test($Login, $Haslo, $Filia) { if($Login == "TEST" AND $Haslo == "TEST") { $sukcess = true; $opisbledu = ""; } else{ $sukcess = false; $opisbledu = "Błąd autoryzacji."; } $test['TestResult'] = []; $test['TestResult']['Sukces'] = $sukcess; $test['TestResult']['OpisBledu'] = $opisbledu; return $test; } $server->service($postdata);
Z góry bardzo dziękuje za pomoc, walcz już z tym naprawde długo
