Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning XML response before method
Message
 
To
09/12/2016 19:11:55
General information
Forum:
ASP.NET
Category:
Web Services
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows Server 2012
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01644778
Message ID:
01644896
Views:
39
You can also use SOAP headers for this. But again - quite awkward to implement.

+++ Rick ---

>>What are you using for your Web Service? ASMX or WCF?
>
>ASMX
>
>>Both mechanisms support methods you can implement on the service to inject custom data into the document. It's not trivial and you'd have to inspect each response to decide whether you need to actually inject. You can't just put XML at the top of the page (or end) because as you found out that produces invalid XML - the XML has to become part of the XML document. Typically in SOAP this is done with custom SOAP Headers. You can effectively define a custom SOAP Header and then set that header for the requests that need it.
>
>I suspected that.
>
>>It's been a long while since I looked at this and it's ugly. Really what you should do is add that functionality to the main SOAP envelope and the payload you're sending. A common way to do this is a common Request and Response object structure that includes message specific objects (like hasErrors,errorCode, etc.) which then has a content element into which you push your actual result data. It's a pretty common service pattern that works really well. You basically create a base ResponseMessage object and you can then subclass that to add the custom result properties that you need to actually return to the client. Most enterprise systems use a variation of this message based service style.
>
>I have all that. This is as is for regular Web Service method handlers. But, for as long as I am not in the Web Service method, thus at a very high level, I have one specific place which I need to intercept, based on a very rare condition, the request and return a custom message.
>
>I have a SOAP trace extension which might be useful for that. I will have to do more research on this.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform