namespace issue with soap:header in wsdl mode

matt.mcaughan's picture
The Microsoft WSE toolkit automatically attaches WS-Addressing headers when invoking a web service. This in itself does not appear to be an issue when calling WSF/PHP services that are not using WSDL mode. For WSF/PHP services that are using WSDL mode, the method wsf_wsdl_process_in_msg appears to attempt to load just the soap:Header element in to a DOMDocument. The issue using WSE as a client then becomes the wsa namespace is set at the soap:Envelop element level. Loading soap:Header directly is causing libxml2 to raise warnings because the wsa namespace on, MessageID, ReplyTo, Address and To, is unknown.
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Namespace prefix wsa on MessageID is not defined in Entity, line: 1 in wsf_wsdl.php on line 675

Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Namespace prefix wsa on ReplyTo is not defined in Entity, line: 1 in wsf_wsdl.php on line 675

Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Namespace prefix wsa on Address is not defined in Entity, line: 1 in wsf_wsdl.php on line 675

So is this a 'bug' in WSF that needs to be fixed? Or should the more drastic route of implementing a WSE Policy to remote the WS-Addressing headers from the the SOAP message?
dimuthuc's picture

Hi, You wsdl should have the

Hi, You wsdl should have the action for each operation in the port type section. Please read the point5 in here, http://www.dimuthu.org/blog/2008/11/26/5-facts-about-ws-addressing-action-in-wsfphp/ Dimuthu
matt.mcaughan's picture

Thanks but this looks like a bug...

Dimuthu... I have read your blog entry. The more I look in to this it looks very much like a bug to me. The error comes from libxml2 trying to parse the soap:Header. Not that it cannot locate the wsa:action. Read my post, it's clearly a warning about namespace. See the Microsoft WSE toolkit places the xmlns:wsa namespace attribute on the soap:Envelope. The WSF toolkit in WSDL mode loads just the soap:Header as the root document in to a DOMDocument. It has no xmlns:wsa attribute because it should be an inherited namespace as a child of soap:Envelope Because of this approach in WSF the DOMDocument for the header cannot find the wsa namespace. Then libxml2 raises these warnings. And the response is no longer valid SOAP. Check out the details. I have posted them here. https://wso2.org/jira/browse/WSFPHP-374 WSF/PHP seems to have lots of sticking points like this one. For this library to receive a much wider adoption rate it is going to have to play better with Microsoft. Even if how they do things is 'wrong'.
elmer78's picture

Yeah it looks like a bug....

I think this is a wider problem because I get the same message during parsing response returned by php soap server: 65b662d4c23ccd6f82882df9092e6e79_1 0 1236672887 This response was succesfully parsed by nusoap client, php internal soap extension, .net, delphi - wsf displays following warnings: Warning: DOMDocument::loadXML() [domdocument.loadxml]: Namespace prefix xsi for type on hash-offset is not defined in Entity, line: 2 in wsf_wsdl.php on line 501 Warning: DOMDocument::loadXML() [domdocument.loadxml]: Namespace prefix xsi for type on server-time is not defined in Entity, line: 3 in wsf_wsdl.php on line 501 Is there any way to workaround this problem?
elmer78's picture

Yeah it looks like a bug....

I think this is a wider problem because I get the same message during parsing response returned by php soap server (added as attachment) This response was succesfully parsed by nusoap client, php internal soap extension, .net, delphi - wsf displays following warnings: Warning: DOMDocument::loadXML() [domdocument.loadxml]: Namespace prefix xsi for type on hash-offset is not defined in Entity, line: 2 in wsf_wsdl.php on line 501 Warning: DOMDocument::loadXML() [domdocument.loadxml]: Namespace prefix xsi for type on server-time is not defined in Entity, line: 3 in wsf_wsdl.php on line 501 Is there any way to workaround this problem?
dimuthuc's picture

There was an issue

