notfalsedev / laravel-soap

A soap client wrapper for Laravel
MIT License
634 stars 122 forks source link

Issue with Header and Body Separation #137

Closed ghost closed 6 years ago

ghost commented 6 years ago

Greetings, I have an issue while separating the header from the body using your package as follows:

  1. All in one array:
$this->soapWrapper->add('Session', function ($service) {
            $service
              ->wsdl('http://webservices.sabre.com/wsdl/sabreXML1.0.00/usg/SessionCreateRQ.wsdl')
              ->trace(true);
          });

        $data = [
            'Header' => [
                'MessageHeader' => [
                    'From' => [
                        'PartyId' => 'matt@texasfares.com'
                    ],
                    'To' => [
                        'PartyId' => 'https://webservices.sabre.com'
                    ],
                    'CPAId' => 'EP5E',
                    'ConversationId' => '1sbsstpojlksd',
                    'Service' => 'SessionCreateRQ',
                    'Action' => 'SessionCreateRQ',
                    'MessageData' => [
                        'MessageId' => 'mid:20001209-133003-2333@clientofsabre.com',
                        'Timestamp' => '2001-02-15T11:15:12Z', //2001-02-15T11:15:12Z
                        'TimeToLive' => '2001-02-15T11:15:12Z'
                    ],
                ],
                'Security' => [
                    'UsernameToken' => [
                        'Username' => '773400',
                        'Password' => 'PASSWORD_GOES_HERE',
                        'Organization' => '7TZA',
                        'Domain' => 'AA'
                    ]
                ],
            ],
            'Body' => [
                "SessionCreateRQ" => [
                    "POS" => [
                        "Source" => [
                            "PseudeCityCode" => 'EP5E'
                        ]
                    ]
                ]
            ]
        ];

        $response = $this->soapWrapper->call('Session.SessionCreateRQ', $data);

        print_r($response);
  1. Separated in Header and Body:
$this->soapWrapper->add('SessionCreateRQ', function ($service) {
            $service
                    ->wsdl('http://webservices.sabre.com/wsdl/sabreXML1.0.00/usg/SessionCreateRQ.wsdl')
                    ->header('http://www.ebxml.org/namespaces/messageHeader', 'Header', [
                        'From' => [
                            'PartyId' => 'matt@texasfares.com'
                        ],
                        'To' => [
                            'PartyId' => 'https://webservices.sabre.com'
                        ],
                        'CPAId' => 'EP5E',
                        'ConversationId' => '1sbsstpojlksd',
                        'Service' => 'SessionCreateRQ',
                        'Action' => 'SessionCreateRQ',
                        'MessageData' => [
                            'MessageId' => 'mid:20001209-133003-2333@clientofsabre.com',
                            'Timestamp' => '2001-02-15T11:15:12Z', //2001-02-15T11:15:12Z
                            'TimeToLive' => '2001-02-15T11:15:12Z'
                        ],
                        'Security' => [
                            'UsernameToken' => [
                                'Username' => '773400',
                                'Password' => 'PASSWORD_GOES_HERE',
                                'Organization' => '7TZA',
                                'Domain' => 'AA'
                            ]
                        ]
                    ], 1, '')
                    ->cache(WSDL_CACHE_NONE)
                    ->trace(true);
        });
        $response = $this->soapWrapper->call('SessionCreateRQ.SessionCreateRQ', ["SessionCreateRQ" => [
            "POS" => [
                "Source" => [
                    "PseudeCityCode" => 'EP5E'
                ]
            ]
        ]]);
        var_dump($response);

Notice that I got the same error from both of them telling that "SOAP-ERROR: Encoding: object has no 'POS' property". Do you have a suggestion for me?

notfalsedev commented 6 years ago

Try to add a extra array, like: Not sure what the problem is here.

$response = $this->soapWrapper->call('SessionCreateRQ.SessionCreateRQ', [["SessionCreateRQ" => [
            "POS" => [
                "Source" => [
                    "PseudeCityCode" => 'EP5E'
                ]
            ]
        ]]]);
jkunwar commented 5 years ago

@mostafaahamidmanon did you figure out how to use saber using this package