Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [XML][PHP]SOAP błąd w pliku wsdl, jak nadpisać określony fragment xml
eMCeH
post 2.01.2013, 04:26:40
Post #1





Grupa: Zarejestrowani
Postów: 48
Pomógł: 1
Dołączył: 1.04.2012
Skąd: Świętokrzyskie

Ostrzeżenie: (0%)
-----


Witam,

po wywołaniu:
Kod
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        
        <?php
        echo '<br />';
//Utworzenie obiektu klienta SOAP
        $client = new SoapClient("https://ewus.nfz.gov.pl/ws-broker-server-ewus/services/Auth?wsdl");
        $functions = $client->__getFunctions();
        echo '<br />';
        var_export($functions);
        echo '<br />';
//Logowanie
        $user = 'user';
        $pass = 'haslo';
        echo '<br />';
        $sesja = $client->login($user, $pass);
        var_dump($sesja);
        ?>


serwer zgłasza błąd:

Kod
Uncaught SoapFault exception: [soapenv:Server] org.apache.axis2.databinding.ADBException: Unexpected subelement {http://xml.kamsoft.pl/ws/kaas/login_types}login in C:\xampp\htdocs\ewus\index.php:21 Stack trace: #0 C:\xampp\htdocs\ewus\index.php(21): SoapClient->__call('login', Array) #1 C:\xampp\htdocs\ewus\index.php(21): SoapClient->login('user', 'haslo') #2 {main} thrown in C:\xampp\htdocs\ewus\index.php on line 21


na forum Delphi
Kod
http://pl.comp.lang.delphi.narkive.com/1m1aRvZb/import-wsdl-z-adresu-urla.2

znalazłem informację, iż plik definicji usługi zawiera błąd i należy poprawić sekcję login poprzez nadpisanie pobranego kodu z pliku definicji na inny kod
czy możecie mi pomóc w jaki sposób w nadpisać?
Go to the top of the page
+Quote Post
webdice
post 2.01.2013, 08:12:53
Post #2


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Możesz pobrać plik, poprawić go i odwoływać się do niego lokalnie. Aczkolwiek problem został już rozwiązany. Źle wywołujesz funkcje login.
Go to the top of the page
+Quote Post
eMCeH
post 2.01.2013, 11:26:07
Post #3





Grupa: Zarejestrowani
Postów: 48
Pomógł: 1
Dołączył: 1.04.2012
Skąd: Świętokrzyskie

Ostrzeżenie: (0%)
-----


Możesz coś dokładniej napisać, czemu uważasz, że źle ją wywołuję?
Go to the top of the page
+Quote Post
kufalo
post 2.01.2013, 11:29:34
Post #4





Grupa: Zarejestrowani
Postów: 251
Pomógł: 2
Dołączył: 24.08.2005

Ostrzeżenie: (0%)
-----


Cytat
Definicję testowej usługi autoryzacji można znaleźć pod adresem:
https://ewus.nfz.gov.pl/ws-broker-server-ew...vices/Auth?wsdl

Definicję testowej usługi ServiceBroker można znaleźć pod adresem:
https://ewus.nfz.gov.pl/ws-broker-server-ew...viceBroker?wsdl


Czy udalo się komus zalogowac przy pomocy PHP do wersji testowej?
Jaki jest testowy login i haslo?
Go to the top of the page
+Quote Post
eMCeH
post 2.01.2013, 11:32:48
Post #5





Grupa: Zarejestrowani
Postów: 48
Pomógł: 1
Dołączył: 1.04.2012
Skąd: Świętokrzyskie

Ostrzeżenie: (0%)
-----


mnie ani na testową ani na roboczą sciana.gif
Go to the top of the page
+Quote Post
kufalo
post 2.01.2013, 12:47:02
Post #6





Grupa: Zarejestrowani
Postów: 251
Pomógł: 2
Dołączył: 24.08.2005

Ostrzeżenie: (0%)
-----


Udalo mi sie zalogowac:
Kod
<?
$client=new SoapClient('https://ewus.nfz.gov.pl/ws-broker-server-ewus-auth-test/services/Auth?wsdl');

$responce=$client->login(['credentials'=>[['name'=>'domain','value'=>['stringValue'=>'15']],['name'=>'login','value'=>['stringValue'=>'TEST1']]],'password'=>'qwerty!@#']);

print($responce);
?>


albo:

Kod
<?
$client=new SoapClient('https://ewus.nfz.gov.pl/ws-broker-server-ewus-auth-test/services/Auth?wsdl');

$responce=$client->login(['credentials'=>[['name'=>'domain','value'=>['stringValue'=>'01']],['name'=>'type','value'=>['stringValue'=>'SWD']],['name'=>'idntSwd','value'=>['stringValue'=>'123456789']],['name'=>'login','value'=>['stringValue'=>'TEST']]],'password'=>'qwerty!@#']);

print($responce);
?>


Ale nie wiem jak pobrac odebrane w naglowku numer sesji i authToken.
Potrzebne do nasepnego zapytania...

Ten post edytował kufalo 2.01.2013, 12:58:06
Go to the top of the page
+Quote Post
eMCeH
post 2.01.2013, 12:50:37
Post #7





Grupa: Zarejestrowani
Postów: 48
Pomógł: 1
Dołączył: 1.04.2012
Skąd: Świętokrzyskie

Ostrzeżenie: (0%)
-----


zrób var_dump($responce);

skąd wziąłeś ['credentials'=> ?

Ten post edytował eMCeH 2.01.2013, 12:58:26
Go to the top of the page
+Quote Post
kufalo
post 2.01.2013, 12:59:44
Post #8





Grupa: Zarejestrowani
Postów: 251
Pomógł: 2
Dołączył: 24.08.2005

Ostrzeżenie: (0%)
-----


na podstawie ich wersji demo wzialem credentials:

Kod
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:auth="http://xml.kamsoft.pl/ws/kaas/login_types">
   <soapenv:Header/>
   <soapenv:Body>
             <auth:login>
                <auth:credentials>
                    <auth:item>
                        <auth:name>domain</auth:name>
                        <auth:value><auth:stringValue>01</auth:stringValue></auth:value>
                    </auth:item>
                    <auth:item>
                        <auth:name>type</auth:name>
                        <auth:value><auth:stringValue>SWD</auth:stringValue></auth:value>
                    </auth:item>
                    <auth:item>
                        <auth:name>idntSwd</auth:name>
                        <auth:value><auth:stringValue>123456789</auth:stringValue></auth:value>
                    </auth:item>
                    <auth:item>
                        <auth:name>login</auth:name>
                        <auth:value><auth:stringValue>TEST</auth:stringValue></auth:value>
                    </auth:item>
                </auth:credentials>
                        <auth:password>qwerty!@#</auth:password>
            </auth:login>
   </soapenv:Body>
</soapenv:Envelope>


Kod
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <ns1:session id="6F3FE3EA6BE54C5630F4F08E6FD0B803" xmlns:ns1="http://xml.kamsoft.pl/ws/common"/>
      <ns1:authToken id="BSbgyPBVy9Ww0B6al0DFuf" xmlns:ns1="http://xml.kamsoft.pl/ws/common"/>
   </soapenv:Header>
   <soapenv:Body>
      <ns1:loginReturn xmlns:ns1="http://xml.kamsoft.pl/ws/kaas/login_types">3</ns1:loginReturn>
   </soapenv:Body>
</soapenv:Envelope>


vad_dump zwraca tylko loginReturn czyli 3

my potrzebujemy session i authToken

Ten post edytował kufalo 2.01.2013, 13:00:46
Go to the top of the page
+Quote Post
eMCeH
post 2.01.2013, 13:04:39
Post #9





Grupa: Zarejestrowani
Postów: 48
Pomógł: 1
Dołączył: 1.04.2012
Skąd: Świętokrzyskie

Ostrzeżenie: (0%)
-----


rzeczywiście to widać, ale jak to znaleźć/rozpracować z pliku xml czy wdsl?
Go to the top of the page
+Quote Post
kufalo
post 2.01.2013, 13:41:26
Post #10





Grupa: Zarejestrowani
Postów: 251
Pomógł: 2
Dołączył: 24.08.2005

Ostrzeżenie: (0%)
-----


Do nastepnego zapytania potrzebne nam session i authToken.

Nie znam sie na SOPA i nie wiem czy to trzeba wyciagac recznie z tego xmla czy klasa SOAP php moze to zrobic jakos automatycznie.

Trzeba czekac na odpowiedz kogos obeznanego w SOAP.
Go to the top of the page
+Quote Post
webdice
post 2.01.2013, 14:06:57
Post #11


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Pracujesz jak na zwykłym pliku XML.
Go to the top of the page
+Quote Post
eMCeH
post 2.01.2013, 22:42:17
Post #12





Grupa: Zarejestrowani
Postów: 48
Pomógł: 1
Dołączył: 1.04.2012
Skąd: Świętokrzyskie

Ostrzeżenie: (0%)
-----


rozwiązanie tkwi chyba w samej definicji __soapCall;
zgodnie z opisem z php.net:
Kod
public mixed SoapClient::__soapCall ( string $function_name , array $arguments [, array $options [, mixed $input_headers [, array &$output_headers ]]] )

output_headers    - If supplied, this array will be filled with the headers from the SOAP response

tylko jak to zapisać?
gdy dla kodu:
  1. $parametry = ['credentials'=>
  2. [
  3. ['name'=>'domain','value'=>['stringValue'=>'15']],
  4. ['name'=>'login','value'=>['stringValue'=>$user]]
  5. ],
  6. 'password'=>$pass];

działa:
  1. $sesja = $client->login($parametry);

nie działa:
  1. $sesja = $client->__soapCall('login',$parametry);

zgłaszając błąd:
Kod
Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'credentials' property in...



ponieważ wątek uległ przekształceniu
jego ciąg dalszy jest:
http://forum.php.pl/index.php?showtopic=21...p;#entry1015834

Ten post edytował eMCeH 3.01.2013, 10:42:30
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 07:50