Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all 555 articles
Browse latest View live

How add Hotel booking Services to existing Hotel reservation software

$
0
0

hi

i have writen hotel reservation software. and is's installed on some hotels.

i know there are some hotel booking site like :

 http://www.hotelscombined.com/ 

http://tr.hotels.com/

https://agoda.com/

now i want to know how this sites work? how they talk to the hotels around the world?

how can my software connect to these site and the visitors of these sites can reserve my customers hotel?

any suggestion

thanks.


First Data Web Service API Integration Problem

$
0
0

Hi,

I'm trying to use the First Data Global Gateway web service API. I was able to reverence the WSDL file in VS and get the classes to show up. I get the error "Object reference not set to an instance of an object." I can't figure out what I'm doing wrong.

FDGGWSApiOrderService OrderService = new FDGGWSApiOrderService();
        OrderService.Url = @"https://ws.merchanttest.firstdataglobalgateway.com/fdggwsapi/services/order.wsdl";
        OrderService.ClientCertificates.Add(X509Certificate.CreateFromCertFile(ConfigurationManager.AppSettings["Keyfile"]));
        NetworkCredential nc = new NetworkCredential(ConfigurationManager.AppSettings["CredUser"], ConfigurationManager.AppSettings["CredPass"]);
        OrderService.Credentials = nc;
        FDGGWSApiActionRequest ActionRequest = new FDGGWSApiActionRequest();
        RecurringPayment recurring = new RecurringPayment();
        // Sets for new recurring payment
        recurring.Function = RecurringPaymentFunction.install;
        // Info for Recurring Payment
        RecurringPaymentInformation recurinfo = new RecurringPaymentInformation();
        recurinfo.InstallmentCount = "99";
        recurinfo.InstallmentFrequency = "1";
        recurinfo.InstallmentPeriod = RecurringPaymentInformationInstallmentPeriod.year;
        recurinfo.MaximumFailures = "3";
        DateTime date = DateTime.Now;
        string strDate = date.ToString("yyyyMMdd");
        recurinfo.RecurringStartDate = strDate;
        recurring.RecurringPaymentInformation = recurinfo;
        // Card Data
        CreditCardData CardData = new CreditCardData();
        CardData.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.CardNumber, ItemsChoiceType.ExpMonth, ItemsChoiceType.ExpYear, ItemsChoiceType.CardCodeValue };        
        CardData.Items = new string[] { "4111111111111111", "05", "2015", "598" };
        // Next line is where the ERROR occurs
        recurring.TransactionDataType.Item = CardData;
        // Add Billing Address
        Billing BillAddr = new Billing();        
        BillAddr.Name = "Kris Scheppe";        
        BillAddr.Address1 = "3446 Marinatown Ln.";
        //BillAddr.City = txtCcCity.Text;
        BillAddr.City = "Fort Myers";        
        BillAddr.State = "FL";        
        BillAddr.Zip = "33080";
        BillAddr.Country = "US";
        recurring.Billing = BillAddr;
        // Set the Order Id        
        recurring.OrderId = "1590";
        // Set Payment Amount
        Payment charge = new Payment();        
        charge.ChargeTotal = 120.00M;
        recurring.Payment = charge;        
        TransactionDetails txnDetails = new TransactionDetails();        
        txnDetails.OrderId = "21";        
        txnDetails.PONumber = "2106";
        recurring.TransactionDetails = txnDetails;
        FDGGWSAPI.Action action = new FDGGWSAPI.Action();
        action.Item = recurring;
        ActionRequest.Item = action;
        // Get the Response
        FDGGWSApiActionResponse response = null;
        OrderService.FDGGWSApiAction(ActionRequest);
        if (response.ProcessorResponseMessage == "APPROVED")
        {
            MultiView1.SetActiveView(vwSuccess);
        }
        else
        {
            lblError.Text = response.ErrorMessage;
            lblStatus.Text = response.TransactionResult;
            MultiView1.SetActiveView(vwFailure);
        }


