Hi:
I have gone over the forum searching for any clue from prev posts but couldm't find any. So plz help resolve this simple problem I'm facing with this WSDL and PHP NUSOAP vs 0.7.3 that I'm using. I'm running WinXP, Apache 2, PHP 5.2.
I have no control over the webservice provider as that is 3rd party (and its in alpha so they don't want me to release pvt info is why I've stripped the actual URL - hope you understand) and so the only guide in developing the client for consumption is by following their WSDL below:
I tried to do normal client call as below (with no patch to nusoap.php) at first:
$client = new nusoap_client('http://cool.somewhere.com:5800/coolService/LoginWebService?wsdl', 'wsdl',);
|
It returns - faultcode = env:Client.
Since this did not work, following Sanjeev_any's POST in this forum and your comments, I patched the nusoap.php and added extra params to the client call as seen below but still the same faultcode returning.
Where am I going wrong? What can be done to resolve this? Any help is highly apprecited. Thanks a ton in advance:
Here's the WSDL:
<definitions name='coolService' targetNamespace='http://cool.somewhere.com/services' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://cool.somewhere.com/services' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
<xs:schema targetNamespace='http://cool.somewhere.com/services' version='1.0' xmlns:tns='http://cool.somewhere.com/services' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:element name='loginUser' type='tns:loginUser'/>
<xs:element name='loginUserResponse' type='tns:loginUserResponse'/>
<xs:complexType name='loginUser'>
<xs:sequence>
<xs:element minOccurs='0' name='username' type='xs:string'/>
<xs:element minOccurs='0' name='password' type='xs:string'/>
</xs:sequence>
</xs:complexType>
<xs:complexType name='loginUserResponse'>
<xs:sequence>
<xs:element minOccurs='0' name='returnUserStatus' type='tns:userStatus'/>
</xs:sequence>
</xs:complexType>
<xs:complexType name='userStatus'>
<xs:sequence>
<xs:element minOccurs='0' name='email' type='xs:string'/>
<xs:element minOccurs='0' name='lastname' type='xs:string'/>
<xs:element minOccurs='0' name='pictureUrl' type='xs:string'/>
<xs:element minOccurs='0' name='status' type='xs:string'/>
<xs:element minOccurs='0' name='timestamp' type='xs:dateTime'/>
<xs:element minOccurs='0' name='username' type='xs:string'/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name='cool_loginUser'>
<part element='tns:loginJygyForumUser' name='loginUser'></part>
</message>
<message name='cool_loginUserResponse'>
<part element='tns:loginUserResponse' name='loginUserResponse'></part>
</message>
<portType name='cool'>
<operation name='loginUser' parameterOrder='loginUser'>
<input message='tns:cool_loginUser'></input>
<output message='tns:cool_loginUserResponse'></output>
</operation>
</portType>
<binding name='coolBinding' type='tns:cool'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='loginUser'>
<soap:operation soapAction=''/>
<input>
<soap:body use='literal'/>
</input>
<output>
<soap:body use='literal'/>
</output>
</operation>
</binding>
<service name='coolService'>
<port binding='tns:coolBinding' name='coolPort'>
<soap:address location='http://cool.somewhere.com:5800/coolService/loginWebService'/>
</port>
</service>
</definitions>
|
This is the client code:
require_once('../lib/nusoap.php');
$sclient = new nusoap_client('http://cool.somewhere.com:5800/coolService/LoginWebService?wsdl',"wsdl");
$param = array('username' => 'abcd', 'password' => 'pass');
$result = $sclient->call('loginJygyForumUser', array('parameters' => $param), 'http://cool.somewhere.com/services', '', false, null, 'rpc', 'literal', true);
// Check for a fault
if ($sclient->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $sclient->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($sclient->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($sclient->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($sclient->debug_str, ENT_QUOTES) . '</pre>';
// bye bye client
unset($sclient);
|
Request:
POST /coolService/LoginWebService HTTP/1.0
Host: cool.somewhere.com:5800
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 501
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://cool.somewhere.com/services"><SOAP-ENV:Body><loginUser xmlns=""><username xmlns="">abcd</username><password xmlns="">pass</password></loginUser></SOAP-ENV:Body></SOAP-ENV:Envelope>
|
Response:
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)/Tomcat-5.5
Content-Type: text/xml;charset=UTF-8
Date: Thu, 10 Jul 2008 18:27:07 GMT
Connection: close
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><env:Fault xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><faultcode>env:Client</faultcode><faultstring>Endpoint {http://cool.somewhere.com/services}coolPort does not contain operation meta data for: loginUser</faultstring></env:Fault></env:Body></env:Envelope>
|
I do know that this faultcode means the webservice did not receive an element in the SOAP request message that is mandatory for the WSDL for this Web service. But goiing by the above WSDL, what am I doing wrong. Maybe its downright silly but too much of messing with it has noodled my brain altogether
Plz do take a close look - Thanks again.