[Solved]SOAP Request

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

[Solved]SOAP Request

Post by dude81 »

I need to set the following headers

Code: Select all

POST /io_query/queryservice.aspx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: lengthofstring
SOAPAction: "http://teuri.org/queryservice"
before the soap body. How do I do this with soap client class. I need to use soap client class only. I'm unable to send and take a request back. Kindly help

Thanks in advance
Last edited by dude81 on Mon Feb 26, 2007 9:37 pm, edited 1 time in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I'm not sure what soap client class you're using. A link to the source code/tutorial pages would be helpful. To be honest, I don't know a whole lot about SOAP so I personally won't be able to help, but some more information would help others I'm sure.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

I'm using a simple SOAP-PHP5 client class available in PHP5. I cannot use new classes written by many because I've a restriction.

1)Firstly I've an API developed by other team within internal network available in some other location.
They have provided me an several API functions of which I need to use atleast one for first short. All the API's wsdl is written in one wsdl file .(Cannot provide any information of wsdl file details,I've a limitation on that too ).
2)The API function requires an xml string(which is also given) in which I'll be embedding two of the XML param values.
3)Along with the xmlstring I need to send headers as required by the API.
4)The xml string and soap headers use an internal namespace for an internal IP (I doubt this is the culprit killing all my code, but not sure of it).
I used soapClient->_Call(), soapClient->_doRequest(); not sure they are used in right fashion or not

Code: Select all

//Note class is declared above
$client->__soapCall('Getresult',  array(new SoapParam('1 4','user_ids'), new SoapParam('23','server_id')), array('uri'=>'http://uri.org','soapaction'=>'http://uri.org/GetResult')
using client->__doRequest

Code: Select all

$client->__doRequest($string,'http://192.1.1.1/Service/Service.aspx?va=GetResult','http://uri.org/GetResult','1.1')
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

dude81 wrote:I'm using a simple SOAP-PHP5 client class available in PHP5.
That is the php5 soap extension, http://de2.php.net/soap ?

try

Code: Select all

<?php
$client = new SoapClient('http://www.webservicex.net/geoipservice.asmx?WSDL');
$response = $client->GetGeoIP(array('IPAddress'=>'88.72.14.195'));
$georesult = $response->GetGeoIPResult;

echo "<pre>\n";
echo $georesult->IP, "\n";
echo $georesult->CountryName, "\n";
echo "</pre>\n";
?>
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

I've tried this volka, but my service provider asks me to send some headers also. It returned a blank object.
I think becuase I didnt send the headers.
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

:P :P :P SOLVED..My mistake :roll: . I didn't pass the param variable name right

Thanks volka, The thing you posted is what I searched for whole ONE day, I think it needs to be documented or a tutorial on it somewhere in the forum. About SOAP Client usage and SOAP Server Usage. Its not available much on the net.


thanks to all
Post Reply