 |
07-04-2008, 08:57 AM
|
Soap and php help
|
Posts: 9
|
I am confused regarding how to extract data using PHP from SOAP WSDL
I have written following code and don't know what to do further
Code:
<?php
require_once('inc/nusoap-0.7.3/nusoap.php');
$params = array('company_id' => 'COM-000001');
$wsdl= "http://www.nepalsharemarket.com/JambDataService/PremiumService.asmx?WSDL";
$soap = new soapclient($wsdl); //nusoap_client
$result = $soap->__soapCall('getMarketDetails',$params);
print_r ($result);
?>
Here is the Soap Request and Response Sample
Code:
http://www.nepalsharemarket.com/JambDataService/PremiumService.asmx?op=getMarketDetails
Here is the SOAP WSDL
Code:
http://www.nepalsharemarket.com/JambDataService/PremiumService.asmx?WSDL
|
|
|
|
07-08-2008, 03:21 AM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
Saw your post on that other forum. Should stick with this one.
After your SOAP call, what does print_r ($result); show?
What it shows will help you to read the information returned. You can access the results using $result->name_from_print_r_output . Post that code here and I can provide some assistance if you don't understand what this means.
|
|
|
|
07-08-2008, 07:47 AM
|
Re: Soap and php help
|
Posts: 9
|
it output following result
Quote:
|
stdClass Object ( [getMarketDetailsResult] => stdClass Object ( [schema] => [any] => ) )
|
what should I do now ?
|
|
|
|
07-08-2008, 12:34 PM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
Well, that shows that you could access these 2 variables:
$result->getMarketDetailsResult->scheme
and
$result->getMarketDetailsResult->any
Problem is that they're empty. When I visited the URL directly it made it sound like it was some kind of proprietary system for which you had to pay for access. Be sure that that part is setup correctly and then contact them if you can't get any information.
|
|
|
|
07-08-2008, 12:37 PM
|
Re: Soap and php help
|
Posts: 1
Name: Jane
|
You'll have include in your file the library. Just search the library in Google. Then you will have to use the client configuration to create the request. Basically the information will go back to you as a matrix (multiple array). What other questions do you have? I have something else to say, I will recommend you to use xml-rpc since is a lot more easy to use and with the same results!
|
|
|
|
07-08-2008, 12:43 PM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
Welcome to the forum tamesis.
The problem experienced is not in executing the SOAP call as far as I can tell.
You can see in my post above the proper way to retrieve the results. They do not come back as a matrix (which does not exist in PHP) or an array, but as objects. How do I know? Because in the output, it says "stdClass Object" which is a generic object which simply has properties and no methods.
When using SOAP as a protocol, it isn't possible to just switch over to XML-RPC AFAIK. They're different communication protocols. I had to use SOAP for FedEx one time. A true *****. XML-RPC is, as you say, a lot more easy to use.
|
|
|
|
07-08-2008, 02:08 PM
|
Re: Soap and php help
|
Posts: 9
|
Quote:
Originally Posted by JeremyMiller
Well, that shows that you could access these 2 variables:
$result->getMarketDetailsResult->scheme
and
$result->getMarketDetailsResult->any
Problem is that they're empty. When I visited the URL directly it made it sound like it was some kind of proprietary system for which you had to pay for access. Be sure that that part is setup correctly and then contact them if you can't get any information.
|
The developer of the system told me that the feed only requires one parameter (company_id) and nothing else so I think it doesn't need any authentication.
so what should I do now?
|
|
|
|
07-08-2008, 02:23 PM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
Quote:
Originally Posted by JeremyMiller
...then contact them if you can't get any information.
|
If you're sending the right data and receiving an empty response, then you need to check that things are setup correctly on their end.
|
|
|
|
07-08-2008, 02:26 PM
|
Re: Soap and php help
|
Posts: 9
|
Quote:
Originally Posted by JeremyMiller
If you're sending the right data and receiving an empty response, then you need to check that things are setup correctly on their end.
|
then I should contact them right?
and furthermore I wanted to know if the code I am using above is correct ?
Last edited by thapame : 07-08-2008 at 02:30 PM.
|
|
|
|
07-08-2008, 02:28 PM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
Try reading my post silly. I've said it twice already.  Maybe you're stressing a bit much?
|
|
|
|
07-10-2008, 07:43 AM
|
Re: Soap and php help
|
Posts: 9
|
After talking with them now I have soap based xml which will response on array after the service is called with the company_id as a parameter.
The localtion for soap based xml is http://www.nepalsharemarket.com/Jamb...etDetailsArray and the paramater that must be passed is "company_id"
The result from array will be following:
0=Open
1=High
2=Low
3=Close
4=Traded Date
So now what should I do now,
is it the same as SOAP WSDL?? sorry to bother everyone but I am newbie on SOAP.
JeremyMiller, can you help me out regarding what to do next on coding
?
thanks
 
|
|
|
|
07-10-2008, 01:58 PM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
Quote:
Originally Posted by thapame
and furthermore I wanted to know if the code I am using above is correct ?
|
You added that after my post so I was never notified that a post was made. The code appears to be right, but I'm no super versed in SOAP
And, you're not a bother by asking questions here -- that's what the forum is for.  Most who ask questions here are noobs.
I'd have to see the print_r for a successful data fetch to be able to tell you how to access the information.
Finally, did you give me negative TP? If so, for what reason? There's a bluish box instead of green next to yours. Yours is the only bluish one, so I'm not sure what that means.
|
|
|
|
07-10-2008, 02:12 PM
|
Re: Soap and php help
|
Posts: 9
|
Quote:
|
I'd have to see the print_r for a successful data fetch to be able to tell you how to access the information.
|
Thanks let me know if you are able to fetch the data.
Quote:
|
Finally, did you give me negative TP? If so, for what reason? There's a bluish box instead of green next to yours. Yours is the only bluish one, so I'm not sure what that means.
|
Nope JeremyMiller, why should I give you negative TP?? But instead of that I gave you Positive TP because one of the reply you gave here really help me and I am sure further reply may help me too. So could you check once again and make sure regarding the TP. I have only given you the Positive TP.
Thanks
|
|
|
|
07-10-2008, 05:21 PM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
Thanks about the TP. It's probably me just not knowing how to read the report.
I can't execute your code: I don't have your customer id and you should not provide it for security reasons.
You'll have to execute it with your code and tell me what the results are so that I can show you how to access it. I'm unable to help you connect to them other than how you're doing it. If the customer id is getting sent correctly then you should be getting back the desired result -- unless I'm missing something.
|
|
|
|
07-10-2008, 05:36 PM
|
Re: Soap and php help
|
Posts: 9
|
Hi,
I am too much confused.
They have now provided me a link that returns data in an array and I think it's not WSDL file. Correct me if I was wrong.
I also heard that PHP 5 does support SOAP programming but don't know how to start on
Now I have following code:
Code:
<?php
require_once('inc/nusoap-0.7.3/nusoap.php');
$params = array('company_id' => 'XXXXXXXXX');
$wsdl= "http://www.nepalsharemarket.com/JambDataService/PremiumService.asmx?op=getMarketDetailsArray";
$soap = new soapclient($wsdl); //nusoap_client
$result = $soap->__soapCall('getMarketDetails',$params);
print_r ($result);
?>
and this code product following error
Quote:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.nepalsharemarket.com/JambDataService/PremiumService.asmx?op=getMarketDetailsArray' in G:\soap_test\test.php:6 Stack trace: #0 G:\soap_test\test.php(6): SoapClient->SoapClient('http://www.nepa...') #1 {main} thrown in G:\soap_test\test.php on line 6
|
|
|
|
|
07-10-2008, 06:03 PM
|
Re: Soap and php help
|
Posts: 9
|
Hi JeremyMiller,
I think I am in a good luck now.
Finally I got this result
Quote:
|
stdClass Object ( [getMarketDetailsArrayResult] => stdClass Object ( [string] => Array ( [0] => [1] => [2] => [3] => [4] => ) ) )
|
Now how to print them.
|
|
|
|
07-10-2008, 10:00 PM
|
Re: Soap and php help
|
Posts: 984
Name: Jeremy Miller
Location: Reno, NV
|
I believe these should access the results, though what you've written is empty.
$result->getMarketDetailsArrayResult->string[0]
$result->getMarketDetailsArrayResult->string[1]
$result->getMarketDetailsArrayResult->string[2]
$result->getMarketDetailsArrayResult->string[3]
$result->getMarketDetailsArrayResult->string[4]
|
|
|
|
07-10-2008, 10:31 PM
|
Re: Soap and php help
|
Posts: 2,320
Name: Keith Marshall
Location: West Hartford, CT
|
Quote:
Originally Posted by JeremyMiller
Finally, did you give me negative TP? If so, for what reason? There's a bluish box instead of green next to yours. Yours is the only bluish one, so I'm not sure what that means.
|
The bluish TP is when someone doesn't have any TP giving power, but they were in favor of your help. Negitive TP shows red.
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
07-10-2008, 10:33 PM
|
| |