Any help you can provide would be appreciated.


Thanks,

its4net

Unable to add WCF service in asp.net Project for implementing Polling Duplex service using silverlight

$
0
0

Hi all,

I m using WCF duplex service to implement Push notifications feature like getting records from database without refreshing it..

Same thing working perfectly fine in Silverlight Application Project..But when I m embedding it in asp.net website 2012 it gives error that

"configuration file is not a valid configuration file for wcf service library" and roll backs the changes..

web.config that allows to add pollingDuplexHttpBinding element in binding section..I m new to WCF so that have much idea..a

same explored many solutions but nothing is helpful..anybody having gud idea please reply back...

exposing WCF via GET method

$
0
0

hi all

i have been struggling with this for a while. i have followed lots of tuturials and basically they are always the same , but mine just doesnt work.

Interface :

    [ServiceContract]
    public interface IRestServiceImpl
    {
        [OperationContract]
        [WebInvoke(Method = "GET",
                    ResponseFormat = WebMessageFormat.Xml,
                    BodyStyle = WebMessageBodyStyle.Wrapped,
                    UriTemplate = "XML")]
        String  DoWorkXML();

        [OperationContract]
        [WebInvoke(Method = "GET",
                    ResponseFormat = WebMessageFormat.Json,
                    BodyStyle = WebMessageBodyStyle.Wrapped,
                    UriTemplate = "JSON")]
        String DoWorkJSON();
    }

Implementation :

    public class RestServiceImpl : IRestServiceImpl
    {
        public String DoWorkXML()
        {
            return "Dados XML";
        }

        public String DoWorkJSON()
        {
            return "Dados JSON";
        }
    }

my webconfig :

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  
  <system.serviceModel>

    <services>
      <service name="RestService.ResServiceImpl" behaviorConfiguration="ServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" contract="RestService.IRestServiceImpl"
                  behaviorConfiguration="web">
          
          
        </endpoint>
      </service>
    </services>
    
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>

      <endpointBehaviors>
        <behavior name="web">
          <webHttp/>
        </behavior>
        
      </endpointBehaviors>
    </behaviors>
    
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    
  </system.serviceModel>
  
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  
</configuration>


1 . as soon as i do the third step (webconfig file) the vs2010 automatic client (the little application vs2010 creates) stops working (gives some error).  

2 - when i go to http://localhost:43658/RestServiceImpl.svc on my browser , i dont have the wsdl option. actualy it states that "Metadata publishing for this service is currently disabled. "

(if i revert webconfig back to the original  1 and 2 works ok)

3 - all the tuturials i followed are to use GET method, so they all say .....goto http://localhost:43658/RestServiceImpl.svc/XML and http://localhost:43658/RestServiceImpl.svc/JSON , but when i try this ( with original webconfig or changed with third step it doesnt matter ) it always returns page not found.

 

what am i doing wrong ?

thks in advanced

rui

URL Redirect from Web Method

$
0
0

I will need to redirect a URL from my Web Method such that when my application calls my web method, it will redirect to the URL contained in my Web Service.

I tried using System.Web.HttpContext.Current.Response.Redirect("url"); However, it compiled properly but doesn't work in my application, instead, it gave me the following error:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="http://www.microsoft.com">here</a>.</h2>
</body></html>

--.

Any other alternatives for it? I really need to redirect an url from my Web Service.

wcf interoperablity

$
0
0

Hi,I have already a web service which is designed to send a list of objects to the client.For the shake of simplicity let's say it's those objects have 2 fields, a description and an image.The web service is configured to send the data in buffered mode,now I need to switch it to streamedResponse.The catch is that the cliend is written in Java.So my question, is a wcf web service using streamedResponse interoperable?I've done my research and came accross some articles that say that wcf streaming to Java cannot be done...

Hosting Wcf Service

$
0
0

Hi everyone,

I hire a server to host my website supporting framework 3.5.

I'm going to use wcf service in my project but I can not access to server settings IIS.

What's the best choice to host my WCF? what about using web service?

Please help me,

thanks

Create delegate mailboxes shortcuts from Exchange Web Service (EWS)

$
0
0

Is it possible to add a shortcut of primary to delegate's outlook menu using Exchange Web Service?  I'm adding it manually (Accouint Settings -> Change Account -> More Settings -> "Advanced" tab)

Just wondering if there's a way to code it.


netmsmqbinding - practical examples

$
0
0
Hello - Can you show me a few practical examples of netmsmqbinding?

basicHttpBinding use case

$
0
0
I found the following description of basicHttpBinding online: "This type of binding exists in new .Net world only to support backward compatibility with ASMX based clients (WS-Basic Profile 1.1). Basic http binding sends SOAP 1.1 messages and is used when there is a requirement for the WCF services to communicate with non WCF based systems. Thus, providing an endpoint with basicHttpBinding makes interoperating with other basic implementations of web services a great choice." Can someone provide a couple of concrete real-world examples of when basicHttpBinding would be used?

sending data in XML format to a webservice

$
0
0

Hi,

I get an error when I send the XML data to a webservice.

I created a webservice and it has an "add" function.

[WebMethod]

public int add(int a, int b)
{
return a+b;
}

I added this webservice as a web reference to the website.

Website has two texboxes which allows user to enter values for a and b, and it has an "add" button .

here is the coed when you click on add button.

protected void Button1_Click(object sender, EventArgs e)
{
int a=Convert.ToInt32(TextBox1.Text);
int b=Convert.ToInt32(TextBox2.Text);
localhost.Service myWebService = new localhost.Service();
int c= myWebService.add(a, b);
TextBox3.Text = c.ToString();

}

This works absolutely fine. I could see the result in the 3rd text box in the website.

Instead of this I need to send the data (i.e the values a and b ) in XML format to the webservice without using SOAP protocol.

int a=Convert.ToInt32(TextBox1.Text);
int b=Convert.ToInt32(TextBox2.Text);
localhost.Service myWebService = new localhost.Service();

string xml_str = "";
string url_str = "";

xml_str = xml_str + "<?xml version='1.0' encoding='UTF-8'?>";
xml_str = xml_str + "<Addition>";
xml_str = xml_str + "<a>" + a.ToString();
xml_str = xml_str + "</a>";
xml_str = xml_str + "<b>" + b.ToString();
xml_str = xml_str + "</b>";
xml_str = xml_str + "<Result>" ;
xml_str = xml_str + "</Result>";
xml_str = xml_str + "</Addition>";

url_str = "http://localhost:57510/WebSite5/Service.asmx";   // THIS IS THE LINK TO WEBSERVICE WHICH HAS THE ADD FUNCTION

WebRequest request = WebRequest.Create(url_str);

byte[] bytes = Encoding.UTF8.GetBytes(xml_str);
request.ContentLength = bytes.Length;

Stream dataStream = request.GetRequestStream();

dataStream.Write(bytes, 0, bytes.Length);

dataStream.Close();

// This snippet to check if the webservice has received the data or not. its returns a 501 error here.

WebResponse webResponse = request.GetResponse();
dataStream = webResponse.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFields = reader.ReadToEnd();
reader.Close();
if (responseFields.ToString() == "SUCCESS") Response.Write("Hurray!");

Can somebody plz tell me

1. If this is the right way to pass XML data?

2. How do I receive the data in the webservice. I just have an add function in the webservice. Does it receive the data automatically? If not, do I have to write any function to recieve the data on the webservice? Also, the add function in the webservice has to be update the result in the XML data. I want XML data as output. 

Asynchronous WCF Method Call From jQuery

$
0
0

Hi all,

First off, I didn't know if this should go in the jQuery section or the WCF section but I'm thinking it's more of a WCF issue than a jQuery issue (I could be wrong).

I've been struggling with an issue where I'm not able to call a function through jQuery when using the Async Pattern in WCF. When  AsyncPattern = True isn't in the contract it works fine but as soon as I put it in the code breaks! It's saying 404 error for the web service call and the web service itself is saying: "Endpoint not found." Please help if you can!

