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

Hotel and xml namespace #292

Open
gabrieleleo opened this issue Feb 11, 2019 · 10 comments
Open

Hotel and xml namespace #292

gabrieleleo opened this issue Feb 11, 2019 · 10 comments
Labels

Comments

@gabrieleleo
Copy link
Contributor

hi,

we have discovered that the error comes from hotel is generated by namespaces tag in xml (ns1, ns2...) how can we remove that (just for hotel messages)?

@DerMika
Copy link
Collaborator

DerMika commented Feb 11, 2019

What error are you talking about?

The ns1 and other such prefixes are autogenerated by PHP's SOAP client. There is probably a way to define your own namespaces. But they should be internally consistent, so I'm not sure if removing them will solve whatever problem it is you're experiencing...

@gabrieleleo
Copy link
Contributor Author

after spend several hours with amadeus technical support we've discovered that this issue: #70 (comment)

coming from ns1/ns2.. tag. we know that are autogenerated, but always according to amadeus technical support, other clients have our same problem with namespace prefix (that must not exist according to amadeus).

The test we've done with amadeus was just sending the xml without namespace tag and....surprise it works (it's very strange)

@DerMika
Copy link
Collaborator

DerMika commented Feb 11, 2019

I found this reddit thread: https://www.reddit.com/r/PHP/comments/184ik5/soap_client_change_ns1_namespace_prefix/c8c3xhi

You may want to try that?

@gabrieleleo
Copy link
Contributor Author

gabrieleleo commented Feb 13, 2019

after several hours with amadeus support. we've discovered that's 💩 .

when php load hotel load the namespace (ns1, ns2 etc..), those are errors for amadeus.
we don't know how to continue to develop hotel's api in this project at the moment, have you got some advice?

we've made a call without ns and works fine!

tested with: hotelMultiSingleAvailability

@gabrieleleo
Copy link
Contributor Author

any update?

@rifkydj
Copy link

rifkydj commented Mar 25, 2019

@DerMika can this be fixed ?

@gabrieleleo
Copy link
Contributor Author

@DerMika can this be fixed ?

we're working on, but isn't too easy. the problem itself start in amadeus

@DerMika
Copy link
Collaborator

DerMika commented Mar 25, 2019

As you may have noticed, I do not have the time to get to the bottom of this.

Somehow you'll have to convince PHP's soapclient to not set the automatically generated namespaces. I don't know if this is possible, you may have to look into how the underlying XML library works. libxml2 if I recall correctly.

The brute force fix would be to override the SoapClient's __doRequest and do some string or XML manipulation there. But you'll have to be very careful not to degrade performance.

@rifkydj
Copy link

rifkydj commented Mar 27, 2019

Hi guys, I Think This Should do removing the namespace tags .

class MySoapClient extends SoapClient
{
public function __doRequest($request, $location, $action, $version, $one_way=0)
{
$xml = str_replace('ns1:', '', $xml);
parent::__doRequest($xml, $location, $action, $version, $one_way);
}
}
$client = new MySoapClient($wsdl, $options);
Reference : https://stackoverflow.com/questions/21186830/how-to-remove-soap-namespace-from-call

@DerMika
Copy link
Collaborator

DerMika commented Mar 27, 2019

it's not always ns:1, in fact SoapClient will generate a namespace prefix per namespace in your document. But yes, that could be a way to go.

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

No branches or pull requests

3 participants