ResponseElementName - how can I include a prefix?

M

Mike

I am using a web reference to communicate to a web service. My
application was coded using C#. I don't have any control over the
format of the XML sent to me.

The XML sent to me looks like the following:

<soap:Body>
<abc:performActionResponse xmlns="http://www.different.com">
<Id>12345</Id>
<status>Success</status>
</abc:performActionResponse>
</soap:Body>

The applicable entry in my Reference.cs file looks like the following:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.example.com/PerformAction",
RequestNamespace="http://www.example.com",
ResponseNamespace="http://www.different.com",
ResponseElementName="abc:performActionResponse",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void PerformAction(out string Id, out ReturnCode status)
{
object[] results = this.Invoke("PerformAction", new object[] {});
Id = ((string)(results[0]));
status = ((ReturnCode)(results[1]));
}

With the 'abc:' prefix added and sent from the web service, none of my
out parameters are assigned to the results object, all entries are
null. I've tried adding and omitting the prefix from the
ResponseElementName value, both fail the same way.

I created my own webservice to test. Everything works if there is no
prefix in the ResponseElementName element, the results object is set
correctly. It fails as above if a prefix is used.

How can I modify my application to properly handle the above XML sent
from the webservice?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top