Click here to Skip to main content
15,885,278 members
Home / Discussions / C#
   

C#

 
GeneralRe: Programmatically Attach Debugger Pin
OriginalGriff26-Jan-16 8:41
mveOriginalGriff26-Jan-16 8:41 
GeneralRe: Programmatically Attach Debugger Pin
Kevin Marois26-Jan-16 8:45
professionalKevin Marois26-Jan-16 8:45 
GeneralRe: Programmatically Attach Debugger Pin
OriginalGriff26-Jan-16 8:57
mveOriginalGriff26-Jan-16 8:57 
GeneralRe: Programmatically Attach Debugger Pin
Kevin Marois26-Jan-16 9:01
professionalKevin Marois26-Jan-16 9:01 
GeneralRe: Programmatically Attach Debugger Pin
OriginalGriff26-Jan-16 9:16
mveOriginalGriff26-Jan-16 9:16 
GeneralRe: Programmatically Attach Debugger Pin
Kevin Marois26-Jan-16 9:19
professionalKevin Marois26-Jan-16 9:19 
GeneralRe: Programmatically Attach Debugger Pin
John Torjo26-Jan-16 20:54
professionalJohn Torjo26-Jan-16 20:54 
Questionpost and manipulate result JSON WebService Pin
Member 1228688325-Jan-16 12:58
Member 1228688325-Jan-16 12:58 
Hi Please can you help. I have been asked to see if I can integrate our systems with a 3rd party tool.
I've had the details from the 3rd party and it turns out I need to upload some data to a JSON Web service, then obviously manipulate the results

Example php has been supplied, but I always work in c# or VB and Ive made a start but starting to feel lost, can you help ?

''
public function runJsonRequestTest() {
$client = new \SoapClient(
"https://website.wsdl",
array(
'trace' => 1,
'exception' => 0
)
);
try {
$response = json_decode(
$client->json_request(
‘username’,
‘password’,
json_encode( //The request array
[
‘category’ => ‘api’,
‘type’ => ‘getMethods’,
‘data’ => [ ]
]
)
),
true
);
}
catch(\Exception $e) {
return "Soap request failed: {$e->getMessage()}

" . $client->__getLastResponse();
}
$string = print_r($response, true);
return $String;
'''
I've also got
'''
Example request array:
[
‘category’ => ‘api’,
‘type’ => ‘getMethods’,
]
Example return output:
Array (
[status] => COMPLETE
[data] => Array (
[0] => methodA
[1] => methodB
[2] => methodC
[3] => methodD) )
'''

so far I've got the below - but I get many errors and starting to get a bit lost - the below does not compile !

'''
public class ResultsTest
{
public string status { get; set; }
public List data { get; set; }
}

public class ResultsTestList
{
public int option { get; set; }
}

public static async Task RunAsync(String Url, String Username, String Password, InstructionMessageModel instruction, String log)
{
_log = log;
_url = Url;
_username = Username;
_password = Password;
var baseAddress = new Uri(_url);
using (var client = new HttpClient())
{
client.BaseAddress = baseAddress;
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var auth = string.Format("{0}:{1}", _username, _password);
var encoded = Convert.ToBase64String(Encoding.ASCII.GetBytes(auth));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", encoded);
try
{
HttpResponseMessage response = await client.PostAsJsonAsync(_url, instruction);

if (!response.IsSuccessStatusCode)
{
var errors = await response.Content.ReadAsAsync();
}
else
{
var jsonAsString = await response.Content.ReadAsAsync();
var output = JsonConvert.DeserializeObject(jsonAsString);
}
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
}
}
}
'''
AnswerRe: post and manipulate result JSON WebService Pin
Garth J Lancaster25-Jan-16 13:33
professionalGarth J Lancaster25-Jan-16 13:33 
GeneralRe: post and manipulate result JSON WebService Pin
Member 1228688326-Jan-16 14:22
Member 1228688326-Jan-16 14:22 
GeneralRe: post and manipulate result JSON WebService Pin
Garth J Lancaster26-Jan-16 14:31
professionalGarth J Lancaster26-Jan-16 14:31 
QuestionRe-Assignable Keyboard Shortcuts Pin
Eiredrake25-Jan-16 11:05
Eiredrake25-Jan-16 11:05 
AnswerRe: Re-Assignable Keyboard Shortcuts Pin
John Torjo25-Jan-16 23:20
professionalJohn Torjo25-Jan-16 23:20 
AnswerRe: Re-Assignable Keyboard Shortcuts Pin
Pete O'Hanlon26-Jan-16 0:09
mvePete O'Hanlon26-Jan-16 0:09 
GeneralRe: Re-Assignable Keyboard Shortcuts Pin
Richard MacCutchan26-Jan-16 0:28
mveRichard MacCutchan26-Jan-16 0:28 
GeneralRe: Re-Assignable Keyboard Shortcuts Pin
Pete O'Hanlon26-Jan-16 0:52
mvePete O'Hanlon26-Jan-16 0:52 
QuestionData disappears on postback Pin
Carl Cummings25-Jan-16 7:21
Carl Cummings25-Jan-16 7:21 
AnswerRe: Data disappears on postback Pin
Richard Deeming25-Jan-16 8:51
mveRichard Deeming25-Jan-16 8:51 
QuestionHow to use WeakEventManager with reflection Pin
Kenneth Haugland23-Jan-16 23:21
mvaKenneth Haugland23-Jan-16 23:21 
SuggestionRe: How to use WeakEventManager with reflection Pin
Kornfeld Eliyahu Peter24-Jan-16 1:18
professionalKornfeld Eliyahu Peter24-Jan-16 1:18 
GeneralRe: How to use WeakEventManager with reflection Pin
Sascha Lefèvre24-Jan-16 1:34
professionalSascha Lefèvre24-Jan-16 1:34 
GeneralRe: How to use WeakEventManager with reflection Pin
Kornfeld Eliyahu Peter24-Jan-16 1:38
professionalKornfeld Eliyahu Peter24-Jan-16 1:38 
GeneralRe: How to use WeakEventManager with reflection Pin
Sascha Lefèvre24-Jan-16 1:42
professionalSascha Lefèvre24-Jan-16 1:42 
GeneralRe: How to use WeakEventManager with reflection Pin
Kenneth Haugland24-Jan-16 3:25
mvaKenneth Haugland24-Jan-16 3:25 
GeneralRe: How to use WeakEventManager with reflection Pin
Kornfeld Eliyahu Peter24-Jan-16 3:42
professionalKornfeld Eliyahu Peter24-Jan-16 3:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.