Skip to content

How to use BeSimpleBundle with authentification? #85

@anacicconi

Description

@anacicconi

Hello,

I've been trying to connect to a Soap webservice using BeSimpleBundle. This webservice has an Api Key, a username and a password. I'm not able to make it work. Has anybody already used it with authentication?

My goal is to have a Soap Envelope header like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.mrted.com/">
   <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>XXXXXX</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXX</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
   </soapenv:Body>
</soapenv:Envelope>

I've already used this bundle with a webservice that does not require authentication and it works well.

Here is my configuration:

be_simple_soap:
    clients:
test:
    wsdl: XXXXX?api_key=XXXXXX

And in my controller:

$soapClientBuilder = $this->get('besimple.soap.client.builder.test');
$soapClientBuilder->withBasicAuthentication('XXXX', 'XXXX');
$soapClient = $soapClientBuilder->build();
$soapClient->testMethod();

I tried many things but the last error I got with this exact configuration is:

Wrong Version 500 Internal Server Error - SoapFault

I even tried to override the version hardcoded on the bundle to see if this was the problem but it isn't.

Obs: I am able to make requests to this webservice using apps like Soap.ui.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions