Search Results

Search found 645 results on 26 pages for 'webservices'.

Page 20/26 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • How to implement a .net 3-tier architecture using Winforms

    - by Anders Jakobsen
    I have for some time build n-tier Applications using a database server as the data tier, Winforms as the presentation tier and an ASP.NET asmx webservice in the middle to send back and forth untyped Datasets. While this approach has worked for me so far, it certainly does feel outdated today. What technologies should I use if I were to create a similar architectured application today? .net 4.0 technology is welcome. I still want a database server as the datatier and the asmx webservices should probably be replaced by WCF. I would still like to have the presentation tier running as a desktop application (Winforms or WPF) so ignore ASP.net for this question. My main question really comes down to what to use as business objects. I want something that is easier to bind to the interface than untyped Datasets and strongly-typed datasets feels very heavy. I also need something that can track changes to make sure users do not override each other's changes in the database. Will the Entity Framework 4 be usable for a scenario like this? Are there any thorough guides available?

    Read the article

  • How to write an iphone application to control a device that exposes a telnet api

    - by MAC
    Hi! I have to write an iphone application that controls a device. This device exposes a telnet based interface. The application should ideally have user access control and customizability for each user. I was thinking of writing C++ classes that would communicate with the device using sockets. This functionality can then be exposed through web-services that can be called by the iphone application. However as i looked into it deeper, the api allows you to register for events using telnet and then you can receive notification when those events occur. That kinda put a spanner in the works for me. I for one dont know a "push" scenario can work with webservices. First off i have never programmed for the iphone so far. So i am not really sure what can be done. So i was thinking if instead of having a webserver to go through, why not have the application independently running on the iphone, directly communicating with the device using sockets. The question though is, is that possible and second i am thinking it would raise a security aspect. First we could control security as everything was going through our central server. Is there a way to handle security (in the sense who has access to the device) without having a central server. I am sorry that this seems like an unorganized post, but iam trying to brainstorm here. Looking forward to hear your opinions.

    Read the article

  • Call webservice from Android using KSoap simply returning "error" string

    - by w00tfest99
    I'm trying to use ksoap to call a simple webservice. I followed this video to try to get started. When I call "getResponse()" on the envelope I just get the string "Error". There's no exceptions thrown or any other detail. I've successfully connected to a simple webservice I just setup on my local machine. Could this potentially be related to being behind a proxy server here at work? My code is below: String SOAP_ACTION="http://tempuri.org/CelsiusToFahrenheit"; String METHOD_NAME = "CelsiusToFahrenheit"; String NAMESPACE = "http://tempuri.org"; String URL = "http://w3schools.com/webservices/tempconvert.asmx"; SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); PropertyInfo pi = new PropertyInfo(); pi.setName("Celsius"); pi.setValue("32"); request.addProperty(pi); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE aht = new HttpTransportSE(URL); try { aht.call(SOAP_ACTION, envelope); SoapPrimitive results = (SoapPrimitive)envelope.getResponse(); } catch (Exception e) { e.printStackTrace(); }

    Read the article

  • Webservice error

    - by Parth
    i am new to webservices, I have created a basic stockmarket webservice, I have successfully created the server script for it and placed it in my server, Now I also creted a clent script and accessed it hruogh the same server.. Is it valid ? can boh files be accesed from the same server? or do I have to place them in different servers? If yes Then Y? If No then why do i get the blank page? I am using nusoap library for webservice. When I use my cleint script from my local machine I get these errors "Deprecated: Assigning the return value of new by reference is deprecated in D:\wamp\www\pranav_test\nusoap\lib\nusoap.php on line 6506 Fatal error: Class 'soapclient' not found in D:\wamp\www\pranav_test\stockclient.php on line 3" stockserver.php at server <?php function getStockQuote($symbol) { mysql_connect('localhost','root','******'); mysql_select_db('pranav_demo'); $query = "SELECT stock_price FROM stockprices " . "WHERE stock_symbol = '$symbol'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); return $row['stock_price']; } require('nusoap/lib/nusoap.php'); $server = new soap_server(); $server->configureWSDL('stockserver', 'urn:stockquote'); $server->register("getStockQuote", array('symbol' => 'xsd:string'), array('return' => 'xsd:decimal'), 'urn:stockquote', 'urn:stockquote#getStockQuote'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> stockclient.php <?php require_once('nusoap/lib/nusoap.php'); $c = new soapclient('http://192.168.1.20/pranav_test/stockserver.php'); $stockprice = $c->call('getStockQuote', array('symbol' => 'ABC')); echo "The stock price for 'ABC' is $stockprice."; ?> please help...

    Read the article

  • Why can't I send SOAP requests to Ebay finding API with this php?

    - by Jay
    This is my code: <?php error_reporting(E_ALL); //new instance of soapClient pointing to Ebay finding api $client = new SoapClient("http://developer.ebay.com/webservices/finding/latest/FindingService.wsdl"); //attach required parameters to soap message header $header_arr = array(); $header_arr[] = new SoapHeader("X-EBAY-SOA-MESSAGE-PROTOCOL", "SOAP11"); $header_arr[] = new SoapHeader("X-EBAY-SOA-SERVICE-NAME", "FindingService"); $header_arr[] = new SoapHeader("X-EBAY-SOA-OPERATION-NAME", "findItemsByKeywords"); $header_arr[] = new SoapHeader("X-EBAY-SOA-SERVICE-VERSION", "1.0.0"); $header_arr[] = new SoapHeader("X-EBAY-SOA-GLOBAL-ID", "EBAY-GB"); $header_arr[] = new SoapHeader("X-EBAY-SOA-SECURITY-APPNAME", "REMOVED"); $header_arr[] = new SoapHeader("X-EBAY-SOA-REQUEST-DATA-FORMAT", "XML"); $header_arr[] = new SoapHeader("X-EBAY-SOA-MESSAGE-PROTOCOL", "XML"); $test = $client->__setSoapHeaders($header_arr); $client->__setLocation("http://svcs.ebay.com/services/search/FindingService/v1");//endpoint $FindItemsByKeywordsRequest = array( "keywords" => "potter" ); $result = $client->__soapCall("findItemsByKeywords", $FindItemsByKeywordsRequest); //print_r($client->__getFunctions()); //print_r($client->__getTypes()); //print_r($result); ? And this is the error I receive: Fatal error: Uncaught SoapFault exception: [axis2ns2:Server] Missing SOA operation name header in C:\xampplite\htdocs\OOP\newfile.php:25 Stack trace: #0 C:\xampplite\htdocs\OOP\newfile.php(25): SoapClient-__soapCall('findItemsByKeyw...', Array) #1 {main} thrown in C:\xampplite\htdocs\OOP\newfile.php on line 25 It doesnt make sense, I have already set the operation name in the header of the request... Does anyone know what is wrong here?

    Read the article

  • Is it possible to handle User Defined Exception using JAX WS Dispatch API ?

    - by snowflake
    Hello, I'm performing dynamic webservices call using following code snippet: JAXBContext jc = getJAXBContext(requestClass, responseClass, jaxbContextExtraClasses); Dispatch<Object> dispatch = service.createDispatch(portQName, jc, Service.Mode.PAYLOAD); Object requestValue = getRequestValue(requestClass, pOrderedParameters); JAXBElement<?> request = new JAXBElement(new QName(serviceQNameStr, pOperationName), requestValue.getClass(), null, requestValue); Object tmpResponse = dispatch.invoke(request); Invocation works perfectly, except if I add a user defined exception on the service (a basic UserException extends java.lang.Exception). First I get: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Fault"). Expected elements are <{http://my.namespace/}myMethod,<{http://my.namespace/}myResponse Then I added the UserException_Exception JAX-WS generated type to my JAXB Context, and then get: Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions java.lang.StackTraceElement does not have a no-arg default constructor. this problem is related to the following location: at java.lang.StackTraceElement at public java.lang.StackTraceElement[] java.lang.Throwable.getStackTrace() at java.lang.Throwable at java.lang.Exception Only solution available I found are: dispatch directly a Soap message and handle Soap fault directly (this is the way Jboss JAX-WS implementation performs a standard JAX-WS call using services interfaces). This is not an available solution for me, I want to use a high level implementation (the more I get close to Soap message the less dynamic my code can be) usage of JAXBRIContext.ANNOTATION_READER, which is implementation specific and not an available solution for me, in order to annotate annotates java.lang.Exception as @XmlTransient The service with a user defined exception performs well using the JAX-WS generated standard client stubs and using a tool such Soap UI. Problem occurs in deserialization of the message when I have no user defined exception artifact in the JAXB context, and during invocation when I add those non JAXB compatible artifacts in the JAXB context. I'm usign Jboss WS webservice stack within Jboss 4.2.3.GA Any elegant solution to this problem is welcomed !

    Read the article

  • Apache Axis2 1.5.1 and NTLM Authentication

    - by arcticpenguin
    I've browsed all of the discussions here on StackOverflow regarding NTLM and Java, and I can't seem to find the answer. I'll try and be much more specific. Here's some code that returns a client stub that (I hope) is configured for NTLM authentication: ServiceStub getService() { try { ServiceStub stub = new ServiceStub( "http://myserver/some/path/to/webservices.asmx"); // this service is hosted on IIS List<String> ntlmPreferences = new ArrayList<String>(1); ntlmPreferences.add(HttpTransportProperties.Authenticator.NTLM); HttpTransportProperties.Authenticator ntlmAuthenticator = new HttpTransportProperties.Authenticator(); ntlmAuthenticator.setPreemptiveAuthentication(true); ntlmAuthenticator.setAuthSchemes(ntlmPreferences); ntlmAuthenticator.setUsername("me"); ntlmAuthenticator.setHost("localhost"); ntlmAuthenticator.setDomain("mydomain"); Options options = stub._getServiceClient().getOptions(); options.setProperty(HTTPConstants.AUTHENTICATE, ntlmAuthenticator); options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true"); stub._getServiceClient().setOptions(options); return stub; } catch (AxisFault e) { e.printStackTrace(); } return null; } This returns a valid SerivceStub object. When I try to invoke a call on the stub, I see the following in my log: Jun 9, 2010 12:12:22 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme INFO: NTLM authentication scheme selected Jun 9, 2010 12:12:22 PM org.apache.commons.httpclient.HttpMethodDirector authenticate SEVERE: Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials Does anyone have a solution to this issue?

    Read the article

  • MS AJAX Library 4.0 Sys.create.dataView

    - by azamsharp
    One again Microsoft poor documentation has left me confused. I am trying to use the new features of the .NET 4.0 framework. I am using the following code to populate the Title and Director but it keeps getting blank. <script language="javascript" type="text/javascript"> Sys.require([Sys.components.dataView, Sys.components.dataContext,Sys.scripts.WebServices], function () { Sys.create.dataView("#moviesView", { dataProvider: "MovieService.svc", fetchOperation: "GetMovies", autoFetch: true }); }); </script> And here it the HTML code: <ul id="moviesView"> <li> {{Title}} - {{Director}} </li> </ul> IS THIS THE LATEST URL TO Start.js file. Here is the Ajax-Enabled WCF Service: [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class MovieService { [OperationContract] public Movie GetMovies() { return new Movie() { Title = "SS", Director = "SSSSS" }; } } [DataContract] public class Movie { [DataMember] public string Title { get; set; } [DataMember] public string Director { get; set; } }

    Read the article

  • Can a WCF Service provide publish/subscribe activity to a Linux-based C++ client application?

    - by Jeremy Roddingham
    I have a WCF service written to provide certain functionality to intranet-based clients. This is easy when a client is running Windows. I want to implement the same functionality for my Windows clients that is available to my linux clients. My questions are? How can I communicate to a linux c++ based client (supporting callback operations for a publish subscribe) type situation? I am aware of using SOAP over the HTTPBinding but is that the only way (does not support callbacks I believe)? Would the same apply if I were using TCPBinding on the service-side? Currently, the service is set up using TCP but what are my options for the linux client communcation? I read somewhere that messages can also be sent (via webservices I believe) in XML rather than SOAP? Which would be a better approach or how to determine which is a better approach? I am trying to understand the options I would have for a WCF data service if I wanted to communicate with it from a linux client. I appreciate all your help. Thank You, Jeremy

    Read the article

  • Execute remote Lua Script

    - by Bruno Lee
    Hi, I want to make an application that executes a remote script. The user can create a script (probabily a LUA script) then stores it in the server. Then he can uses an API for execute the script. I was thinking that API could be a webservice. So my questions are: I need high performance to execute the script. So my first choice was LUA script. Someone has another sugestion? Cause I need high perfomance, I was thinking if the webservice is the best solution. Maybe I could create a TCP/IP Windows Service that hold the users request. It is important to say that I will have many user executing scripts at the same time. So I will have a concurrency problem. My scripts will query in a database. I will use Tokyo Cabinet or Tokio Tyrant. I think Tokio Tyrant is the only solution cause I will have many requests. For perfomance, Do I need to make a connection pooling? Is there anyway to share variables between webservices requests? To make the webservice or the Windows service i was thinking to use C++. Can someone help with these questions? thanks

    Read the article

  • Web service request ignores basic WSDL XML element restrictions

    - by Oliver
    Hi all, I have encountered some difficulties while trying to validate an incoming soap message to a service I have running on JBoss AS (v. 5.1.0). In my code, I have explicitly set some fields to be required, eg: public class MyClass { @XmlElement(required=true, nillable=false) private List<myOtherObjects> myList; } This requirement is also reflected in the WSDL (note the lack of minOccurs="0"): <xs:element maxOccurs="unbounded" name="myList" type="tns:myOtherObjects" /> However, when I do a test soap message that has myList set to empty or null, these restrictions are completely ignored, forcing me to validate manually within the application logic on the service. I did some searching on the Internet and found out that, on WebLogic, the validation does not seem to be enabled by default, though it can be turned on by modifying the weblogic-webservices.xml file. (http://forums.oracle.com/forums/thread.jspa?threadID=783972&tstart=115) I’m wondering if there is something similar that I have to do with JBoss AS to enable automatic validation before the soap message reaches the service. Any help would be greatly appreciated. Oliver

    Read the article

  • DDD and Client/Server apps

    - by Christophe Herreman
    I was wondering if any of you had successfully implemented DDD in a Client/Server app and would like to share some experiences. We are currently working on a smart client in Flex and a backend in Java. On the server we have a service layer exposed to the client that offers CRUD operations amongst some other service methods. I understand that in DDD these services should be repositories and services should be used to handle use cases that do not fit inside a repository. Right now, we mimic these services on the client behind an interface and inject implementations (Webservices, RMI, etc) via an IoC container. So some questions arise: should the server expose repositories to the client or do we need to have some sort of a facade (that is able to handle security for instance) should the client implement repositories (and DDD in general?) knowing that in the client, most of the logic is view related and real business logic lives on the server. All communication with the server happens asynchronously and we have a single threaded programming model on the client. how about mapping client to server objects and vice versa? We tried DTO's but reverted back to exposing the state of our objects and mapping directly to them. I know this is considered bad practice, but it saves us an incredible amount of time) In general I think a new generation of applications is coming with the growth of Flex, Silverlight, JavaFX and I'm curious how DDD fits into this.

    Read the article

  • Jquery button.click bug?

    - by Chris
    I have the following home-grown jquery plugin: (function($) { $.fn.defaultButton = function(button) { var field = $(this); var target = $(button); if (field.attr('type').toLowerCase() != 'text') return; field.keydown(function (e) { if ((e.which || e.keyCode) == 13) { console.log('enter'); target.click(); return false; } }); } })(jQuery); I'm using it like so: $('#SignUpForm input').defaultButton('#SignUpButton'); $('#SignUpButton').click(function(e) { console.log('click'); $.ajax({ type: 'post', url: '<%=ResolveUrl("~/WebServices/ForumService.asmx/SignUp")%>', contentType: 'application/json; charset=utf-8', dataType: 'json', data: JSON.stringify({ email: $('#SignUpEmail').val(), password: $('#SignUpPassword').val() }), success: function(msg) { $.modal.close(); } }); }); The first time, it works. The second time, nothing happens. I see enter and click the first time in the firebug log, but the second time I only see the enter message. It's almost like the button's click handler is being unregistered somehow. Any thoughts?

    Read the article

  • not a valid AllXsd value

    - by jun
    I got this from a Soap client request: Exception: SoapFault exception: [soap:Client] Server was unable to read request. --- There is an error in XML document (2, 273). --- The string '2010-5-24' is not a valid AllXsd value. in /path/filinet.php:21 Stack trace: #0 [internal function]: SoapClient-__call('SubIdDetailsByO...', Array) #1 /path/filinet.php(21): SoapClient-SubIdDetailsByOfferId(Array) #2 {main} Seems like I am sending an incorrect value, how do I format my value in an AllXsd in php? Here is my code: <?php $start = isset($_GET['start']) ? $_GET['start'] : date("Y-m-d"); $end = isset($_GET['end']) ? $_GET['end'] : date("Y-m-d"); //define parameter array $param = array('userName'=>'user', 'password'=>'pass', 'startDate' => $start, 'endDate' => $end, 'promotionId' => ''); //Get wsdl path $serverPath = "https://webservices.filinet.com/affiliate/reports.asmx?WSDL"; //Declare Soap client $client = new SoapClient($serverPath); try { //make the call $result = $client->SubIdDetailsByOfferId($param); //If error found display error if(isset($fault)) { echo "Error: ". $fault; } //If no error display response else { //Used to display raw XML in the Web Browser header("Content-Type: text/xml;"); //SubIdDetailsResult = XML results echo $result->SubIdDetailsByOfferIdResult; } } catch(SoapFault $ex) { echo "<b>Exception:</b> ". $ex; } unset($client); ?>

    Read the article

  • Pitfalls and practical Use-Cases: Toplink, Hibernate, Eclipse Link, Ibatis ...

    - by Martin K.
    I worked a lot with Hibernate as my JPA implementation. In most cases it works fine! But I have also seen a lot of pitfalls: Remoting with persisted Objects is difficult, because Hibernate replaces the Java collections with its own collection implementation. So the every client must have the Hibernate .jar libraries. You have to take care on LazyLoading exceptions etc. One way to get around this problem is the use of webservices. Dirty checking is done against the Database without any lock. "Delayed SQL", causes that the data access isn't ACID compliant. (Lost data...) Implict Updates So we don't know if an object is modified or not (commit causes updates). Are there similar issues with Toplink, Eclipse Link and Ibatis? When should I use them? Have they a similar performance? Are there reasons to choose Eclipse Link/Toplink... over Hibernate?

    Read the article

  • Executing remote script - Architecture

    - by Bruno Lee
    Hi, I want to make an application that executes a remote script. The user can create a script (probabily a LUA script) then stores it in the server. Then he can uses an API for execute the script. I was thinking that API could be a webservice. So my questions are: I need high performance to execute the script. So my first choice was LUA script. Someone has another sugestion? Cause I need high perfomance, I was thinking if the webservice is the best solution. Maybe I could create a TCP/IP Windows Service that hold the users request. It is important to say that I will have many user executing scripts at the same time. So I will have a concurrency problem. My scripts will query in a database. I will use Tokyo Cabinet or Tokio Tyrant. I think Tokio Tyrant is the only solution cause I will have many requests. For perfomance, Do I need to make a connection pooling? Is there anyway to share variables between webservices requests? To make the webservice or the Windows service i was thinking to use C++. Can someone help with these questions? thanks

    Read the article

  • Rot13 for numbers.

    - by dreeves
    EDIT: Now a Major Motion Blog Post at http://messymatters.com/sealedbids The idea of rot13 is to obscure text, for example to prevent spoilers. It's not meant to be cryptographically secure but to simply make sure that only people who are sure they want to read it will read it. I'd like to do something similar for numbers, for an application involving sealed bids. Roughly I want to send someone my number and trust them to pick their own number, uninfluenced by mine, but then they should be able to reveal mine (purely client-side) when they're ready. They should not require further input from me or any third party. (Added: Note the assumption that the recipient is being trusted not to cheat.) It's not as simple as rot13 because certain numbers, like 1 and 2, will recur often enough that you might remember that, say, 34.2 is really 1. Here's what I'm looking for specifically: A function seal() that maps a real number to a real number (or a string). It should not be deterministic -- seal(7) should not map to the same thing every time. But the corresponding function unseal() should be deterministic -- unseal(seal(x)) should equal x for all x. I don't want seal or unseal to call any webservices or even get the system time (because I don't want to assume synchronized clocks). (Added: It's fine to assume that all bids will be less than some maximum, known to everyone, say a million.) Sanity check: > seal(7) 482.2382 # some random-seeming number or string. > seal(7) 71.9217 # a completely different random-seeming number or string. > unseal(seal(7)) 7 # we always recover the original number by unsealing.

    Read the article

  • Permission denied (maybe missing INTERNET permission) when calling web service

    - by Maxim
    I'm trying to use .net SOAP web service with ksoap2 lib. Example from http://www.vimeo.com/9633556 shows how to do it correct. Below the code from that example. everything shoud work ok, but when I try to do a call inself (httpTransport.call) I get "Permission denied (maybe missing INTERNET permission)" exception. Moreover, I don't see in the Application info window among permissions the internet permission alert. Tried this on emulator and Google phone. Will be very appreciated if somebody could help with it. Thanks. public void CelsiusToFahrenheit() { String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit"; String METHOD_NAME = "CelsiusToFahrenheit"; String NAMESPACE = "http://tempuri.org/"; String URL = "http://www.w3schools.com/webservices/tempconvert.asmx"; SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME); Request.addProperty("Celsius", "32"); SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); soapEnvelope.dotNet = true; soapEnvelope.setOutputSoapObject(Request); AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL); try { httpTransport.call(SOAP_ACTION, soapEnvelope); SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse(); res = resultString.toString(); } catch (Exception e) { e.printStackTrace(); } } AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest> <application> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <user-permission android:name="android.permission.INTERNET"></user-permission> <uses-sdk android:minSdkVersion="4" />

    Read the article

  • How to architect Rails site that can be edited while running?

    - by Chris Kimpton
    Hi, I am writing a Rails app that "scrapes/navigates" some other websites and webservices for content. I am using Mechanize and Savon to do the heavylifting. But given the dynamic nature of the web, I'd like to make my calls to these editable by the admin users of the site - rather than requiring me to release a new version of the site. The actual scraping thread happens async to the website, using the daemons gem. My requirements are: Thinking that the scraping/webservice calling code is quite simple, the easiest route is to make the whole class editable by the admins. Keep a history of the scraping code - so that we can fairly easily revert if we introduce a problem. Initially use the code from the file system, but as soon as thats been edited and stored somewhere, to use that code instead. I am thinking my options are: Store the code in the db (with a history table for the old versions) Store the code in a private git repo somewhere and access that for the history/latest versions. I am thinking the git route might be easiest, given its raison d'etre is to track file history... But perhaps there is a gem/plugin that does all this for me, out of the box? Thanks in advance for any tips/advice. ~chris

    Read the article

  • Json HTTP Module stream issue

    - by Justin
    Hey, I have an HTTP Module that I use to clean up the JSON returned by my web service (see http://www.codeproject.com/KB/webservices/ASPNET_JSONP.aspx?msg=3400287#xx3400287xx for an example of this.) Basically it relates to calling cross-domain JSON web services from javascript. There is this JsonHttpModule which uses a JsonResponseFilter Stream class to write out the JSON and the overloaded Write method is supposed to wrap the name of the callback function around the JSON, otherwise the JSON errors out as needing a label. However, if the JSON is really long, the Write method in the Stream class is called multiple times, causing the callback function to incorrectly get inserted midway through the JSON. Is there a way in the Stream class to wrap the callback function around the stream at the end or to specify that it write all of the JSON in 1 Write method instead of in chunks?? Here's where it calls the JsonResponseFilter in the JsonHttpModule: public void OnReleaseRequestState(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; if (!_Apply(app.Context.Request)) return; // apply response filter to conform to JSONP app.Context.Response.Filter = new JsonResponseFilter(app.Context.Response.Filter, app.Context); } Here's the Write method in the JsonResponseFilter Stream class that gets called multiple times: public override void Write(byte[] buffer, int offset, int count) { var b1 = Encoding.UTF8.GetBytes(_context.Request.Params["callback"] + "("); _responseStream.Write(b1, 0, b1.Length); _responseStream.Write(buffer, offset, count); var b2 = Encoding.UTF8.GetBytes(");"); _responseStream.Write(b2, 0, b2.Length); } Thanks for any help! Justin

    Read the article

  • Is there a way to get an ASMX Web Service created in VS 2005 to receive and return JSON?

    - by Ben McCormack
    I'm using .NET 2.0 and Visual Studio 2005 to try to create a web service that can be consumed both as SOAP/XML and JSON. I read Dave Ward's Answer to the question How to return JSON from a 2.0 asmx web service (in addition to reading other articles at Encosia.com), but I can't figure out how I need to set up the code of my asmx file in order to work with JSON using jQuery. Two Questions: How do I enable JSON in my .NET 2.0 ASMX file? What's a simple jQuery call that could consume the service using JSON? Also, I notice that since I'm using .NET 2.0, I i'm not able to implement using System.Web.Script.Services.ScriptService. Here's my C# code for the demo ASMX service: using System; using System.Web; using System.Collections; using System.Web.Services; using System.Web.Services.Protocols; /// <summary> /// Summary description for StockQuote /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class StockQuote : System.Web.Services.WebService { public StockQuote () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public decimal GetStockQuote(string ticker) { //perform database lookup here return 8; } [WebMethod] public string HelloWorld() { return "Hello World"; } } Here's a snippet of jQuery I found on the internet and tried to modify: $(document).ready(function(){ $("#btnSubmit").click(function(event){ $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "http://bmccorm-xp/WebServices/HelloWorld.asmx", data: "", dataType: "json" }) event.preventDefault(); }); });

    Read the article

  • Jquery ajaxStart doesnt get triggered

    - by gnomixa
    This code $("#loading").ajaxStart(function() { alert("start"); $(this).show(); }); in my mark-up <div style="text-align:center;"><img id="loading" src="../images/common/loading.gif" alt="" /></div> Here is the full ajax request: $.ajax({ type: "POST", url: "http://localhost/WebServices/Service.asmx/GetResults", data: jsonText, contentType: "application/json; charset=utf-8", dataType: "json", success: function(response) { var results = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d; PopulateTree(results); }, error: function(xhr, status, error) { var msg = JSON.parse(xhr.responseText); alert(msg.Message); } }); $("#loading").ajaxStart(function() { alert("start"); $(this).show(); }); $("#loading").ajaxStop(function() { alert("stop"); $(this).hide(); $("#st-tree-container").show(); }); never fires alert "start" even though the gif is shown to rotate. AjaxStop gets triggered as expected. Any ideas why?

    Read the article

  • How should I unit test a code-generator?

    - by jkp
    This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions. I have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices. When I developed this code I did it using TDD, but I've found my tests to be brittle as hell. Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations. The problem is I dread going in to modify the code at all. That and the fact that the unit tests themselves are a: complex, and b: brittle. So I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way. Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to. Has anyone got any experiences of something similar to this they would care to share?

    Read the article

  • Apple's Sample App TopSongs has 26 Leaks, Ugh!

    - by RoLYroLLs
    Hey all, I've been building an app for a client and part of it uses Apple's TopSongs sample app to download data on another thread. I finally got enough done to start testing that part and found 1000 leaks!!! A closer look at the leaks made me check TopSongs for leaks, since none of the my methods were in leaks report. Running TopSongs returned 26 leaks. Not quite sure how to fix them, or if they are part of some library from Apple. I bet you're asking if it has 26, why do you have 1000? Well, I use their sample to make roughly 48 calls to webservices to get all the information needed on initial install (48 calls x 26 leaks = 1248 leaks!!). Later it makes at least 12 calls + 4 to check for updated information on other sections of the app. Can't do a thing about it, can't make one call, or less calls, please don't comment about this part. I seen people respond to posts that aren't necessarily answering the question the user originally posted, which in this case is has anyone tried patching up the leaks, if they are patchable, or is this a bug in Apple's libraries? Thanks so much.

    Read the article

  • [Zend YouTubeAPP] failed to upgrade a token

    - by kwokwai
    Hi all, I was testing Zend Gdata 1.10.1 in my localhost. I downloaded Zend Gdate from this link: http://framework.zend.com/download/webservices Inside the Zend Gdata zip file, there was a folder called demos. I extracted it and used the YouTudeVideoApp to upload a sample video to Youtube. But every time after I logged into Youtube, before it redirected me to my localhost, I received a warning message like this warning message: localhost: This website is registered with Google to make authorization requests, but has not been configured to send requests securely. We recommend that you continue the process only if you trust the following destination: localhost:8080/youtube/operations.php So I googled on how to resolve the problem of getting this warning message when I saw some people suggesed changing the value of $secure to True in operation.php. Here is the script mentioned: function generateAuthSubRequestLink($nextUrl = null) { $scope = 'http://gdata.youtube.com'; $secure = true; $session = true; if (!$nextUrl) { generateUrlInformation(); $nextUrl = $_SESSION['operationsUrl']; } $url = Zend_Gdata_AuthSub::getAuthSubTokenUri($nextUrl, $scope, $secure, $session); echo '<a href="' . $url . '"><strong>Click here to authenticate with YouTube</strong></a>'; } After I altered the value of $secure to True, I found that the warning message changed to this: localhost: Registered, secure. This website is registered with Google to make authorization requests The new warning message is somehow shorter and looks better than the previous warning message. But once I pressed the Allow Access button, it turned out to be this: ERROR - Token upgrade for CI3M6_Q3EOGkxoL-___wEYjffToQQ failed : Token upgrade failed. Reason: Invalid AuthSub header. Error 401 ERROR - Unknown search type - '' I don't know why this happened. Could you help me solve the problem please?

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26  | Next Page >