M
M
maximmax2014-08-11 13:40:19
SOAP
maximmax, 2014-08-11 13:40:19

How to login to SOAP service?

There is a request structure:

POST https://Ñ…Ñ…Ñ…Ñ…Ñ…Ñ…&WSSOAP=1 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "document/http://Ñ…Ñ…Ñ…Ñ…Ñ…:testStatus"
Content-Length: 572
Host: xxxxxx
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="nameSpace">
   <soapenv:Header>
      <Token xmlns="http://xxxxxx">Login</UsernameToken>
      <Password xmlns="http://xxxxxx">Password</PasswordText>
      <Session xmlns="http://xxxxxx">Session</SessionType>
   </soapenv:Header>
   <soapenv:Body>
      <ws:testStatus_Input>
         <ws:statId>xxxxxx</ws:statId>
      </ws:testStatus_Input>
   </soapenv:Body>
</soapenv:Envelope>

It is required to log in to the service with these data.
I connect wsdl:
$client = new SoapClient("wsdl.wsdl", Array("exceptions"=>0,"trace" => 1));

I create a header:
$headerbody = array('Token' => 'Login',
                    'Password' => 'Password');
$header = new SOAPHeader('nameSpace', 'RequestorCredentials', $headerbody);       
$client->__setSoapHeaders($header);

I call the method:
$result = $client->testStatus(array("statId"=>"xxxxxx"));
echo $result;

I get the error:
"SoapFault exception: [SOAP-ENV:Client] Error Code: 10944642 Error Message: Error: Inbound SOAP Message - Session Token is missing or invalid or has expired in /var/www/Ñ…Ñ…Ñ…Ñ…:15 Stack trace: #0 /var/www/xxxxx(15): SoapClient->__call('testStatus', Array) #1 /var/www/xxxxx(15): SoapClient->testStatus(Array) #2 {main}".
I can not understand, the problem is that you can not log in? After all, the token and password are correct, or am I somehow not accessing the service correctly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
maximmax, 2014-08-11
@maximmax

Yes, I'm sorry, I ruled something, I wanted it shorter. In fact, this is exactly what it looks like:

<UsernameToken xmlns="http://xxxxxx">Login</UsernameToken>
<PasswordText xmlns="http://xxxxxx">Password</PasswordText>
<SessionType xmlns="http://xxxxxx">Session</SessionType>

Error anyway.

T
T_Oleg, 2014-08-14
@T_Oleg

Friends, the topic is relevant and of the same type.

$headerbody = array(
                     'UsernameToken'    =>    Token',
                     'PasswordText'    =>    'Text',
                     'SessionType'    =>    'Type');

As a result, the error is
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] Error Code: 10944642 Error Message: Error: Inbound SOAP Message - Session Token is missing or invalid or has expired in /home/Ñ…Ñ…Ñ…/Ñ…Ñ…Ñ….php:6 Stack trace: #0 /home/industri/inspires.com.ua/devel/soap/otp.php(6): SoapClient->__call('checkOptyStatus', Array) #1 /home/Ñ…Ñ…Ñ…/Ñ…Ñ…Ñ….php(6 ): SoapClient->checkOptyStatus(Array) #2 {main} thrown in /home/xxx/xxx.php on line 6

C
ChernovGV, 2015-08-26
@ChernovGV

Look at what request you are forming:

try {
                $request = $client->method($object);
            } catch (SoapFault $exception) {
                print_r($client->__getLastRequest());
                return false;
            }

Maybe the package structure is not correct.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question