L
L
levin-pwnz2020-04-17 19:51:32
PHP
levin-pwnz, 2020-04-17 19:51:32

How to build a request to SOAP?

Hello!

I ask for help in compiling a SOAP request, because I have never worked with SOAP before.

XSD
WSDL description

Sending a request:

$client = new \SoapClient($service, ['trace' => true]);

        $message = new Message();
        $message->Message = 'Message';
        $message->AuthRequest = 'AuthRequest';
        $message->AuthAppInfo = 'AuthAppInfo';
        $message->MasterToken = 'MasterToken'.env('MASTER_TOKEN');

        $data = $client->getMessage($message);

        $this->log($client->__getLastRequest(), 'request');
        $this->log($client->__getLastResponse(), 'response');


Message class
class Message
{
    public $Message;
    public $AuthRequest;
    public $AuthAppInfo;
    public $MasterToken;
}


I get the following error at the output:
Unmarshalling Error: cvc-complex-type.2.4.b: The content of element 'ns1:Message' is not complete. One of '{WC[##other:"urn://x-artefacts-gnivc-ru/inplat/servin/OpenApiMessageConsumerService/types/1.0"]}' is expected.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-04-17
@Rsa97

If I understand the WSDL correctly, then the getMessage request has a single parameter - MessageId.

6.1.2. The GetMessage method for receiving a message is designed to receive an xml message in accordance with the scheme defined for a specific service.
6.1.2.1. Method Signature: GetMessageResponse GetMessage(GetMessageRequest request) throws AuthenticationException, MessageNotFoundException,
where
GetMessageRequest is a request containing a single MessageId element, the message identifier assigned to the request that must be sent to receive the response.
GetMessageResponse - a response containing 2 elements: ProcessingStatus - the status of the request, and Message - a message that allows you to contain any xml with a mandatory schema. ProcessingStatus is an enumeration with two values: PROCESSING – the request is being processed, COMPLETED – the request has been processed.
The Message element is returned only if ProcessingStatus is COMPLETED
https://www.nalog.ru/files/kkt/pdf/%D0%A2%D0%B5%D1...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question