Shaheed ulHaq
Shaheed ulHaq

Reputation: 516

SOAP in WinRT (Windows 8 Metro App)

I want to use a SOAP web service in a Metro App, using WinJS. What is the best way to do it?

Upvotes: 2

Views: 1981

Answers (1)

ChristiaanV
ChristiaanV

Reputation: 5541

You will need to use the WinJS.xhr object to make the call to your SOAP webservice. Your not mentioning that many details about the soap request you want to make, so i created a little dummy code which you need to fill in with your own paramters:

WinJS.xhr({
  type: "GET", 
  user: accountSid, 
  password: authKey, 
  url: "http://yourWebserviceUrl.com",
  headers: { "YourSoapHeaders": "WithTheirValues" },
    }).then(success, error);

function succes(response)
{
}

function error(error)
{
}

Please note that only the url property in the xhr request is mandatory. If you don't have a username/password you can just remove these values from the object. Additional if you need to send data with your request (for example if you do a POST request) than you can use the data property to enter that data.

Additional here's a post on MSDN about consuming a webservice with WinJS.Xhr http://msdn.microsoft.com/en-us/library/windows/apps/hh868282.aspx

(Please note that this is not a SOAP webservice, but they explain the concept of consuming webservices)

Upvotes: 4

Related Questions