Client can not find the WebService (WSDL)
Hi,
I am trying to access my webservice through a php client. I have moved both service and client (which are in php) into the same directory http://localhost/samples" and has changed the client URI to point to the new location of the client and wsdl file.
$client = new WSClient(array ("wsdl" =>"MyWsdl.wsdl","to" => "http://localhost/samples", "classmap" => $class_map));
When I call the service, the client is created successfully but I get this error:
"response envelope not found Data from Web service"
The original WSDL used to point to a different location and thats why I used
"to" => "http://localhost/samples"
Does anybody know what's happening?
cheers
- Login or register to post comments
- Printer friendly version
- 200 reads










"to"=>"new URI" might not working
Having replaced the
$client = new WSClient(array ("wsdl" =>"MyWsdl.wsdl","to" => "http://localhost/samples/MyService.php", "classmap" => $class_map));
with
$client = new WSClient(array ("wsdl" =>"MyWsdl.wsdl","to" => "http://localhost/samples/dummy.php", "classmap" => $class_map));
It made no difference indicating that the file is not being found.
This makes me think that the "to"=>"new URI" might not working.
Has anybody had similar problems.
cheers
Hi, In order for the client
Hi,
In order for the client to work properly, your specified new endpoint uri should be a web service endpoint implementing the wsdl specified for the "wsdl" option.
Nandika
Hi Nandika, The web service
Hi Nandika,
The web service specified in MyWsdl.wsdl is implemented in the MyService.php. When I call MyService:
http://localhost/samples/MyService.php
I get a listing of my services deployed in the server and when I call
http://localhost/samples/MyService.php?wsdl
I get a listing of the whole wsdl specifications listed on the screen. But when I call the client
http://localhost/samples/getMyList.php or
http://localhost/samples/getMyList.php?wsdl
the response is null. The client code is like this:
$client = new WSClient(array ("wsdl"=>"MyWsdl.wsdl","to"=>"http://localhost/samples/MyService.php","classmap"=>$class_map, "action"=>"GetAList"));
echo "Created client <br/>";
$proxy = $client->getProxy();
if($proxy == "")
echo "No proxy";
$input = new GetAListReq();
$response = $proxy->GetAList($input);
I have checked the apache.log file and there are no errors. I have checked the wsf_php_client.log and cant see any errors.
How do I check if any messages is sent to the server?
How do I check if the client is working?
cheers
Checking the sent messages
Hi
WSClient class has functions getLastRequest() and getLastResponse(). These functions will output the sent and the received soap messages as strings.
Also you can use a tcp monitoring tool to view the messages exchanged between the client and the server. One such tool is tcpmon. http://ws.apache.org/commons/tcpmon/
Regards
Nandika
Client not responding
Hi Nandika
I have tried the two calls as follows:
$client = new WSClient(array ("wsdl"=>"MyWsdl.wsdl","to"=>"http://localhost/samples/MyService.php","classmap"=>$class_map, "action"=>"GetAList"));
echo "Created client <br/>";
echo $client->getLastRequest();
echo $client->getLastResponse();
$proxy = $client->getProxy();
if($proxy == "")
echo "No proxy";
$input = new GetAListReq();
$response = $proxy->GetAList($input);
echo $client->getLastRequest();
echo $client->getLastResponse();
I dont get anything back. I have also checked the $response value and it is "".
This is most bizzare. I dont get any exceptions either.
Not sure where to look next!!!
I also downloaded the tcpmon. It looks for a port to scan and having checked my WSDl file, I dont have any specific port that I am supposed to scan. If you have used the tool, which port did you use to scan?
cheers
TCPMON
Hi,
In tcpmon you have to set listen port and target port.
Say you have apache server running on port 80, then change the client endpoint to send the message to a port like 8080 and set the tcpmon options like this
listen port 8080
target port 80
target host localhost
For more help, check the http://ws.apache.org/commons/tcpmon/tcpmontutorial.html
Thanks
Dimth
Dimth, Thanks. I have
Dimth,
Thanks. I have managed to have tcpmon working but not my program. I paased in two different Soap Actions (one valid and one totally made up) and I got the same message:
Created client
Calling web service
Data from Web service ....
No response
which gives me the impression that the web service endpoint is not found despite the fact that I have told the client where the service is. Gtting a little fed up as what the problem is.
cheers
what is the server reponse message
can you send the server respose message sent by tcpmon?. Is that the message is service not found or operation not found?
dimuthu
Internal server error
Hi Dimithu
This is what I get:
HTTP/1.1 500 Internal Server Error
Date: Thu, 22 May 2008 08:17:21 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.5
X-Powered-By: PHP/5.2.5
Content-Length: 289
Connection: close
Content-Type: text/xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>SOAP message does not contain a SOAP envelope element</faultstring>
</soapenv:Fault>
</soapenv:Body></soapenv:Envelope>
I am currently running it under Windows XP but plan to port to Ubuntu when I get it to work.
cheeers
Request message?
It says something wrong in incomming request message. Can you post the reuest message as well?
Dimuthu
Request message
Dimuthu,
In the server, the request is defined as:
class GetAListReq
{
public $id; // string
public $password; // string
public $dateIni; // string
public $dateEnd; // string
}
class GetAListRsp
{
public $mydata; // string
}
$actions = array("GetAgenda"=>"GetAList");
In the client, this is how I construct it:
$client = new WSClient(array ("wsdl"=>"myWsdl.wsdl","classmap"=>$class_map, "action"=>"GetAgenda"));
$input = new GetAListReq();
$input->id = "1111"; // string
$input->password = "secret"; // string
$input->dateIni = "10/10/08";// string
$input->dateEnd = "10/10/08"; // string
echo "calling web service <br/>";
$response = $proxy->GetAgenda($input);
is this what you needed?
cheers
There seems to be ageneral issue with soap envelope
Dimithu,
I have just tried to access a test web service on http://www.xmethods.net by writing a simple client using WSO framework. The service accepts an ISBN number and returns a boolean. I came across a similar message:
HTTP/1.1 200 OK
Date: Thu, 22 May 2008 11:14:46 GMT
Server: Apache/2.2.4 (Win32) PHP/5.2.5
X-Powered-By: PHP/5.2.5
Content-Length: 338
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
Created client <br/>calling web service <br/> response envelope not found <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<ns1:IsValidISBN10 xmlns:ns1="http://webservices.daehosting.com/ISBN"/>
</soapenv:Body></soapenv:Envelope>Data from Web service .... <br/>Sorry no booksDone
I am not sure if this is relevant, however it may indicate an error somewhere inside the engine.
cheers
have you used echo or print functions
Hi,
Have you used echo or print functions in your service. Can you check from where " Created client" or "Data from Web service .... <br/>Sorry no booksDon" comes from?. I think you have used echo. The server side doesn't work when you mixed with WSService->reply() and echo or print.
So can you remove them and try
Thanks
Dimuthu
No echo or print in server side!
Hi Dimuthu
The messages are all coming from the client side. I also removed all echo/print statements from the client as well and still dont get any response.
I have checked it with tcpmon and the message I get is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>SOAP message does not contain a SOAP envelope element</faultstring>
</soapenv:Fault>
</soapenv:Body></soapenv:Envelope>
tom
One more thing
Checking the Apache error log I also get this message:
[Sat May 24 10:40:12 2008] [error] [client 127.0.0.1] operation node not found
dont know if this helps?
tom
Yet one more thing
Having checked the client and server logs in wsf_c/logs directory I can see this error messages:
SERVER ERROR MESSAGES: wsf_php_server.log
[Sat May 24 10:46:32 2008] [error] ..\..\util\src\dir_handler.c(219) No files in the path C:\PhpTools\wso2-wsf-130-win32\wsf_c/services.
[Sat May 24 10:46:32 2008] [error] ..\..\util\src\class_loader.c(161) dlerror reason: Something went wrong loading the DLL. If you happen to see this message, please note that getting the exact error form Windows is a TODO. And if possible please help fix it. :)
[Sat May 24 10:46:42 2008] [error] ..\..\src\core\transport\http\util\http_transport_utils.c(2220) Service or operation not found
CLIENT ERRORS MESSAGES: wsf_php_client.log
[Sat May 24 10:46:45 2008] [error] ..\..\util\src\dir_handler.c(219) No files in the path C:\PhpTools\wso2-wsf-130-win32\wsf_c/services.
[Sat May 24 10:46:45 2008] [error] ..\..\util\src\class_loader.c(161) dlerror reason: Something went wrong loading the DLL. If you happen to see this message, please note that getting the exact error form Windows is a TODO. And if possible please help fix it. :)
[Sat May 24 10:46:45 2008] [info] wsf_wsdl.php
[Sat May 24 10:46:45 2008] [debug] C:\PhpTools\wso2-wsf-130-win32\scripts\dynamic_invocation\wsf_wsdl_util.php(1363) WSF/PHP] importing xsd: ./MyCommon.xsd from: MyWsdl.wsdl
[Sat May 24 10:46:46 2008] [info] [rampart][rampart_mod] rampart_mod shutdown
Hope this would shed some light on the problem.
tom
check the soapAction in the wsdl
Can you recheck your soap action in the wsdl.
For an example, Your wsdl can have binding section simmilar to this,
<wsdl:binding name="MyServiceSoapBinding"
type="tns:MyServicePortType">
<wsp:PolicyReference URI="#transport_binding_policy"/>
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetAgenda">
<soap:operation
soapAction="http://www.somewhere.com/GetAgenda" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
You don't need to provide action option explicitly , in wsdl mode it pick from wsdl inside the wsf/php code, so leave it blank. But if you don't have the soapAction attribute in the WSDL you need to add one. (becuase in your case since the operation name ("getAgenda) is diffrent from the payload element name ("GetAListReq") the service can't find the service operation.
Can this be the reason for your problem?
-Dimuthu
I think we are getting closer!!
I have done the chcanges you suggested. The server seems to be working fine now and loads the WSDL and all operations. The client still having problems. I get this in the client error log:
[Sat May 24 13:37:19 2008] [error] ..\..\util\src\class_loader.c(161) dlerror reason: Something went wrong loading the DLL. If you happen to see this message, please note that getting the exact error form Windows is a TODO. And if possible please help fix it. :)
[Sat May 24 13:37:19 2008] [debug] ..\..\src\core\transport\http\sender\http_sender.c(415) msg_ctx_id:288b8772-af11-419d-8ed8-1dac29ef2092
[Sat May 24 13:37:19 2008] [error] ..\..\src\core\transport\http\sender\http_sender.c(1367) Error occurred in transport
[Sat May 24 13:37:19 2008] [error] ..\..\src\core\transport\http\sender\http_sender.c(1399) Error occurred in transport
[Sat May 24 13:37:19 2008] [error] ..\..\src\core\engine\engine.c(179) Transport sender invoke failed
[Sat May 24 13:37:19 2008] [error] wsf_wsdl.c(495) [wsf_wsdl] Response envelope not found
[Sat May 24 13:37:19 2008] [info] [rampart][rampart_mod] rampart_mod shutdown
How do I fix this?
Server hasnt read the whole WSDL file
I have just checked the server log file and it seems that the whole WSDL hasnt been read. Following through the debug message, it has only read 3 of my 10 operations and the error log shows the following:
name="cause" type="string" type-namespace="http://www.w3.org/2001/XMLSchema" type-prefix="xsd" simple="yes"/></returns></signature><binding-details soapactio8²íÄ4Þ€1\ % ÐÐ]
and may be this is why it can not find the operation as it has not been loaded by the server.
I have checked my WSDL file and can not see any errors in lt. I think the function that reads in the wsdl file may have had an array overflow or somethinglike that. I think it is in file
wsf_xml_msg_recv.c.
tom
If possible can you send us your wsdl and xsd files and code
Hi,
If possible can you send us your wsdl and xsd files and client service code, which No doubt we can pick the bug or some other problem
Thanks
Dimuthu
OK, what is your email address?
OK, what is your email address?
tom
Attach to the forum
You can attach the file to forum. If you think it should not be public. Can you please send us wsdl with the same strucutre as the original. (you may changed names and remove unnecessory operations)
-Dimuthu
here are the ..
Ok, I have uploaded the files.
tom
The problem is in the wsdl.
The problem is in the wsdl. it misses the namespace declaration
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
So the start of the wsdl you have to have like this
<wsdl:definitions targetNamespace="http://localhost/samples/CxWsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://localhost/samples/CxWsdl"
name="CxWsdl"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:ns1="http://localhost/samples/CxCommon" xmlns:plink="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
I didn't look further, if this still doesn't fix let us know
Thanks
Dimuthu
It didnt work :-(
Hi Dimuthu,
I tried that and modified the wsdl, but got the same error messages. The example I sent is complete, so might be a good idea to run the example and check particularly wsf_xml_msg_recv.c (Line 528) as it seems that the whole WSDL file is not read and because of that the service is not found.
May be the array is not long enough or the file is too big for the variable it is being read to. (just a few suggestions)
tom
function
function GetAgendaList($input)
{
$res = new GetAgendaListRsp();
$agenda = new AgendaType();
$agenda->acidem = "AA";
$agenda->quantity = "22"; // string
$agenda->frecuency = "22"; // string
$agenda->dateIni = 1111111; // long
$agenda->dateEnd = 1111111; // long
$agenda->timeStamp = 999999; // long
$agenda->observations = "Are we there yet";
$agendalist = new AgendaListType();
$agendalist->AgendaList = array($agenda);
$res->myData = "We are there";
$res->AgendaList = $agendalist;
return $res;
}
in client
echo $response->AgendaList->AgendaList[0]->acidem,"<br/"; (note that extra AgendaList)
Worked for me
Great, worked for me too.
Great, tested it and it worked in the browser.
I also ran the test on the tcpmon, but got the following message:
<faultstring>SOAP message does not contain a SOAP envelope element</faultstring>
I used : http://localhost/samples/CxWebService.php for my connection end point and GetAgendaList for my soap action. Have I used the right
tom