Getting SOAP Root Element missing Exception

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am needing help debugging why I am getting the a SOAP Exception that has the message that the root element is missing.
<br/>
Setup :
<br/>
C# .Net 3.5
<br/>
I am building a project for a client. I added a web service to the project that will handle some third party integration. I used WSDL.exe to generate a service wrapper class for the service locally. I added the class to the project and modified it in two places. One, I removed the generated return class that some service methods return then added a reference to the namespace that the return class exists in. Two, I modified the constructor to the following:
<br/>
this.Url = "http://" + ConfigurationManager.AppSettings["ServiceURL"] + "/Service1.asmx";
<br/>
Usage : (trimmed down)
<br/>
for (int i = 0; i < 2 && !calledService; i++ )
{
try
{
response = new MyService().UpdateOrder(companyId, orderId, orderDate, shipDate, poNumber,
salesTax, shippingCost, shippingInfoId, billToId, salesRepKey,
customerNumber);
calledService = true;
}
catch
{
// error reporting and such
}
}
<br/>
Error :
<br/>
<span style="font-size:12.0pt;font-family:Times New Roman,serif An error occured in the Project: System.Web.Services.Protocols.SoapException With message: Server was unable to process request. ---> Root element is missing.
<span style="font-size:12.0pt;font-family:Times New Roman,serif <br/>
<span style="font-size:12.0pt;font-family:Times New Roman,serif
Function :ReadResponse
Error Message : Server was unable to process request. ---> Root element is missing.
Stack Trace : <br/> at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) <br/> at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) <br/> at MyService.UpdateOrder(Int32 companyId, Int32 orderId, DateTime orderDate, DateTime shipDate, String poNumber, String taxKey, Decimal shippingAmount, Int32 shipToId, Int32 billToId, String salesRepKey, String customerNumber) <br/> at Controls.ControlsOrder.CallUpdateOrderService(Boolean isQuote, Int32 companyId, Int32 orderId, DateTime orderDate, DateTime shipDate, String salesTax, Decimal shippingCost, Int32 shippingInfoId, Int32 billToId, Nullable`1 salesRepId, String customerNumber, String poNumber)

Further Notes :


Actor, Node, Lang, and Detail properties of the SoapException were all blank.

Problem :
<br/>
The second iteration of the loop works, while the first time fails with the above mentioned empty soap exception.
<br/>
Thoughts, comments, or requests for further information to clarify?



View the full article
 
Back
Top