My iPhone application needs to submit an object to an already existing .NET SOAP Web Service so it can be saved to a database server. I figured the easiest way to go about this would be building an XML representation of the object and passing it to the web service. However, this doesn’t seem to be working. If the XML is more than one level deep the web service method appears to not be getting called (The web service method writes an entry to the event log when it is called).
For example if the XML is:
<Name>Jim</Name>
The web service method gets called and there is an entry in the event log on the web server.
If the XML is:
<Person><Name>Jim</Name></Person>
The web service method is not called (there is no entry in the event log).
Here is the web service method definition:
public string SubmitiPhoneObject(string theObjectAsXml) {
WriteToEventLog("Begin Service.SubmitiPhoneObject");
// Do some work…
}
And here is the SOAP request I am submitting from the iPhone:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SubmitiPhoneObject xmlns="http://www.myServer.com/iPhoneService/">
<theObjectAsXml>
<TheObject>
<PersonID>5263</PersonID>
<DepartmentID>379</DepartmentID>
</TheObject>
</theObjectAsXml>
</SubmitiPhoneObject>
</soap:Body>
Anyone have any idea why the web service method isn’t getting called? Anyone have better/easier suggestions on how to submit an object to a web service from an iPhone application?
Thanks!