Showing posts with label Web Service. Show all posts
Showing posts with label Web Service. Show all posts

Tuesday, May 17, 2011

Test Your webservice/WCF service in Network


Today i found a interesting solution for an interesting problem.

i have created a WCF service in .NET Framework 3.5 to be used by PHP developers.
We have decided to test the service before going forward, for that we have planned to launch it on web servers but, i found there was 2.0 framework installed on my web server and my service is built on framework 3.5 (it was not good time to play with web server). So i decided to expose my WCF service from my system only. To do so i setup it on my local server on port 70. but it was not available from other computers on network. So i got a trick to solved this problem.

Solution:
- I downloaded Microsoft SOAP Toolkit version 3 and started MSSoapT (Trace Utility),
then i created a formatted trace listening on port 8080
to do so, i gone throw these steps:
-- File->New->Formatted Trace. it opened a dialog box and i filled the following values in it.
-- Local port= 8080
-- in forward to section, Destination Host= 127.0.0.1 (remove text localhost)
-- port = 70 (my WCF service port number).

Now click ok and its DONE... :)
now every one from my LAN can use this service by url like http://MySystemIP:8080/myservicename.svc

So what we have done is we have used port forwarding technique to expose our WCF services in network. so when user will access port 8080, the request will be forwarded to my service's port 70.


Compiled By: Rajesh Rolen

Read More

Wednesday, April 20, 2011

What is DISCO?

XML Web service discovery is the process of locating and interrogating XML Web service descriptions. Potential XML Web service clients can learn that an XML Web service exists and how to interact with it by performing a discovery. The .discomap file that is published by an XML Web service is an XML document that typically contains links to other resources that describe the XML Web service. Web sites that implement an XML Web service are not required to support discovery. An XML Web service might be created for private use.

The .wsdl, .xsd, .disco, and .discomap files produced by this tool can be used as input to the Web Services Description Language Tool (Wsdl.exe) to create XML Web service clients.

References:http://msdn.microsoft.com/en-us/magazine/cc302073.aspx

Compiled By Rajesh Rolen

Read More

What is WSDL?

SDL stands for Web Services Description Language.

WSDL is a document written in XML. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes.

Compiled by Rajesh Rolen

Read More

Friday, September 10, 2010

What is procedure to host WCF webservices

WCF is a flagship product from Microsoft for developing distributed application using SOA. Prior to WCF traditional ASMX Web services were hosted only on Internet Information Services (IIS). The hosting options for WCF services are significantly enhanced from Microsoft .NET Framework 3.0 onwards. In WCF there are three main parts: Service, Endpoints and Hosting Environment. Multiple services can be hosted using a single host process and also the same service type can be hosted in multiple host processes. We can host a WCF service in two ways - Self Hosting and IIS Hosting. Here we will examine Self Hosting along with a comparative discussion of different hosting environments.

elf Hosting Vs IIS Hosting


Let’s look at  the differences between the two hosting types
available for a WCF service.


































Self-Hosting



IIS Hosting



Needs to add code to host the process



Automatic hosting



Host process should be running before client makes a call to the
service.


 




IIS host runs automatically when a client makes a call to the
service.


 




Automatic process recycling not possible



Automatic process recycling not possible




Can   controlled the service lifetime using Open and Close methods



Lifetime cannot be controlled manually.



Easy to deploy



More difficult deployment than  Self-Hosting



 


Protocols Supported































IIS6



http, wshttp



IIS7



HTTP,net.tcp,net.pipe,net.msmq



Windows
console and form application



HTTP,net.tcp,net.pipe,net.msmq



Windows
service



HTTP,net.tcp,net.pipe,net.msmq



WAS



HTTP,net.tcp,net.pipe,net.msmq










Steps to host WCF services



This is the Procedure to host and publish your Website : 1-Change the EndPoints in ServiceReferences.ClientConfig and any where there are Endpoints to
2-Right Click Project.Web and then select (Publish) :
a-Publish method :FTP
b-Target Location :any Folder(X)

3-When you have Images and ect.. you should all put in ClientBin in your (X) Folder

4-Configure your IIS >> Add the MIME types Like this >>>
http://www.longhorncorner.com/UploadFile/nipuntomar/ConfiguringIISSilverlight10022008234540PM/ConfiguringIISSilverlight.aspx

5-Add your Publish Folder to C:\Inetpub\wwwroot

6 >>

