Closed knox2 closed 3 years ago
Only the soap body is retrievable by default using getResult method or as the method call, it’s the native PHP SoapClient class behaviour.
To fetch the soap header, you can use the special method getLastResponse(true), see https://github.com/WsdlToPhp/PackageBase#usage-2, true allows you to get a DomDocument PHP object so you can then use the native PHP methods from the DomDocument class such as getElementsByTagName and so on....
Let me know if it’s enough clear.
Hi @mikaelcom , I found an easier way to get it.
I did the following:
protected $output_headers;
then changed the below (using an example):
From
$this->setResult($this->getSoapClient()->UpdateBulkOrder($parameters));
return $this->getResult();
To
$this->setResult($this->getSoapClient()->__soapCall("UpdateBulkOrder", [$parameters], [],null, $this->output_headers));
return $this->getResult();
Then I created a function
public function getOutputHeaders()
{
return $this->output_headers;
}
$this->getResult()
//Get result body
$this->getOutputHeaders()
//Get result header
The header now displays okay and can be accessible just the same way as the body via methods created by the package
You’re smarter than me! I never looked so far to the parameters and it’s a good one!
Can you confirm you get generated class instances? So you edited the generated Service class to handle it in the meantime?
Anyway I think it would be a good improvement to catch the output headers anytime and to provide the corresponding method to get them for cases like yours!
Indeed I get the generated class instances for the header, I was shocked that it worked, when I accessed the headers I could easily navigate using generated class methods to get the values I wanted....and Yes I edited the generated service class and added the changes.
It just worked.
Indeed I get the generated class instances for the header, I was shocked that it worked, when I accessed the headers I could easily navigate using generated class methods to get the values I wanted....and Yes I edited the generated service class and added the changes.
It just worked.
Great! Thanks for the info :)
Hopefully it gets to the core......thanks
Hi, could you try to generate your package using the feature/issue-219 branch or the phars from:
Let me know then,
Hi @mikaelcom,
I'll test it this week and give feedback
Hi @mikaelcom , sorry I've taken long to respond. Work has been really busy, I finally managed to test it...It works perfectly...Thanks so much
How do I get the soap response header, currently the output only contains the soap response body. eg in the beloe example response im able to get DataFormLoadReply from soap:Body and not ResponseErrorHeader from soap:Header.
How can I access the details in soap:Header