Skip to content

400 Bad Request, XML not as expected #126

@clnt

Description

@clnt

Hi @CodeDredd,

I've been trying to implement this package today but have encountered a few issues along the way, such as exceptions about request body being empty when using withWsa(), now that I have removed that call I am getting a 400 Bad Request with everything I try even though the docs make it look very straightforward.

Here is a screenshot of my IDE, showing my class on the left creating the Soap client via your package and calling a method defined in the WSDL, and passing three parameters through with keys which I would expect to see in the XML request. However when I perform a dd() in the ExtSoapEncoder it gets passed through, the arguments are there but are not truly reflected in the generated XML.

soap_package_issue_anon

For example it hasn't added the first parameter languageID at all, and it has added the startDate and endDate as param1, param2 etc not honouring the keys that I am passing through - why is this?

Also just to note I have defined the __call method on my class and applied trait when I took a look at one of the generated classes:

    /**
     * Execute soap call
     *
     * @param string $method
     * @param mixed $parameters
     * @return \CodeDredd\Soap\Client\Response|mixed
     */
    public function __call($method, $parameters)
    {
        if (static::hasMacro($method)) {
            return $this->macroCall($method, $parameters);
        }

        $validationClass = 'App\\Validations'
            . ucfirst(Str::camel($method))
            . 'Validation';
        if (class_exists($validationClass)) {
            $parameters = app()->call([$validationClass, 'validator'], ['parameters' => $parameters]);
        }

        return $this->soap->call($method, $parameters);
    }

I can generate a successful response from the API using the SoapUI application which generates the following XML for the request:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
   <soap:Header/>
   <soap:Body>
      <tem:GetVisitSummariesByDate>
         <tem:languageID>1</tem:languageID>
         <tem:startDate>2021-04-10T00:00:00.000Z</tem:startDate>
         <tem:endDate>2021-04-14T00:00:00.000Z</tem:endDate>
      </tem:GetVisitSummariesByDate>
   </soap:Body>
</soap:Envelope>

The SoapUI configuration in terms of authentication is simply a Username and Password, WSS-Password Type set to PasswordText and the 'Add default wsa:To` option checked.

Am I missing something here or is this package not going to work the way I need it to? 🤔

Laravel 6, package version 1.5.1

Cheers,
Matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions