<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Calling WebService in PHP &#8211; Sibeesh Passion</title>
	<atom:link href="https://mail.sibeeshpassion.com/tag/calling-webservice-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>https://mail.sibeeshpassion.com</link>
	<description>My passion towards life</description>
	<lastBuildDate>Fri, 17 Jul 2015 12:52:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>/wp-content/uploads/2017/04/Sibeesh_Passion_Logo_Small.png</url>
	<title>Calling WebService in PHP &#8211; Sibeesh Passion</title>
	<link>https://mail.sibeeshpassion.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Calling an ASMX Web Service From Other Server Using jQuery and PHP</title>
		<link>https://mail.sibeeshpassion.com/calling-an-asmx-web-service-from-other-server-using-jquery-and-php/</link>
					<comments>https://mail.sibeeshpassion.com/calling-an-asmx-web-service-from-other-server-using-jquery-and-php/#disqus_thread</comments>
		
		<dc:creator><![CDATA[SibeeshVenu]]></dc:creator>
		<pubDate>Sun, 29 Dec 2013 19:25:46 +0000</pubDate>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Calling WebService in PHP]]></category>
		<category><![CDATA[WebService]]></category>
		<guid isPermaLink="false">https://sibeeshpassion.com/?p=681</guid>

					<description><![CDATA[Introduction A few months back, I got a requirement to fetch some inventory data from a server and show it to an HTML page. The interesting fact was the client server (the one that I want to show the data in) does not support .Net files. If did support them then we could directly add the web references and display the data. So what to do? I tried JSONP and Angular JSON but I could not make it to work. Then I came up with an idea. Here, I have: A web service that gets the data from the SQL [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><span style="color: #ff6600;">Introduction</span></p>
<p>A few months back, I got a requirement to fetch some inventory data from a server and show it to an HTML page. The interesting fact was the client server (the one that I want to show the data in) does not support .Net files. If did support them then we could directly add the web references and display the data. So what to do? I tried JSONP and Angular JSON but I could not make it to work. Then I came up with an idea.</p>
<p>Here, I have:</p>
<li>A web service that gets the data from the SQL Server 2008 DB in HTML format.</li>
<li>One HTML file where we need to show the data.</li>
<li>jQuery latest version JavaScript file.</li>
<p><span style="color: #ff6600;">Using the code</span></p>
<p>So let’s start</p>
<p><em>Make an HTML table in the file like the following:</em><br />
[html]<br />
&lt;table id=&quot;“inventory”&quot;&gt;<br />
&lt;tbody&gt;<br />
&lt;tr id=&quot;“maintr”&quot;&gt;<br />
&lt;th&gt;LOCATION&lt;/th&gt;<br />
&lt;th&gt;20 GP&lt;/th&gt;<br />
&lt;th&gt;40 FC&lt;/th&gt;<br />
&lt;th&gt;40 GP&lt;/th&gt;<br />
&lt;th&gt;40 OT&lt;/th&gt;<br />
&lt;th&gt;40 HCGP&lt;/th&gt;<br />
&lt;/tr&gt;<br />
&lt;/tbody&gt;<br />
&lt;/table&gt;<br />
[/html]</p>
<p>Add the JQuery reference.<br />
[js]<br />
&lt;script src=&quot;“js/jquery-1.9.1.js”&quot; type=&quot;“text/javascript”&quot;&gt;&lt;/script&gt;Add the styles to the table:<br />
[/js]</p>
<p>Add the following Scripts to get the data from the web service:<br />
[js]<br />
&lt;script type=&quot;“text/javascript”&quot;&gt;// &lt;![CDATA[<br />
        var gp20;<br />
        var gp40;<br />
        var fc40;<br />
        var ot40;<br />
        var hcgp40;<br />
        $(document).ready(function () {<br />
            $(“#accordion”).accordion();<br />
            $.post(“RetWS.php”, {<br />
                action: “test”<br />
            },<br />
            function (data) {<br />
                var className;<br />
                var i = 0;<br />
                var xdoc = $.parseXML(data),<br />
                $xml = $(xdoc);<br />
                $($xml).find(‘AvailableSaleUnitsDetail’).each(function () {<br />
                    if (i % 2 != 0) {<br />
                        className = ‘alt’;<br />
                    }<br />
                    else {<br />
                        className = ‘normal’;<br />
                    }<br />
                    if (parseInt($(this).find(‘_x0032_0GP’).text()) &gt; 50) {<br />
                        gp20 = ’50 +’;<br />
                    }<br />
                    else {<br />
                        gp20 = $(this).find(‘_x0032_0GP’).text();<br />
                    }<br />
                    if (parseInt($(this).find(‘_x0034_0FC’).text()) &gt; 50) {<br />
                        fc40 = ’50 +’;<br />
                    }<br />
                    else {<br />
                        fc40 = $(this).find(‘_x0034_0FC’).text();<br />
                    }<br />
                    if (parseInt($(this).find(‘_x0034_0GP’).text()) &gt; 50) {<br />
                        gp40 = ’50 +’;<br />
                    }<br />
                    else {<br />
                        gp40 = $(this).find(‘_x0034_0GP’).text();<br />
                    }<br />
                    if (parseInt($(this).find(‘_x0034_0OT’).text()) &gt; 50) {<br />
                        ot40 = ’50 +’;<br />
                    }<br />
                    else {<br />
                        ot40 = $(this).find(‘_x0034_0OT’).text();<br />
                    }<br />
                    if (parseInt($(this).find(‘_x0034_0HCGP’).text()) &gt; 50) {<br />
                        hcgp40 = ’50 +’;<br />
                    }<br />
                    else {<br />
                        hcgp40 = $(this).find(‘_x0034_0HCGP’).text();<br />
                    }<br />
                    $(“#inventory”).append(“</p>
<p>&lt;tr class=” + className + ” &gt;<br />
&lt;td id=” + $(this).find(‘Location’).text() + “&gt;” + $(this).find(‘Location’).text() + “&lt;/td&gt;<br />
&lt;td&gt;” + gp20 + “&lt;/td&gt;<br />
&lt;td &gt;” + fc40 + “&lt;/td&gt;<br />
&lt;td&gt;” + gp40 + “&lt;/td&gt;<br />
&lt;td &gt;” + ot40 + “&lt;/td&gt;<br />
&lt;td &gt;” + hcgp40+ “&lt;/td&gt;<br />
&lt;/tr&gt;<br />
”);                    i++;<br />
                });<br />
            })<br />
        });</p>
<p>// ]]&gt;<br />
&lt;/script&gt;<br />
[/js]</p>
<p>Here, <em>RetWS.php</em> is my PHP file that actually gets the data from an asmx web service from another server.</p>
<p>In the <em>RetWs.php</em> you can do the following codes:<br />
[php]<br />
&lt;!&#8211;?php if(isset($_POST[‘action’]) &amp;amp;&amp;amp; !emptyempty($_POST[‘action’])) {     $action = $_POST[‘action’];     switch($action) {         case ‘test’ : doWebService();         break;     } } function doWebService() {   $client = new SoapClient(“http://Here paste link to your webservice”);   echo $client-&amp;gt;getInventoryForWs()-&amp;gt;getInventoryForWsResult;&amp;lt;br ?&#8211;&gt; }<br />
?&amp;gt;<br />
[/php]</p>
<p>The link may look like:</p>
<p><em>http://www.something.com/Reports/Marketing/Mywebservice.asmx?WSDL</em><br />
Make sure that there are no spelling mistakes.</p>
<p>Kindest Regards<br />
Sibeesh Vennu</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mail.sibeeshpassion.com/calling-an-asmx-web-service-from-other-server-using-jquery-and-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
