Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / August 2007

Tip: Looking for answers? Try searching our database.

How can I process an input parameter of a given "type"?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
C. - 30 Aug 2007 17:36 GMT
Hello,

I have a Web Service that receives an XmlDocument of a given type. But I can
not get the contents of what is being passed other than extracting it from
the HttpContext.Current.Request.InputStream and this requires removing the
SOAP envelope manually and using the nsManager and a lot of unnecessary extra
lines of code before I can validate the schema. I was assuming I can get the
content from “part” but is null. Is there any other way than using the
HttpContext?

[Webmethod]
public XmlDocument
ProcessAssignments([System.Xml.Serialization.XmlElementAttribute(Namespace =
"http://ns.hr-xml.org/2007-04-15", ElementName = "Assignment")]
AssignmentType part)
{
.
.
.
}

Thank you in advance for your time.

C.
John Saunders [MVP] - 30 Aug 2007 20:15 GMT
> Hello,
>
[quoted text clipped - 20 lines]
> .
> }

It sounds like you have several problems here:

1) When your service is called, "part" is null. This is usually caused by
the client sending XML that is not in the correct namespace. You'll want to
take a close look at what is being sent, possibly by using a network tracing
tool like Microsoft Network Monitor, or ProxyTrace from www.pocketsoap.com.
2) You want to be able to validate the XML against the set of schemas. See
the article "Extend the ASP.NET WebMethod Framework by Adding XML Schema
Validation" at
http://msdn.microsoft.com/msdnmag/issues/03/07/XMLSchemaValidation/default.aspx. I
use a modification of this code, and validate both incoming _and outgoing_
XML. It saves a lot of time, since I use a hand-created schema. The schema
validation catches many errors, so that I don't have to manually validate
all the attributes. I only need to "manually" validate what the schema
validation would allow to pass.

Let us know if you have more questions on this.
Signature

John Saunders [MVP]


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.