IT Community - Software Programming, Web Development and Technical Support

Implementing soap using PHP

This is a discussion on Implementing soap using PHP within the PHP Programming forums, part of the Web Development category; Hi Buddies Here is one simple example to create our own WSDL file PHP Code: <?php # HelloServerWsdl....


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #41 (permalink)  
Old 04-03-2008, 08:59 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi Buddies

Here is one simple example to create our own WSDL file
PHP Code:
<?php # HelloServerWsdl.php
function hello($someone) { 
   return 
"Hello " $someone "! - With WSDL";

   
ini_set("soap.wsdl_cache_enabled""0"); 
   
$server = new SoapServer("http://localhost/Hello.wsdl",
      array(
'soap_version' => SOAP_1_2));
   
$server->addFunction("hello"); 
   
$server->handle(); 
?>
Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #42 (permalink)  
Old 04-03-2008, 09:04 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi Buddies

Above mention code will generate the following WSDL file
Code:
<?xml version="1.0"?>
<definitions name="MyDefinition"  targetNamespace="urn:myTargetNamespace" xmlns:tns="urn:myTns" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
 <message name="myRequest">
  <part name="reqParam" type="xsd:string"/>
 </message>
 <message name="myResponse">
  <part name="resParam" type="xsd:string"/>
 </message>
 <portType name="MyPortType">
  <operation name="hello">
   <input message="tns:myRequest"/>
   <output message="tns:myResponse"/>
  </operation>
 </portType>
 <binding name="MyBinding" type="tns:MyPortType">
  <soap:binding style="rpc"
   transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="hello">
   <soap:operation soapAction=""/>
   <input>
    <soap:body use="encoded"
     namespace="urn:myInputNamespace"
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
   </input>
   <output>
    <soap:body use="encoded"
     namespace="urn:myOutputNamespace"
     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
   </output>
  </operation>
 </binding>
 <service name="MyService">
  <documentation>Returns a greeting string.
  </documentation>
  <port name="MyPort" binding="tns:MyBinding">
   <soap:address
  location="http://localhost/HelloServerWsdl.php"/>
  </port>
 </service>
</definitions>
Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #43 (permalink)  
Old 04-03-2008, 11:20 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

Hi,
Here i wanted to create web services for my login component. How can i proceed?

Any idea?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #44 (permalink)  
Old 04-04-2008, 11:37 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Wink Re: Implementing soap using PHP

Hi

PHP Code:
<?php # LoginServerWsdl.php
function login($username,$password) { 
   
$aResultSet =  checkUser($vUsername,$vPassword);
   
$vResult $aResultSet['Result'];
   if(
$vResult >1)
   {
        
session_register('sesID','sesName','sesTrackID','sesLastLogin');
    
$_SESSION['sesID'] = $vID;
    
$_SESSION['sesName'] = $vName;
    
$_SESSION['sesTrackID'] = $vTrackID;
    
$_SESSION['sesLastLogin'] = $vLastLogin;
   }

   
ini_set("soap.wsdl_cache_enabled""0"); 
   
$server = new SoapServer("http://localhost/login.wsdl",
      array(
'soap_version' => SOAP_1_2));
   
$server->addFunction("login"); 
   
$server->handle(); 
?>
I think this sample code will help you to create the login wsdl file for your site

Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #45 (permalink)  
Old 04-04-2008, 11:51 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

Hi,
Thanks for the reply.
where can we actually place wsdl document file on web server for a new web service?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #46 (permalink)  
Old 04-07-2008, 08:43 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi

You no need to give any particular location. You can place any where in your website. WSDL will placed in location as per your mention location while creating the object like $server = new SoapServer("http://localhost/login.wsdl", array('soap_version' => SOAP_1_2));

Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #47 (permalink)  
Old 04-09-2008, 03:16 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

hi,
Thanks for the reply.
is it needed to have any dll or exe to install as soap server?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #48 (permalink)  
Old 04-09-2008, 08:53 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi

Following DLL and EXE files are need to install the Soap Server
  • The SOAP server. (wmsoapsvc.exe)
  • The WSDL Client support component (wmwsdlclient.dll)
  • The SOAP struct support component (wmsoapstruct.dll)
  • The SOAP message support component (wmsoapmsg.dll)
  • The C++ control panel application. (wmsoapsvccp.exe)
  • The browser based control panel application. (cp_app.htm)
  • The SOAP 1.1 interop test suite components. (interopsvc.dll, interopsvcB.dll, interopsvcDoc.dll)
  • The browser based SOAP 1.1 interop test suite clients. (interop_index.htm)
  • The SOAP 1.2 Test Collection components. (soap12test*.dll)
  • The browser based SOAP 1.2 Test Collection clients. (soap12-test-index.htm)
  • The browser based SOAP 1.1 and 1.2 "rpc/literal" test clients. (rpc-lit-test-index.htm)
  • A header processor component for echoing SOAP message header entries back to the sender for test purposes. (wmechoheader.dll)
  • A header processor component supporting the Web Services Routing Protocol. (wmwsrouter.dll)
  • A browser based client for exercising the Web Services Routing Protocol. (echoString_ws-rp.htm)
  • A header processor service supporting the SOAP Digest Authentication Scheme. (wmsoapauthsvc.exe)
  • Browser based clients for exercising the SOAP Digest Authentication Scheme. (echoStringAuthA.htm, echoStringAuthB.htm)
  • The C++ DIME test client application. (echofile.exe)
  • The DIME test suite components. (interopsvcdimerpc.dll, interopsvcdimedoc.dll, echofilesvc.dll, echofilehdr.dll)
  • A directory containing the WSDL files for the various services.
Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #49 (permalink)  
Old 04-09-2008, 08:58 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi,

Following steps are necessary to install the Apache soap Server
  1. Download a version of Apache SOAP from the Apache XML pages. I downloaded the version 2.2 binary for these tests. You must use 2.2 or later to follow these instructions.
  2. Unzip the downloaded file. I unzipped to j:\, which put everything in the j:\soap-2_2 directory.
  3. Install Apache SOAP as a Tomcat Web application by running
    • j:
    • cd \jakarta-tomcat-4.0.1\bin
    • shutdown
    • cd \jakarta-tomcat-4.0.1\webapps
    • mkdir soap
    • cd soap
    • jar -xvf j:\soap-2_2\webapps\soap.war
    • cd \jakarta-tomcat-4.0.1\bin
    • startup
  4. Test that Apache SOAP is installed by pointing your browser to http://localhost:8080/soap/index.html. You should get a page saying "Hello! Welcome to Apache-SOAP."
  5. Further test that Apache SOAP is installed by pointing your browser to http://localhost:8080/soap/servlet/rpcrouter. You should get a page saying "Sorry, I don't speak via HTTP GET- you have to use HTTP POST to talk to me."
Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #50 (permalink)  
Old 04-09-2008, 11:09 PM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

Hi,
Thanks for the reply for installation on SOAP server.

How can SOAP application be differentiated with normal CURL functions?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #51 (permalink)  
Old 04-15-2008, 09:06 PM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi

Curl function return all the content of the page in String but SOAP return only the particular content like only the search results in XML format. Second thing we have to explode the string to get URL,TITLE DESCRIPTION etc in CURL function but In SOAP they are gave all the details in separate tags it is easy to get that details

Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #52 (permalink)  
Old 04-16-2008, 02:30 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

hi,
So CURL is any way have differed lot from SOAP.

While using with CURL, it is needed to have permission to read data from other servers?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #53 (permalink)  
Old 04-17-2008, 05:24 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi

While using CURL functions,we no need to get permission to read data from other servers.For SOAP only we need permission from that particular server.It also depends up on the site and WSDL only

Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #54 (permalink)  
Old 04-17-2008, 07:55 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

hi,
thanks for the reply. can we read the files if they set any permission for reading through CURL?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #55 (permalink)  
Old 04-21-2008, 03:33 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi

If there are any authentication set for a page then we cant get the details of that page otherwise we can get the details of that page

Regards
Falcon

Last edited by Falcon : 04-21-2008 at 03:49 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #56 (permalink)  
Old 04-22-2008, 01:45 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

Hi,
I think that is correct. I think we can get the HTML versions of the content via CURL functions. Am i right?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #57 (permalink)  
Old 04-23-2008, 01:24 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi

Yes your are right that curl function tooks only the HTML version of that content. Its wont get the complete details. if a page is developed with the javascript Ajax functions. It wont get the content of that page.

Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #58 (permalink)  
Old 04-25-2008, 03:08 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Implementing soap using PHP

Hi,
can u please provide me example in curl function in Php?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #59 (permalink)  
Old 05-02-2008, 03:54 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Implementing soap using PHP

Hi

Here is one sample code for the Curl function
PHP Code:
$vUrl="www.test.com";
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,$vUrl);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
$this->content=curl_exec($ch);
curl_close($ch); 
Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Implementing Role Based Security in ASP.NET S.Vinothkumar C# Programming 13 04-02-2008 04:53 AM
SOAP with Example... amansundar XML and SOAP 4 03-20-2008 11:41 PM
Soap in php venkatbi PHP Programming 10 09-26-2007 09:26 AM
What are the primary considerations when implementing a user defined key? oxygen Java Programming 1 07-26-2007 04:52 AM
Implementing Crystal Report in Web Application oxygen C# Programming 0 07-15-2007 11:40 PM


All times are GMT -7. The time now is 02:22 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.