I am using vb 2008 .net 3.5.
I am trying to use sms api.
I have error on httpclient cannot find and I cannot find it on reference.
sms provider code :
HttpClient client = new HttpClient();
Uri baseAddress = new Uri("https://smsmisr.com/");
client.BaseAddress = baseAddress;
var sendtime = DateTime.Now.ToString("yyyy-MM-dd-HH-mm");
HttpResponseMessage response = client.PostAsJsonAsync(
"api/webapi/?" +
"username=XXXxx" +
"&password=XXXXXX" +
"&language= 3 Or 2 Or 1" +
"&sender=Your Sender " +
"&mobile=2012XXXXXX, 2011XXXX" +
"&message=Encoded Message" +
"&DelayUntil="+sendtime
).Result;
Related
Have anyone tried using Salesforce BULK API 2.0 in SSIS Script task. I was able to create the job and generate the CSV from the SQL query but when I am trying to use the HTTP PUT method for adding the data to the job it is not working. Following the link to create the steps on how to create job and then add data to the job.
https://trailhead.salesforce.com/en/content/learn/v/modules/api_basics/api_basics_bulk#:~:text=Bulk%20API%20is%20based%20on,the%20request%20in%20the%20background.
//********************CREATE JOB*****************************
HttpClient createClientCreateJob = new HttpClient();
String requestCreateJobMessage = "{\"object\" : \"Account\"," +
"\"contentType\" : \"CSV\"," +
"\"operation\" : \"insert\"," +
"\"lineEnding\": \"CRLF\"} ";
System.Windows.Forms.MessageBox.Show(requestCreateJobMessage);
HttpContent contentCreateJob = new StringContent(requestCreateJobMessage, Encoding.UTF8, "application/json");
string uriCreateJob = sfServiceUrl + "/services/data/v50.0/jobs/ingest";
HttpRequestMessage requestCreateJob = new HttpRequestMessage(HttpMethod.Post, uriCreateJob);
requestCreateJob.Headers.Add("Authorization", "Bearer " + sfOauthToken);
requestCreateJob.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
requestCreateJob.Content = contentCreateJob;
HttpResponseMessage responseCreateJob = await createClientCreateJob.SendAsync(requestCreateJob);
var resultCreateJob = await responseCreateJob.Content.ReadAsStringAsync();
System.Windows.Forms.MessageBox.Show(resultCreateJob, "resultCreateJob");
String batchid = resultCreateJob.Substring(7, 18);
System.Windows.Forms.MessageBox.Show("batch job created successfully - " + batchid);
I have geth running in remote server and is protected using HTTP Basic Auth.
I tried the below two methods. both don't work:
let web3 = new Web3(
new Web3.providers.HttpProvider(
'http://' + "username" + ':' + "password" + '#'+ "52.43.83.54/iimigdmb" + ':' + "31988"
)
)
As per official docs:
web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://' + "52.43.83.54/iimigdmb" + ':' + "31988", 5000, "sad", "asd"));
Is there any other way to achieve this:
I am creating pushnotification in windows phone 8.1.But whenever i am run my code I am not getting any notification to my device.Code is working perfectly without any error. below is my code
string subscriptionUri = "https://hk2.notify.windows.com/?token=AwYAAABR4r1HR4ncUnppJKR5oQ2%2bU1IwNe0dQfXgEltoIoIqBz3sSKHSt8Rge5GtbH2yDvSg2Syd0wd0%2bWhz9cSFMm40QxkEMOafHTXzgKmoKrzuSvDg0xO5etxpJRkqRbl3RWA%3d";
string PushNotificationXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:Notification xmlns:wp=\"WPNotification\">" +
"<wp:Tile>" +
"<wp:BackgroundImage>" + "sdfsafdsafsdf" + "</wp:BackgroundImage>" + "<wp:Count>" + "0" + "</wp:Count>" + "<wp:Title>" +
"Hi This is Sudheer" + "</wp:Title>" + "</wp:Tile> " + "</wp:Notification>";
string strChannelURI = subscriptionUri;
string secret = "aHsb3Hhhhhnvfuyknk";
string sid = "ms-app://s-1-15-2-435756784356-ffdsfdffd-sfsfsf-1465244715-23315sfdsfdsf61566-4957dsfdsf35136-dsfdsf";
var accessToken = GetAccessToken(secret, sid);
byte[] contentInBytes = Encoding.UTF8.GetBytes(PushNotificationXML);
HttpWebRequest request = HttpWebRequest.Create(subscriptionUri) as HttpWebRequest;
request.Method = "POST";
request.Headers.Add("X-WNS-Type", "wns/badge");
request.ContentType = "text/xml";
request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken.AccessToken));
using (Stream requestStream = request.GetRequestStream())
requestStream.Write(contentInBytes, 0, contentInBytes.Length);
using (HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse())
webResponse.StatusCode.ToString();
response "OK";
but not getting any notification to my device.
While downloading from document library in liferay 6.2 ,I am getting some issues in chrome like all the files are saved without extension at the time of downloading. This issues happens for the combination of windows 8 + office 2013 and windows 7+office 2010
long fileEntryId = getResume.getFileEntryId();
FileEntry fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId);
fileEntry = fileEntry.toEscapedModel();
long folderId = fileEntry.getFolderId();
String title = fileEntry.getTitle();
mimeType = fileEntry.getMimeType();
System.out.println("LULU JEET: "+fileEntry.getMimeType());
if (resourceRequest != null) {
themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
}
String fileUrl = themeDisplay.getPortalURL()
+ themeDisplay.getPathContext() + "/documents/"
+ themeDisplay.getScopeGroupId() + "//" + folderId
+ "//"
+ HttpUtil.encodeURL(HtmlUtil.unescape(title));
jobArray.put(fileUrl);
}
jsonFeed.put("jobArray", jobArray);
resourceResponse.setContentType(mimeType);
resourceResponse.addProperty(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=Resume-" + candidateName + ".docx");
resourceResponse.setCharacterEncoding("UTF-8");
resourceResponse.getWriter().write(jsonFeed.toString());
} catch (Exception e) {
e.printStackTrace();
}
So in this code i am using FileEntry for this operation.But for chrome it is not working.Somebody please help.
I am new to Flex and also new to writing a client for a web service.
My question is more about Flex (Flash Builder 4.5) APIs, what APIs to use.
I want to access a web service, and create a Flex / AIRwrapper for it,
which anyone can use.
Here is the spec of webservice.
I have to do a post on POST https://build.phonegap.com/api/v1/apps
content type has to be "multipart/form-data"
JSON bodies of requests are expected to have the name 'data' and will be something like this:
data={"title":"API V1 App","package":"com.alunny.apiv1","version":"0.1.0","create_method":"file"}
include a zip file in the multipart body of your post, with the parameter name 'file'.
I want to make a 'multipart/form-data' Post and send one string and one zip file.
My first question to self was if I send both string + binary data in the body,
how will server understand where string end and where zip file starts?
Then I read how text + binary data can be sent through "multipart/form-data" post request. There has to be some boundaries.
After this I read and example in flex and tried following it.
http://codeio.wordpress.com/2010/04/03/5-minutes-on-adobe-flex-mimic-file-upload-for-in-memory-contents/
but it doesn't seem to be working for me.
public function createNewApp(cb:Function , appFile : File):void
{
var service:HTTPService = new HTTPService();
service.url = ROOT+"apps";
service.showBusyCursor = true;
service.addEventListener(ResultEvent.RESULT, function(e:ResultEvent):void {
//translate JSON
trace(e.result);
var result:String = e.result.toString();
var data:Object = JSON.parse(result);
cb(data.link);
});
service.addEventListener(FaultEvent.FAULT, defaultFaultHandler); //todo : allow user to add his own as well
authAndUploadNewApp(service,appFile);
}
private function authAndUploadNewApp(service:HTTPService,appFile : File):void {
var encoder:Base64Encoder = new Base64Encoder();
encoder.encode(username + ":"+password);
service.headers = {Accept:"application/json", Authorization:"Basic " + encoder.toString()};
service.method ="POST";
var boundary:String = UIDUtil.createUID();
service.contentType = "multipart/form-data; boundary=—————————" + boundary;
var stream:FileStream = new FileStream();
stream.open(appFile, FileMode.READ);
var binaryData:ByteArray = new ByteArray();
var fileData : String = new String();
stream.readBytes(binaryData);
stream.close();
fileData = binaryData.readUTFBytes(binaryData.bytesAvailable); // I think this is where I have problem.... how do
//how do i converrt this bytearray/stream of data to string and send it in my post request's body - i guess if this step work rest should work..
var params: String = new String();
var content:String = "—————————" + boundary + "nr";
content += 'Content-Disposition: form-data; name="data";' + '{"title":"ELS test app 2","package":"com.elsapp.captivate","version":"12.3.09","create_method":"file"}' + "nr";
content += "—————————" + boundary + "nr";
content += 'Content-Disposition: form-data; name="file";' + fileData + "nr";
content += "—————————–" + boundary + "–nr";
service.request = content;
service.send();
}