There was an issue serializing sub tree and fixed in axis2/c (https://issues.apache.org/jira/browse/AXIS2C-1307) recently which I doubt the cause of this problem. Can you please recheck with the nightly build, http://wso2.org/downloads/wsf/php/nightly-build Thanks Dimuthu
elmer78's picture

Sorry it didn't help

Unfortunately last night build didn't resolve my problem. I still get the same warnings during response deserialization. I also checked axis2/c issue you wrote about. Situation described in jira is slightly different from one I encountered. In my case namespace was declared in parent element (doLogin) so it should be inherited below if I understand xml correctly. In example described in jira (https://issues.apache.org/jira/browse/AXIS2C-1307) namespace was declared in sibling element.
jfouse's picture

I am seeing something very similar

...perhaps the same issue? Here's the response payload I'm getting back: <NS1:LoginResponse xmlns:NS1="urn:Test_Service"><AppSessionKey xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><Session_Key xsi:type="xsd:string">{4049D560-FE63-4400-9B22-DFFD8EB4938C}</Session_Key><ErrorCode href="#0"/></NS1:LoginResponse> And I'm getting the following warning when it's loaded: Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Namespace prefix xsi for type on Session_Key is not defined in Entity, line: 1 in wsf_wsdl.php on line 501 I'm still able to get the processed response data out, so while ideally I'd like to have the warning resolved, in the meantime I'd like to just have the warning supressed.
dimuthuc's picture

For me it looks like the

For me it looks like the same issue. I think you may have old libraries in your path so new libraries are not affective. Can you check the path and retry. And there is a problem in the windows nightly build. it doesn't contain the scripts/dyanmic_invocation/xslt directory which you need to copy manually from the nightly build source. Dimuthu
jfouse's picture

Hmm...this was a clean build/install

This was a clean build/install on a linux box that didn't have it before, from the wsf/php 2.0.0 download. Do you suggest I pull down the current trunk from subversion and try that instead? - Joel
elmer78's picture

It is possible it is the same issue

It is possible it is the same issue but nightly build didn't help for me. I deleted last stable wsf version (to assure there is no way to use older libraries) and downloaded last win32 nightly build. As you wrote in earlier post I also copied scripts/dynamic_invocation/xslt directory from sources zip to nightly build directory. At the end I replaced wsf.dll extension file in php extension directory. Unfortunately after apache restart problem still occurs... If I do something wrong please let me know.... At the moment in my system there is no another wsf version than last nightly build. If it is possible wsf's wsdl client does not support rpc/encoded SOAP's correctly?
jfouse's picture

I posted this elsewhere, but possibly yes

regarding rpc/encoded wsdl, I came across this: http://wso2.org/library/knowledge-base/convert-rpc-encoded-wsdl-document-literal-wrapped-wsdl - Joel
xpojosh's picture

Any progress on this bug?

Matt, I don't supposed that you've gotten any resolution on the WSDL mode wsa namespace issue? I see that the bug hasn't been assigned to anyone. josh
charlottesada's picture

any resolution

I'm getting the same error. I'm newbie to WS02/php.... This happens when Ksoap2 client tries to call with namespace specified. This is the request from KSOAP2 client on android.. 0 35.138348 -80.93361 25 Response: It gives the valid response back but along with these warnings. Warning domdocument.loadxml wsf_wsdl.php 682 Warning domdocument.loadxml wsf_wsdl.php 682 Warning domdocument.loadxml wsf_wsdl.php 682 Warning C:\tempback\xampp\htdocs\trialapp\services\soap\DataService.php 760 Warning C:\tempback\xampp\htdocs\trialapp\services\soap\DataService.php 760
xperteaseltd.yahoo.co.uk's picture

also in soap ui

I have the same issue in SoapUi. It puts the namespace from class anotations of the classes provided in classmap into the soap envelope which is not recognized by wsf. moving it to the soap body resolves the problem but that is not something that should be necessary
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)