Skip to content
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

Import schema #29

Open
victorgp89 opened this issue Sep 26, 2018 · 28 comments
Open

Import schema #29

victorgp89 opened this issue Sep 26, 2018 · 28 comments

Comments

@victorgp89
Copy link

Hi,
A question,
When a wsdl has importacions like:
<xsd:import namespace="http://ws.link.hotelresb2b.com/login" schemaLocation="Link?xsd=login.xsd"/>

When I execute the command:
vendor/bin/soap-client -vvv generate config/config_hotusa.yml src/Service/Container --dest-class=Igm/Synergy/Service/Container/SoapContainerHotusa

I've an error in the SchemaReader.php

image

In all the metadata that I have generated with WSDL without imports, I haven't had any problems.

Thanks for advance,
Victor

@goetas
Copy link
Member

goetas commented Sep 26, 2018

is the file mentioned by the error accessible?

@victorgp89
Copy link
Author

@victorgp89
Copy link
Author

And when I wrap the xml with some headers like this:

image

How should I create the corresponding object in the headers?

Many thanks,
Victor

@goetas
Copy link
Member

goetas commented Sep 26, 2018

is the file mentioned by the error accessible?

Can it be that the PHP client is not allowed to access the file for same reason? from what I know it is the only reason for that error

@goetas
Copy link
Member

goetas commented Sep 26, 2018

How should I create the corresponding object in the headers?

you should use GoetasWebservices\SoapServices\SoapClient\Arguments\Headers\Header, see

$client->getSimple("foo", new Header($mp));
for an example

@victorgp89
Copy link
Author

Sorry for the response, I will not bother you anymore.

We have this in metadata and SoapContainer.

image

We need to execute the following request:

image

Following your example we create the corresponding object:

$client->getRooms($rq, new \GoetasWebservices\SoapServices\SoapClient\Arguments\Headers\Header($userValidation));

$rq is an instanceof of the RequestRooms php class.

And when call this process we have following error in ArgumentReader:
PHP Notice: Undefined index: requestRoomsHeader in /var/www/igm_client/vendor/igm/synergyclient/src/Arguments/ArgumentsReader.php on line 66 PHP Fatal error: Call to a member function setValue() on null in /var/www/igm_client/vendor/igm/synergyclient/src/Arguments/ArgumentsReader.php on line 67

It would be very helpful if you could give us some reason for the error.

Many thanks

@goetas
Copy link
Member

goetas commented Sep 26, 2018

I guess you have forgot to register the Header handler as in

$headerHandler = new HeaderHandler();

if you are suing SoapContainerBuilder::createSerializerBuilderFromContainer
You can do it via:

$serializer = SoapContainerBuilder::createSerializerBuilderFromContainer($container, function($registry) {
   $registry->registerSubscribingHandler(new HeaderHandler());
})->build();

@victorgp89
Copy link
Author

No,

I think the problem is in ArgumentsReader when the serviceDefinition have many parts.

In method handleHeaders you set in envelope the instance of the headers and return the body.

So now we have this content:

In variable args:

image

And in input['parts']:
image

So, always throw at this point in code:
image

@goetas
Copy link
Member

goetas commented Sep 26, 2018

Hmm... may be a bug, but not sure about it.

@goetas
Copy link
Member

goetas commented Sep 26, 2018

Can you copy/paste your soap operaton for this call? im confused by the "requestRoomsHeader" in the "parts" array.

@goetas
Copy link
Member

goetas commented Sep 26, 2018

Is the header defined also at SOAP metadata level or not? does it look as something as

<soap12:header use="literal" part="header" message="tns:requestHeader">
?

@victorgp89
Copy link
Author

Here is the wsdl if you want to check but is allright I think:
image

image

@goetas
Copy link
Member

goetas commented Sep 26, 2018

It looks a bug. I did not find anything that tests that case in my test suite.

Can you try to without wrapping the header param in \GoetasWebservices\SoapServices\SoapClient\Arguments\Headers\Header ?:

$client->getRooms($rq, $userValidation);

@victorgp89
Copy link
Author

If I pass GetRoomsInput directly like:

screenshot - 260918 - 14 02 24

I've another error:
PHP Fatal error: Call to a member function value() on string in /var/www/igm_client/vendor/jms/serializer/src/JMS/Serializer/Metadata/PropertyMetadata.php on line 105

And also call the function with your parameters like this:
screenshot - 260918 - 14 05 34

@goetas
Copy link
Member

goetas commented Sep 26, 2018

but you are still using \GoetasWebservices\SoapServices\SoapClient\Arguments\Headers\Header. Can you try without?

@goetas
Copy link
Member

goetas commented Sep 26, 2018

like $client->getRooms($rq, $hotel).

@victorgp89
Copy link
Author

Yes, if you pass like this:
$client->getRooms($rq, $userValidation);

I've this error:
PHP Notice: Undefined index: requestRoomsHeader in /var/www/igm_client/vendor/igm/synergyclient/src/Arguments/ArgumentsReader.php on line 71 PHP Fatal error: Call to a member function setValue() on null in /var/www/igm_client/vendor/igm/synergyclient/src/Arguments/ArgumentsReader.php on line 72

@goetas
Copy link
Member

goetas commented Sep 26, 2018

:/

@goetas goetas added the bug label Sep 26, 2018
@victorgp89
Copy link
Author

But I don't understand if I create request and set the body and header manually like:

screenshot - 260918 - 15 13 44

When I serialize to convert in XML it return followin error:
PHP Fatal error: Call to a member function value() on integer in /var/www/igm_client/vendor/jms/serializer/src/JMS/Serializer/Metadata/PropertyMetadata.php on line 104

@victorgp89
Copy link
Author

And in getRoomsInput I have this:

image

And I've another error:
image

@victorgp89
Copy link
Author

If the problem if this header:
image

Can I do this?
image

MyHandler is with o without namespace?

I want to do this to avoid the following:
image

@goetas
Copy link
Member

goetas commented Sep 26, 2018

@riccardonar did you face an issue as this?

@victorgp89
Copy link
Author

Because this class:
type: 'GoetasWebservices\SoapServices\SoapEnvelope\Headers<''Igm\Synergy\Definitions\Hotusa\Login\UserValidation''>'

Doesn't exist. It's posible to fix this? I do anything wrong? How it works?

Many thanks for attention.

@goetas
Copy link
Member

goetas commented Sep 26, 2018

Should be GoetasWebservices\SoapServices\SoapEnvelope2\Headers.... @riccardonar ?

@riccardonar
Copy link
Contributor

did you face an issue as this?

Mmm, i check that in my SOAPs i haven't any header part in the operations, so i don't test it

@victorgp89
Copy link
Author

Where you construct this part of metadatas?

`'GoetasWebservices\SoapServices\SoapEnvelope\Headers<''Igm\Synergy\Definitions\Hotusa\Login\UserValidation''>'

Because If i extrat the part the namespace of the class in there that's work correctly.

image

`

@victorgp89
Copy link
Author

Because when you pass Header like you tell me:

$client->getRooms($rq, $userValidation);

In Arguments reader you set empty class HeaderPlaceHolder to envelope and it throws an error cause argument is not the correct instance.

Is that for something?

image

@victorgp89
Copy link
Author

We can do this but I'm not sure that if it's how you thought.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants