xmlns in web service

M

Metin

I submit my form to a web service.

public void submitStudentInfo(XmlElement studentInfo){
XmlNamespaceManager xns = new XmlNamespaceManager(new NameTable());
xns.AddNamespace("my",
http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-03-19T21:30:06");
}

Currently namespace is defined in the web method statically like above. But
i want to extract this information from submitted XmlElemet. What should i
do? How can i extract this information from XmlElement?

Thanks?
 
M

Mike Sharp

If you have a reference to the node you can use the NamespaceURI property to
get it.

public void submitStudentInfo(XmlElement studentInfo){
String elementNamespaceUri = studentInfo.NamespaceURI;
XmlNamespaceManager xns = new XmlNamespaceManager(new NameTable());
xns.AddNamespace("my", elementNamespaceUri);
}

Sometimes, however, you may want to validate the submitted XML when you load
it. What I've been doing is adding a FormNamespaceURI header to my soap
request. So my InfoPath form sets the SOAPAction header along with a
"custom" FormNamespaceURI header. This isn't the best of solutions,
because it's not a "standard" implementation of the SOAP spec. But it's a
bit faster, I think.

Regards,
Mike Sharp
 

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

Top