phpro / soap-client

A general purpose SOAP client for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Providing a path to file for wizard gives invalid scheme error

NerijusNoreika opened this issue · comments

Bug Report

I am following the wizard instructions as gif file shows in the github docs. I provide the path to wsdl, but get an error.

Current behavior

Provide path config/wsdl.wsdl in the wizard step: Wsdl location (URL or path to file):, get the following error: Invalid URL: scheme is missing in "config/wsdl.wsdl". Did you forget to add "http(s)://"?

Expected behavior

No error should be generated, since I am not using URL for location, but file path.

Hello @NerijusNoreika,

By default, the generator uses an HTTP based WSDL loader.
You can swap it out with e.g. a stream wrapper loader that can work with local files.

return Config::create()
    ->setEngine(CodeGeneratorEngineFactory::create(
        'wsdl.xml',
        new FlatteningLoader(new StreamWrapperLoader())
    ))

When you applied this change, you'll need to trigger the various generate commands on the soap-client binary manually in order to generate everything.

Thanks for quickly reply, appreciate it. :)

I used a server for wsdl to generate the types and I see that ExtSoapOptions::defaults that is used on factory to create the client accepts the file path. Got my SOAP request working.

Though I guess updating the docs to include the information that the wizard does not work with file paths out of the box, would be appreciated, especially so since the wizard gif uses a path.

Thanks for the comment.

I'm thinking : maybe using the resource stream loader could be a better default.
Cause, when you need specific additional HTTP settings, you need to alter the configuration anyways.

Let me keep this one open for a while so that I can look at the impact of that change.