Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
I Have a PHP Nusoap Problem.
Old 12-16-2009, 10:37 AM I Have a PHP Nusoap Problem.
Novice Talker

Posts: 7
Trades: 0
Hi. I use nusoap client. But have a fault.
Array
(
[faultcode] => soap:server
[faultstring] => Server was unable to process request. ---> Object reference not set to an instance of an object.
[detail] =>
)

Help.please.

My nusoap client php code here.
<?php
$ns
= "https://sonucservis.osym.gov.tr"
;

require_once(
'../lib/nusoap.php');
// nusoap-0.7.3

$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : ''
;
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : ''
;
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : ''
;
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : ''
;
$client = new nusoap_client('https://sonucservis.osym.gov.tr/service.asmx?wsdl', 'wsdl', $proxyhost, $proxyport, $proxyusername, $proxypassword
);

$client->soap_defencoding = 'UTF-8'
;

if (
$err
) {
echo
'<h2>Constructor error</h2><pre>' . $err . '</pre>'
;
}

$header = '<AuthenticationHeader xmlns="'.$ns.'"><KullaniciAdi>......</KullaniciAdi><Sifre>....</Sifre></AuthenticationHeader>'
;
$client->setHeaders($header
);
$err = $client->getError
();

$parameters['parameters']['SinavId'] = "...."
;
$parameters['parameters']['SinavYili'] = "...."
;
$parameters['parameters']['SinavDonemi'] = "...."
;
$parameters['parameters']['TcKimlikNo'] = "....."
;

$result = $client->call('SonucGetir', $parameters, $ns, 'https://sonucservis.osym.gov.tr/SonucGetir', false, true
);

// Check for a fault
if ($client->fault
) {
echo
'<h2>Fault</h2><pre>'
;
print_r($result
);
echo
'</pre>'
;
} else {
// Check for errors
$err = $client->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($client->request, ENT_QUOTES) . '</pre>'
;
echo
'<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'
;
echo
'<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'
;
?>
yorgi17 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-16-2009, 11:11 AM Re: I Have a PHP Nusoap Problem.
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
The error message means you are trying to use the -> operator on a non-object. This commonly occurs when an object is not set correctly and you end up with a reference to null. If I had to guess, I'd say that $client is not being set correctly here:
PHP Code:
$client = new nusoap_client('https://sonucservis.osym.gov.tr/service.asmx?wsdl''wsdl'$proxyhost$proxyport$proxyusername$proxypassword); 
Make sure all the parameters to nusoap_client() are correct.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 12-16-2009, 02:10 PM Re: I Have a PHP Nusoap Problem.
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
The error message means you are trying to use the -> operator on a non-object.
I don't think so, no..
The error string state
Quote:
Server was unable to process request.
And beside, the message
Quote:
Object reference not set to an instance of an object.
is the error .Net returns you when you try to do something on a uninitialized object.

My guess is that there is a problem on the web service itself, not in your code.
But maybe it's the parameters you send, that are in an erroneous format.

You should check their documentation.
Otherwise, what you did not tell us is when this error is triggered?

Is it when you call
PHP Code:
$client = new nusoap_client('https://sonucservis.osym.gov.tr/service.asmx?wsdl''wsdl'$proxyhost$proxyport$proxyusername$proxypassword); 
, when you call
PHP Code:
$client->setHeaders($header); 
or when you call
PHP Code:
$result $client->call('SonucGetir'$parameters$ns'https://sonucservis.osym.gov.tr/SonucGetir'falsetrue); 

__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 12-16-2009 at 02:11 PM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 12-17-2009, 03:24 AM Re: I Have a PHP Nusoap Problem.
Novice Talker

Posts: 7
Trades: 0
Hi.

I believe the way the parameters are correct.
I would send the authentication header information. Then I call the operation by sending string parameters.

request as follows:
Request

POST /service.asmx HTTP/1.0
Host: sonucservis.osym.gov.tr
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "https://sonucservis.osym.gov.tr/SonucGetir"
Content-Length: 735
<?xml version="1.0" encoding="UTF-8"?>
<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:ns9742="https://sonucservis.osym.gov.tr">
<SOAP-ENV:Header>
<AuthenticationHeader xmlns="https://sonucservis.osym.gov.tr">
<KullaniciAdi>sting username</KullaniciAdi>
<Sifre>string password</Sifre>
</AuthenticationHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<SonucGetir xmlns="https://sonucservis.osym.gov.tr/">
<SinavId>string param</SinavId>
<SinavYili>string param</SinavYili>
<SinavDonemi>string param</SinavDonemi>
<TcKimlikNo>string param</TcKimlikNo>
</SonucGetir>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and follows response :

Response

HTTP/1.1 500 Internal Server Error
Date: Thu, 17 Dec 2009 08:21:45 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 441
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request. ---&gt; Object reference not set to an instance of an object.</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>

perhaps related to the use of proxy within nusoap may be a problem?
Thank you for everything.
yorgi17 is offline
Reply With Quote
View Public Profile
 
Old 12-17-2009, 04:32 AM Re: I Have a PHP Nusoap Problem.
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
perhaps related to the use of proxy within nusoap may be a problem?
I am honestly not convinced...
This looks more like a problem on their side, in my opinion.

Did you tried to contact them ?
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 12-17-2009, 05:25 AM Re: I Have a PHP Nusoap Problem.
Novice Talker

Posts: 7
Trades: 0
Dear senders,

I could not reach a solution nusoap.

problem was solved with cURL.

Thank you for your support.

good work.

Yorgi / Turkey
yorgi17 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I Have a PHP Nusoap Problem.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27168 seconds with 12 queries