Https Communication to Java Server with Dotnet Client - c#

I need to send financial messages(transactions) to a bank with the help of HTTPS communication. Bank server is written on Java while my application is in .Net.
Following are only details I received from their side:
Https request:
• The entire ISO request for https should be sent as an attachment to the following
servlet:
https:///Servlet/IBSOtherVendorRequestServlet
What are other components or documents required from their side and which namespace of .Net can I use for this communication?
Kindly help me on how to proceed.

You have to know how to query the servlet : SOAP ? REST ? what are the parameters and which method should be used ? result in plain text, XML or JSON ?
It looks like you have to POST a request to this Servlet. You have to know what is an "entire ISO request" then POST it to this url using HttpClient or HttpWebRequest. It will probably look like this : Upload files with HTTPWebrequest (multipart/form-data)

Related

How to send sms using https url from 3rd party sms provider

[I used this link] (https://ozeki-sms-gateway.com/p_677-how-to-send-sms-from-c-sharp-using-http-get.html)
This code did not work.
The link given from the company had senderID, which is not exist the given oziki url.
The same code works fine.
The server shows a sending request for the sms http correctly.

Call Amazon Web Services to submit xml file throws WebException The remote name could not be resolved https

I am building a tool to translate some CSV files into XML files and then upload them via the Amazon Web Services to upload products to a market place store.
I am testing the tool and the CSV to XML translation is fine and valid xml is created but I am having trouble calling the AWS services and sending the files. At the moment I can't even succesfully call the AWS service let alone try sending a file.
When I create a HttpWebRequest and try and call the method "GetRequestStream" I get a WebException:
"The remote name could not be resolved https"
There is no inner exception or anything useful to help me.
The properties I have set to the webRequest are
Address - https://mws.amazonservices.co.uk/Action=SubmitFeed&MarketplaceIdList.Id.1=MarketPlaceId&Merchant .................
Headers -
+ Headers {User-Agent: Funkyrox/1.0 (Language=C#; =)
Content-Type: application/octet-stream
Content-MD5: 4BDPHUko1//iVAdb5wr/Vw==
Host: mws.amazonservices.co.uk
} System.Net.WebHeaderCollection
Host -
"mws.amazonservices.co.uk"
Method - POST
RequestUri -
https://mws.amazonservices.co.uk/Action=SubmitFeed&MarketplaceIdList.Id.1=MarketPlaceId&Merchant......................
There are others if needed as well.
When I ping https://mws.amazonservices.co.uk I get a response so I think the it's valid
I can't seem to find really useful examples of how to do this. I downloaded an C# tool from Amazon and have used a lot of the code in there but can't see how to call the service correctly.
Anyone with any ideas?

Web API response xml language

I am having this simple POST url to which my clients will send a POST request.
http://mydomain.com/requests/request
POST Data:
<Request>
<OrderId>1E008921</OrderId>
<OrderName>MC1</OrderName>
</Request>
to which I respond by sending back them a XML
<SRequest>
<RequestedBy>Client 1 </RequestedBy>
<RequestName>Test Name</RequestName>
<RequestStatus>Success</RequestStatus>
<SRequest>
Now client wants the above XML in a different language (say French)
How to handle this ? How to send the response language preference in Web API ? specially with the POST scenario like this ? (Append a language string ? or what is the best practices ?)
I suggest you either include it in URL: http://mydomain.com/fr/requests/request or use HTTP header like Accept-Language. You could read more in the answer to: Good way to changing language resources dynamically by request

Twilio SMS sandbox using C#

How do you use the Twilio sandbox mode with C#? I have a ashx.cs file that I am using to write my code. Would I put it there? If so, what does that look like?
There is no real great examples on their website on how to do this except for CURL and Ruby.
We are using TwiML to general an XML file tha t parses our data to send back and forth to the Twilio service. We don't want to be charged every time we send a test text message.
How would we set the Sandbox up so we could do some testing.
I found the Test auth Token and account Sid, but how do I use those?
We don't have them in our current application and we are specifying our .ashx page in Twilio to process our code.
Thanks in advance.
Twilio evangelist here.
So if you just want to test that your ASHX handler is generating the right results the easiest way to do this is to just fake a POST or a GET request to that handler. This lets you simulate the GET or POST request that Twilio will make to your app when it gets a text message.
You can see the parameters that Twilio will pass to your app when it receives a text message here:
http://www.twilio.com/docs/api/twiml/sms/twilio_request#synchronous
There are a whole bunch of ways to simulate these requests. cURL is one of them. If your ASHX is expecting query string values, you can also just load the ASHX directly in the browser and append those values in the URL. If the handler is expecting a POST request, I used a chrome plugin called Simple REST Client to make these.
Of course you can also Fiddler to make just about any HTTP request.
The Test Credentials really are more for simulating the use of the REST API (programatically sending SMS messages). I just wrote a blog post that shows how to use the test credentials to create integration tests:
http://www.twilio.com/blog/2013/05/automating-twilio-integration-tests-with-test-credentials.html
Hope that helps.
Devin

How to consume RESTFul webservice using HTTP POST in .net 2.0

I need to consume a restful webservice using .net 2.0 framework and not by using WCF. The RESTFul service is built in java and is designed only for POST operations. To consume the webservice in winforms in .net I am using a WebClient object.
Below is the sample code
string data="some data";
string url="some uri";
WebClient request = new WebClient();
//Application throws internal server error 500 at runtime when it hits this line.
string results = request.UploadString(url, "POST", data);
Is there anything wrong that i am doing here ? any help in this regard is greatly appreciated.
Are you sure that the service method in question accepts plain-text data and not something structured like JSON or XML/SOAP?
"Internal Server Error" is an indication that the Server has difficulty in processing the String you uploaded. There could be various causes to "Internal Server Error". Do you have access to the Server side code for debugging? One thing I can think of is the Encoding of the String you uploaded. You can probably try to set the Encoding property of WebClient to something else.

Categories

Resources