Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 512467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:19:22+00:00 2026-05-13T07:19:22+00:00

not so long ago I´ve created a small iphone app for my Daily use.

  • 0

not so long ago I´ve created a small iphone app for my Daily use. Now I want to port this app to a Windows Mobile Device while using C# and the Compact Framework. But I really have no clue how to use the HttpWebRequest and the msdn doesn´t help me either. I think I have a lag of understanding on how Web Requests work in general.

In the iPhone app I have the following lines code:

NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://xxx:xxx@api.test.net/RPC2"]];
[theRequest setHTTPMethod:@"POST"];
[theRequest addValue:@"text/xml" forHTTPHeaderField:@"content-type"];
[theRequest setCachePolicy:NSURLCacheStorageNotAllowed];
[theRequest setTimeoutInterval:5.0];
NSString* pStr = [[NSString alloc] initWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><methodCall><methodName>xxx.SessionInitiate</methodName><params><param><value><struct><member><name>LocalUri</name><value><string></string></value></member><member><name>RemoteUri</name><value><string>xxxx</string></value></member><member><name>TOS</name><value><string>text</string></value></member><member><name>Content</name><value><string>%@</string></value></member><member><name>Schedule</name><value><string></string></value></member></struct></value></param></params></methodCall>", number.text, TextView.text];
NSData* pBody = [pStr dataUsingEncoding:NSUTF8StringEncoding];
[theRequest setHTTPBody:pBody];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

The Webservice has no wsdl so I have to use the HttpWebRquest Object in .Net CF.
What I didn´t get is, where to put the Body (the long XML) in my Request?

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"https://xxx:xxx@api.xxx.net/RPC2");
req.Method = @"POST";
req.ContentType = @"test/xml";
req.Timeout = 5;

I started this way, is the first line it´s own HttpWebRequest and for the XML Body I have to create anotherone?! How do I use it correctly, how do I send it? Sorry if this might be normaly totaly easy but I really don´t get it. I´ve searched the web, 2 Books and the msdn but in every tutorial is only a Webrequest with an URL but without a body.

Thank you

twickl

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:19:23+00:00Added an answer on May 13, 2026 at 7:19 am

    You need to write the POST data to the request stream.

    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@"https://username:password@api.sipgate.net/RPC2");
    req.Method = "POST";
    req.ContentType = "test/xml";
    req.Timeout = 5;
    using (Stream stream = req.GetRequestStream())
    using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8))
    {
        writer.Write("PUT THE XML HERE");
    }
    
    using (StreamReader reader = req.GetResponse().GetResponseStream())
    {
        string result = reader.ReadToEnd();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I posted a similar question to this not too long ago in regards to
Not too long ago, I had a problem which required me to set WinDbg.exe
I've had this long term issue in not quite understanding how to implement a
Long winded title, short question: If one wants to develop for Windows but not
I know how to use Perl's Getopt::Long, but I'm not sure how I can
This is using Google App Engine. I am not sure if this is applicable
Google is not being my friend - it's been a long time since my
I have a long string (a DNA sequence). It does not contain any whitespace
Not sure if this is possible or if I'm expressing correctly what I'm looking
A (long) while ago I wrote a web-spider that I multithreaded to enable concurrent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.