I'm developing an iOS app and it calls a Web service I wrote using mono and it runs using apache. However, when I call the webmethod, the parameters received are always null for example in this call (im using Appcelerator)
callparams = {
username: String(username),
password: String(password)
};
alert(String(username) + String(password));
try {
suds.invoke('Login', callparams, function(xmlDoc){
On the server, i have this webmethod
[WebMethod]
public string Login(string username, string password)
{
return username + "-00";
}
When I run the simmulation, i only receive "-00" and not the username! why is this happening? I've also tried with integers and they're null too..
Nonetheless this works perfectly if i use the test form of the service..
Im running on MacOX 10.7.2 with mono 2.8.2 apache 2...
Thanks in advance
As far I know you can not do this with mono services under fast-cgi-monoserver ou mod_mono. Use an alternative to asmx (our PageMethod) like ServiceStack.
Related
I am facing worst & awkward issue of my life.
I am using HttpActionExecutedContext for caching my WEB API end points.
My web API is working properly in case of caching, but when I have updated the data & at that time I wanted to reset the caching at that time problem is arises.
Problem 1 :-
When I have deleted the bin folder from the server, then also API was sending the data to me.
(I have consumed API in ANDROID phone, I have tested in 2 phones after deleting the BIN bolder, In 1st phone API was giving data even after BIN DELETION & in 2nd phone API was giving partial data such as 1 end point was working but another was not).
How can this be possible ?
Problem 2 :-
Where data is saved when we use HttpActionExecutedContext. Wheather data is saved application pool or something ?
Problem 3 :-
How to clear the cache of WEB API.
Here is the code of WEB API.
public class CacheFilter : ActionFilterAttribute
{
public int TimeDuration { get; set; }
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
actionExecutedContext.Response.Headers.CacheControl = new System.Net.Http.Headers.CacheControlHeaderValue
{
MaxAge = TimeSpan.FromMinutes(1440),
MustRevalidate = true,
Public = true
};
}
}
Controller Code
[HttpGet]
[Route("SubCategory")]
[CacheFilter()]
public string SubCategory()
{
BAL_CAT_ALL obj = new BAL_CAT_ALL();
var data = obj.GetAllSubCategory();
return data;
}
While issuing a request to server when the data has been updated , can you please add the below 2 headers in your request:-
'Cache-Control', 'no-cache' 'Pragma', 'no-cache'
Give it a try and let us know if the issue is resolved or ?
Recently, i upgraded the cloud version from Edgware.RELEASE to Hoxton.SR1,and encounter some problems.
here comes the feign client code :
#FeignClient(name = "system-service)
public interface IHelloProxy{
#RequestMapping(value = "/sysinfo/now", method = RequestMethod.GET)
public void hello(#RequestParam String content);
}
when invoked IHelloProxy and pass the one param "content" with "https://www.oschina.net/?a=1&b=2",the feign debug log print:
---> GET http://system-service/sysinfo/now?content=https:%2F%2Fwww.oschina.net%2F%3Fa=1&b=2 HTTP/1.1
and the receiver got two params:“content”,"b".
the expectation should be :
--> GET http://system-service/sysinfo/now?content=https%3A%2F%2Fwww.oschina.net%2F%3Fa%3D1%26b%3D2
and the receiver also got only one param :"content"
I think the problem is at feign client side which do the wrong query map parsing. is that anyway to solve this ?
thanks.
the problem had solved by upgrade the cloud version to Hoxton.SR1 and Boot verion to 2.2.5.
and the issue is from open feign side, can track by for more detail
https://github.com/OpenFeign/feign/issues/1190
Below I present a part of an Azure Web App that handles a device notification logic. What I'm doing is invoking the code shown below from a ASP MVC Controller.
But when I run it I get an hung (ever-pending) request from the browser.
I thought I've found a workaround by wrapping the SendAsync call in a BackgroundWorker thread. It's better, but I doesn't work right. For first couple of times (one or two) it works ok, but then it happens again, the wrapped thread hangs.
The code is not far different from the one on MSDN for a console application. What am I missing?
using System.Web.Configuration;
using Microsoft.Azure.Devices;
namespace MyTest
{
public class Sender
{
private readonly string connectionString;
private readonly Microsoft.Azure.Devices.ServiceClient serviceClient;
public Sender()
{
connectionString = WebConfigurationManager.AppSettings["ConnectionString"];
serviceClient = ServiceClient.CreateFromConnectionString(connectionString);
}
public async void SendRequest(string deviceId, string msgText)
{
var message = new Message();
message.Properties.Add("text", msgText));
await serviceClient.SendAsync(deviceId, message);
}
}
}
The problem was caused by inappropriate usage of ASP MVC framework.
It turned out that AsyncController has to be used instead of just Controller when a long running async\await is utilized. The pipeline must be async all the way.
I have a issue when I try to call adapter (HTTP/MYSQL) from a Java adapter.
When I am using Postmen test it (added Authorization on the header)
It's always get a IO issue:
[I O: Invalid token on line 1, column 14].
First, I guess it should be OAuth issue, I add #OAuthSecurity(enabled=false) at the class but not work.
Would you please help me find out where the problem is.
Code snippet:
DataAccessService service = WorklightBundles.getInstance()
.getDataAccessService();
ProcedureQName name = new ProcedureQName("mysqlAdapter",
"getMysqlAdapters");
String para = ""; // String para = "['a','b','c']";
InvocationResult mysql= service.invokeProcedure(name, para);
JSONObject jsMysql = mysql.toJSON();
//String rst = jsMysql.get("key").toString();
PS following code snippet is working when I test it on Postman:
HttpUriRequest request = api.getAdaptersAPI()
.createJavascriptAdapterRequest("mysqlAdapter", "getMysqlAdapters");
try {
HttpResponse response = api.getAdaptersAPI().executeAdapterRequest(request);
JSONObject jsonObj =api.getAdaptersAPI().getResponseAsJSON(response);
return jsonObj.toString();
}
catch (MFPServerOAuthException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
return "error";
I am confused...
You use the tag "worklight", but the Product Worklight 4.x-6.2 does not have Java adapters support. There is JavaScript adapters support and the ability for a JavaScript adapter to call Java code on the server. There is also the ability to call a JavaScript adapter from Java code - but not do be confused as a Java adapter.
Java adapters exists only starting MobileFirst Platform Foundation 7.0 (formerly called "Worklight", tag is "mobilefirst"). I mention this because you've mentioned OAuth support, which was introduced alongside Java adapters in MobileFirst Platform Foundation 7.0. But this has got nothing to do with any of your code snippets. a Java adapter looks nothing like that.
So,
If you are using Worklight, you cannot use any of that OAuth stuff.
If you are using MobileFirst, you shouldn't call your adapters this way at all. Please review the Java adapters tutorial and first create a proper Java adapter: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/server-side-development/adapter-framework-overview/
Also note that at this time it is not easily possible to call a Java adapter from a JavaScript adapter (the opposite way of your request, if it is to be understood correctly).
I am trying to do a seemingly simple thing, but having trouble accomplishing it. I am trying to automate the posting on my Facebook wall. Basically I have a ASP.NET MVC website that I post updates on, and I want to automatically submit the post to my wall.
I see a lot of stuff on FB Connect and getting data, I just want to post.
Thanks for any help or guidance.
UPDATE: Just trying to resurrect and be a little more clear in my description as I am not getting anywhere.
I have a page that I want with a text box and a button. When I submit the form I want the message to post to my Facebook wall. I thought it was Facebook Connect, but I am getting no where as to how to automatically authenticate myself and post to my wall.
I would like to use C# rather than JavaScript.
private const string ApplicationKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX";
private const string SecretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
private Facebook.Rest.Api _facebookAPI;
private Facebook.Session.ConnectSession _connectSession;
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(FormCollection form)
{
_connectSession = new Facebook.Session.ConnectSession(ApplicationKey, SecretKey);
if (_connectSession.IsConnected())
{
_facebookAPI = new Facebook.Rest.Api(_connectSession);
string response = _facebookAPI.Stream.Publish("This is a generated test");
}
return View();
}
}
The IsConnected() is returning false.
Any help is appreciated.
This code was right, the problem was that I had not added my application to my profile. Dumb miss, but my thought is that the whole thing is poorly documented. I have another issue with offline access, but that is for a different post.
string apiKey = "XXXXXXXXX";
string apiSecret = "XXXXXXXXXXXX";
Facebook.Session.ConnectSession._connectSession = new Facebook.Session.ConnectSession(apiKey, apiSecret);
if (_connectSession.IsConnected)
{
Facebook.Rest.Api api = new Facebook.Rest.Api(_connectSession);
string response = api.Stream.Publish("Test", null, null, null, api.Users.Session.UserId);
}
It could be that you tested your Website on your localhost. The Facebook Cookie is not written out, when you test your Website on localhost. See this link http://forum.developers.facebook.net/viewtopic.php?pid=247332
This might solve your problem:
Add "127.0.0.1 localhost.local" to your file
Update your FB application Connect settings to use "http://localhost.local/" URL and "localhost.local" domain.
Create an IIS Web site on port 80 with the name "localhost.local". I had to stop my default web site, which is also on port 80
Update my Visual Studio 2010 web application to use IIS with the "http://localhost.local/" url.
To see cookies, make sure to install FireCookies, along with FireBug.