1. Open IIS
2. Expand Sites
3. Right click on Default Web Page and select "Add New Virtual Directory" option
4. In the opened pop-up window input "Alias" as Test and populate "Physical path" with C:\Inetpub\wwwroot\TestApp and click "OK"
5. Right click on the created virtual directory (Test) and select "Convert To Application" option from the content menu.
6. In the opened pop-up window make sure you have selected by clicking the "Select..." button Classic .NET AppPool in "Application pool". Click "OK".


7-Copy the clientAccessPolicy.xml and crossDomain.xml to your C:\Inetpub\wwwroot folder.

a-clientAccessPolicy.xml:















b-crossDomain.xml :








8-In your Sql Server , Give IIS Users Permissions to Access your Database.

Solution by:

Rajesh Rolen

Read More

Tuesday, December 29, 2009

Use HostelsClub Search Web-Service in ASP.NET

HostelsClub is one of the worlds larges search engine to search hotels, hostels, rooms and also provide booking of it. so if you want to integrate such a functionality in your website then you will have to take authentication from hostelclub and he will provide you Authentication id and password for Test (free of cost) and later you can upgrade to "Production" version (it will take some percentage in booking cost's profit).

HostelsClub provides you API Library and sample application in PHP to get connect with hostelsclub. But they don't have any API Library or application in ASP.NET. so if you want to do this, below sample can help you.

Through this sample you can PING the hostelsclub web-service search engine.


string targetUri = "http://www.hostelspoint.com/xml/xml.php";
System.Xml.XmlDocument reqDoc = new System.Xml.XmlDocument();
reqDoc.Load(Server.MapPath("~\\ping.xml"));//this is your xml file which u want to send to hostelsclub for ping
string formParameterName = "OTA_request";
string xmlData = reqDoc.InnerXml;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(targetUri);
string sendString = formParameterName + "=" + HttpUtility.UrlEncode(xmlData);
//string sendString = HttpUtility.UrlEncode(xmlData);

byte[] byteStream;
byteStream = System.Text.Encoding.UTF8.GetBytes(sendString);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteStream.LongLength;

using (Stream writer = request.GetRequestStream())
{
writer.Write(byteStream, 0, (int)request.ContentLength);
writer.Flush();
}

HttpWebResponse resp = (HttpWebResponse)request.GetResponse();
string respStr = "";
if (request.HaveResponse)
{
if (resp.StatusCode == HttpStatusCode.OK || resp.StatusCode == HttpStatusCode.Accepted)
{
StreamReader respReader = new StreamReader(resp.GetResponseStream());
respStr = respReader.ReadToEnd(); // get the xml result in the string object

XmlDocument doc = new XmlDocument();
doc.LoadXml(respStr);
Label1.Text = doc.InnerXml.ToString();


}
}

//===================PING.XML=======================
< ?xml version="1.0" encoding="UTF-8"? >
< OTA_PingRQ xmlns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05OTA_PingRQ.xsd" TimeStamp="2009-12-28T11:43:43-05:00" Target="Test" Version="1.006" PrimaryLangID="en" EchoToken="1" >
< EchoData >Hello World< /EchoData >
< /OTA_PingRQ >

Read More

How to send/recive XML file through HTTP Post

If you want to send a XML file through HTTP using POST to any web service which may /may not build in .net. this example can help u:
string targetUri = "http://www.targeUrl.com";
System.Xml.XmlDocument reqDoc = new System.Xml.XmlDocument();
reqDoc.Load(Server.MapPath("~\\myfile.xml"));//xml file which you want to send
string formParameterName = "OTA_request";//request type
string xmlData = reqDoc.InnerXml;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(targetUri);
string sendString = formParameterName + "=" + HttpUtility.UrlEncode(xmlData);
//string sendString = HttpUtility.UrlEncode(xmlData);

byte[] byteStream;
byteStream = System.Text.Encoding.UTF8.GetBytes(sendString);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteStream.LongLength;

using (Stream writer = request.GetRequestStream())
{
writer.Write(byteStream, 0, (int)request.ContentLength);
writer.Flush();
}

HttpWebResponse resp = (HttpWebResponse)request.GetResponse();
string respStr = "";
if (request.HaveResponse)
{
if (resp.StatusCode == HttpStatusCode.OK || resp.StatusCode == HttpStatusCode.Accepted)
{
StreamReader respReader = new StreamReader(resp.GetResponseStream());
respStr = respReader.ReadToEnd(); // get the xml result in the string object

XmlDocument doc = new XmlDocument();
doc.LoadXml(respStr);
Label1.Text = doc.InnerXml.ToString();


}
}
Read More
Powered By Blogger · Designed By Seo Blogger Templates