Class:

Imports System.Threading

Public Class AsyncResult(Of T)
    Implements IAsyncResult

    Private _data As T = Nothing

    Public Sub New(ByVal data As T)
        _data = data
    End Sub

    Public ReadOnly Property Data() As T
        Get
            Return _data
        End Get
    End Property

    Public ReadOnly Property AsyncState() As Object Implements System.IAsyncResult.AsyncState
        Get
            Return DirectCast(_data, Object)
        End Get
    End Property

    Public ReadOnly Property AsyncWaitHandle() As WaitHandle Implements System.IAsyncResult.AsyncWaitHandle
        Get
            Throw New Exception("The method or operation is not implemented.")
        End Get
    End Property

    Public ReadOnly Property CompletedSynchronously() As Boolean Implements System.IAsyncResult.CompletedSynchronously
        Get
            Return True
        End Get
    End Property

    Public ReadOnly Property IsCompleted() As Boolean Implements System.IAsyncResult.IsCompleted
        Get
            Return True
        End Get
    End Property
End Class

WCF:

Imports System.IO
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web
Imports System.Threading

<ServiceContract(Namespace:="")>
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerCall, ConcurrencyMode:=ConcurrencyMode.Multiple)>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class ajax
    ' Synchronous
    <OperationContract()> _
    <WebInvoke(RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json)> _
    Public Function BeginTest(ByVal str As String) As String
        Return str
    End Function

    ' Asynchronous
    <OperationContract(AsyncPattern:=True)> _
    <WebInvoke(RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json)> _
    Public Function BeginTest(ByVal str As String, ByVal callback As AsyncCallback, ByVal state As Object) As IAsyncResult
        Return New AsyncResult(Of String)(str)
    End Function

    Public Function EndTest(ByVal result As IAsyncResult) As String
        Dim asyncResult As AsyncResult(Of String) = TryCast(result, AsyncResult(Of String))

        Return asyncResult.Data
    End Function
End Class

jQuery:

$.ajax({
            url: "Services/ajax.svc/BeginTest",
            type: "POST",
            async: true,
            data: '{"str":"' + "Success" + '"}',
            contentType: 'application/json; charset=utf-8',
            success: function (data) {   // success callback
                alert(data.d);
            },
            error: function (error) {   // error callback
                alert("Fail");
            }
        });





Web service help.

$
0
0

Hi there, it is my first time creating a webservice so pardon me for my poor knowledge

I need to retrieve filepaths which is stored in my database by using web service. I tried writing the codes as shown below, but it keeps prompt me saying : not all code paths return a value.

  
    [WebMethod]
    public string getImages(int minutesID) 
    {
        
        SAConnection myConnection = new SAConnection(DB_STR);
        
        string filepath;
        //open the connection 
        myConnection.Open();
        //Create a command object. 
        SACommand myCommand = myConnection.CreateCommand();

        SAParameter prms = new SAParameter();
        prms.SADbType = SADbType.Integer;
        myCommand.Parameters.Add(prms);
        myCommand.Parameters[0].Value = minutesID;
        
        //Specify a query. 
        myCommand.CommandText = "SELECT filePath from attachments WHERE minutesID = ?";

        //Create a DataReader for the command 
        SADataReader reader = myCommand.ExecuteReader();



        while (reader.Read()) 
        {
            filepath = reader.GetString(0);
            filepath = Server.MapPath(filepath);
            
            return filepath;
  
            //imagePath.Add(new String(filepath));
        }

I have another query in mind.

1) Should i return string or an array of string which contains the file path?



generate custom SOAP envelops

$
0
0

Hi i want to generate the soap envelop exactly like below...

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<ECPAh:login xmlns:ECPAh=[destination IP]></ECPAh:login>
<ECPAh:password xmlns:ECPAh=[destination IP]></ ECPAh:password>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<RSM:ReceiveSM xmlns:RSM=[destination IP]>
<message_type></message_type>
<application_id><application_id>
<timestamp></timestamp>
<message_id></message_id>
<language></language>
<message_text></message_text>
<originating_address></originating_address>
<destination_address></destination_address>
<telco></telco>
</RSM:ReceiveSM>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

There is a requirement where the requst and response from the wcf service should be exchanged in the above mentioned SOAP envelop format. How to write the message contract for this kind of requirement

How to apply restrictions like regular expression to the elements of a type which is sent to a web method as an argument of a web service (.asmx)?

$
0
0

I am creating a web service (.asmx), which accepts an C# type as an argument. I need to apply certain regular expression code inside the elements of this type. How i do this in C# type. I am using classic web services, not WCF Services. Below are restiction / conditions i need to apply to the type, so that the consume can see and send data basing on this restriction. Could somebody tell me how to do this? I appreciate your help. Thank you.

<xsd:element name="MW" type="bk:MWDataType" />
<xsd:simpleType name="MWDataType">
 <xsd:restriction base="xsd:string">
     <xsd:pattern value="[0-9]{0,6}\.?[0-9]?[0-9]?[0-9]?[0-9]?" />
 </xsd:restriction>
</xsd:simpleType>


<xsd:element name="DealterID">
 <xsd:simpleType>
   <xsd:restriction base="xsd:string">
     <xsd:maxLength value="30" />
     <xsd:minLength value="1" />
   </xsd:restriction>
  </xsd:simpleType>
</xsd:element>

 <xsd:element name="StartDate" type="bk:Date" />
<xsd:simpleType name="Date">
 <xsd:restriction base="xsd:date">
  <xsd:minInclusive value="1970-01-01" />
 </xsd:restriction>
</xsd:simpleType>

 <xsd:element name="TimeZone" type="bk:DataTypeTimeZone" />
<xsd:simpleType name="DataTypeTimeZone">
  <xsd:restriction base="xsd:string">
    <xsd:pattern value="[AECMP][SDP]T" />
  </xsd:restriction>
</xsd:simpleType>


aggregate datacontracts

$
0
0
Hello - Can you show me an example of an aggregate datacontract? ex - a poco that can be traversed 3 layers deep through dot notation?

Why WCF

$
0
0

Hi

i wanted to know why WCF is used , i have no experience in any kind of service,. please suggest some basic/simple link or article on the topic, so that i can get started. I am going through a MVC application, which is using .SVC file for ever transaction with the database, i dont know why,.

Please help

thanks

cannot view webservice in browser

$
0
0

I am having a webservice in my project which I am not able to view in browser.As I right click the .asmx file & say view browser it shows me the markup .

something like this ....

<%@ WebService Language="C#" CodeBehind="AuthService.asmx.cs" class="EYGM.Web.UI.AuthLaunchers.AuthService" %> 

My service is perfectly fine because when I try to view it on another machine I can see it running. I have searched in web for answers & all I found is to set IIS (reconfigure or remapping). I did all these but to my vain nothing worked.

If anyone has any idea what else can be done, it would be of great help...

Paging via WCF

$
0
0

Hi

I want to know how to do paging using wcf and retrieve using silverlight in WP7.

Thanks in advance.

IIS hosted robot without session timeout ?

$
0
0

Hello,

I have a stock exchange trade robot which needs to run on a hosted webserver as I have limited Internet at home. The robot permanently checks prices and gives buy/sell orders. So the robot works on its own without any user interaction besides the initial start of the Aspx page.

Currently I have it running via IIS7 where a simple Aspx page starts Global.asax, which via Application_Start calls the real trade robot, a  C++/CLI dll. The session timeout of 20min has been removed as the dll loads the Aspx page every 10 min. It works fine so far on different shared hosting providers, the dll runs for hours.

However thats not a very clean solution.

Is there another .NET solution to host a robot via IIS7 ? I cannot afford a dedicated server or VM so it needs to run under IIS7 with shared hosting like all the normal ASP.NET websites do.

Viewing all 555 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>