-
-
Notifications
You must be signed in to change notification settings - Fork 175
-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About sequence generation again #414
Comments
Hello, The way to go here would be to provide an array of said type through the with* function - even though the doc locks state to only accept the class instead of a list. You need to use the iterator assembler as well |
Yes, I've tried to provide an array like this:
and getting the above error. I also tried to generate QueryCriteria using IteratorAssembler without luck (no effect). |
The error you see is an internal encoding error from phps SoapClient. According to the part of the wsdl you shared, it should work this way. However, php has a bug that doesn't allow this: https://bugs.php.net/bug.php?id=79210 A possible fix might be to add the max occurs to the element instead of the sequence? |
Do I have to do that on the server side? Because after inspecting exp-soap-engine I can see it calls \SoapClient with WSDL URL that loads it and I see no way to put my code between to patch XML contents (at least at types generation stage). |
There are some ways to do so which all have their pros and cons.
This needs to be done during runtime stage and won't have much affect on generation stage. |
I'll try to go with a local proxy since that part of xml I showed you is an include from a bigger service description and I don't want to sync it locally everytime it changes. |
That would also be a good solution. I am finishing up a flattening WSDL loader. Once it is done, that would probably be the best solution: It would allow you to decorate loaders so that you could apply changes to a specific file and still end up with the fully downoaded WSDL. That version can then be cached on the filesystem or reloaded by applying the same loaders by using the WSDL providers that already exist. |
I have a crazy idea, please correct me if I'm wrong. I assume that error "SOAP-ERROR: Encoding: object has no 'DataSourceName' property" is thrown by the php-soap before even reaching the server and it complains that I'm passing an array of CriteriaElement[]s while given wrongly parsed WSDL it accepts just one CriteriaElement. I've done some experiments and it seems that standard \SoapClient() accepts null as the the first $wsdl argument and actual service URL to make requests can be passed in $options (uri and location keys). Is it possible that passing null as $wsdl parameter disables parsing service configuration (while having generated class hierarchy) and it just skips checks and just serializes objects and passes it to the service? Can't check it right now because ExtSoapOptions doesnt allow null for $wsdl. Does it anyway work this way? |
Not sure how it behaves in that case. You could validate this by using the AbusedClient constructor directly? |
So this is how it went: $transport = Psr18Transport::createForClient(
new PluginClient(
Psr18ClientDiscovery::find(),
[new AuthenticationPlugin(new BasicAuth($user, $pass))]
)
);
$metadataOptions ??= MetadataOptions::empty()->withTypesManipulator(
new IntersectDuplicateTypesStrategy()
);
$client = new AbusedClient(null, [
'uri' => 'http://tempuri.org/PurchLotRegister01Service', # from wireshark
'location' => $wsdl,
'trace' => true,
'exceptions' => true,
'keep_alive' => true,
'cache_wsdl' => WSDL_CACHE_DISK,
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
]);
$driver = ExtSoapDriver::createFromClient(
$client,
MetadataFactory::manipulated(
new ExtSoapMetadata($client),
$metadataOptions
)
);
$engine = new SimpleEngine($driver, $transport);
$eventDispatcher = new EventDispatcher();
$caller = new EventDispatchingCaller(new EngineCaller($engine), $eventDispatcher);
return new PurchLotRegisterClient($caller); and then I had to patch ExtSoapEncoder because SOAPAction header produced was in form:
So finally my non-wsdl call succeeded but caused an error on the server like:
|
Yeah makes sense ... it doesnt know what namespace to bind it to etc. since you didn't provide a WSDL. |
What if I download all the WSDL, manually patch them like this:
and try to regenerate classes and provide this patched wsdl files later to SoapClient? The problem is that PermanentWsdlLoaderProvider somehow caches only the root wsdl file which contains links to other wsdl's (where one of them I want to alter)? Do I have to download them manually too and update the links to point to local files? Will it work? Or do I need to somehow merge them into on file like yours flattening WSDL loader does? Is it worth trying this loader? |
Regenerating classes wouldn't make a big difference, it is inside the encoding section (during runtime). The You can always play around with it, but I noticed it still requires schema grouping - otherwise the file can becoma way too big. Meaning it needs some rewriting before it is in a usable state. In the meantime, you might want to use https://github.com/pkielgithub/SchemaLightener to download the flattened WSDL locally and next change that file? |
I can see no option to make SchemaLightener download wsdl's, "Select Wsdl to flatten" opens a file selection dialog. |
Hello @danaki, Haven't used that tool myself - sorry :) |
Meanwhile I made this proxy:
Which accepts json and produces json and that fully solves my problem. I'll test the cli once you finish it. |
@danaki Looks nice! Since the bug will still remain in PHP - using python to bypass the issue is most likely the smoothest solution ;p The CLI flatting tool is ready: You can provide a custom loader so that you can transform the WSDL on the fly during flattening. |
Hello,
I have a service description like so:
Using default generator I get following classes:
QueryCriteria class accepts only single CriteriaElement in the provided code. How do I make it accept a list?
P.S. If I just wrap a list of CriteriaElement[] inside QueryCriteria it results to an error "SOAP-ERROR: Encoding: object has no 'DataSourceName' property".
Thank you
The text was updated successfully, but these errors were encountered: