Yes I came to the exact same conclusion Dan, my problem was the namespace.
In my SOAP envelop it indicates xmlns="evententerprise" on the method
element. This xmlns is then being passed down to the child contact item so
my resulting xml in the node is:
<contact address="asdfasdfasdf" xmlns="evententerprise">
<Title>something</Title>
...
</contact>
You are correct when I do myelement=nodeset.selectSingleNode("//Title") then
try an reference myelement I get the object is not an instance because the
original select single node did not return a node.
So three points.
1) I am trying to get around even using namespaces as they do not provide me
anything beneficial at this point, but this concerns as they may in the
future.
2) Why does the Soap packet pass the xmlns namespace down to the root node
of the data variable that is passed and can I stop it from doing this?
3) Deal with the namespace issue and figure out how to work with it :-)
The learning curve goes on!
Cheers
Keith
Hi Keith,
Namespace is an intrinsic part of XML. You could opt (for expedience sake)
to place the XML nodes in the non-namespace by passing an empty string when
you do the first CreateNode() via the DOM (assuming this is the case). But
the easiest thing to do, if you ask me, is to get good at dealing with
namespace now if you continue to deal with raw XML. Namespace adds the
added contextual information that lets someone know they have YOUR data
type and intended definitions, instead of relying on the name of the
element alone. Try to not think of the XML on the wire as a string that
you are manipulating - it's more than that and just looks like strings.
All modern (and well done) XML processors intrinsically differentiate
namespace, as do all well done XSLT and XPath processors. I think you'll
find an overload on selectSingleNode and SelectNodes that let you specify
what namespace you wish to find.
The answer to "Preventing your elements from being expressed in any given
namespace" requires that I know how exactly you are creating your XML
nodes. Myself, I always just deal with strong typed classes and use the
XmlRootAttribute, XmlElementAttribute and XmlAttributeAttribute to do fine
control over what specific atom names and namespaces appear on the wire,
and have not had to hand sling DOM code since the BizTalk Jumpstart Kit
tools back in 99.
Dan
--------------------
>From: "Keith Chadwick" <webmaster-nospam@allianceevents.com>
>References: <#qG4gTl1EHA.3500@TK2MSFTNGP09.phx.gbl>
<bfe1rkl1EHA.3388@cpmsftngxa10.phx.gbl>
<e$LqSul1EHA.1740@TK2MSFTNGP15.phx.gbl>
<FlpNxbn1EHA.3980@cpmsftngxa10.phx.gbl>
>Subject: Re: PLEASE HELP - object reference not set to instance of an
object
>Date: Mon, 29 Nov 2004 20:56:22 -0500
>Lines: 165
[quoted text clipped - 7 lines]
>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26887
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 75 lines]
>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXS01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
>> phx.gbl!TK2MSFTNGP15.phx.gbl
>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 72 lines]
>>>
>>>I am missing something but just can't figure it the hell out!!!
Keith Chadwick - 30 Nov 2004 22:27 GMT
Hey Dan,
Yes I discovered that namespace was an intrinsic part of at least
webservices and soap when I tried to cheat and get around it, thats how one
learns.
I have managed to get everything going and like anything else it is just a
learning curve. Been using MSXML for years now so getting my head out of
that and into .NET Xml objects is a bit of strain. What makes it harder is
that my client side stuff is still using MSXML so jumping back and forth
realy starts to wear the cranium down. Same sort of situation as when you
spend all day writing JScript then go and write some VB.NET and keep
forgetting that there is a then on the if, you start to get a little
aggravated.
I managed to work with the namespaces after finding an example that actualy
stated that when you do AddNamespace on the namespaceManager that your xml
does not have to have the namespace already declared on the element just the
xmlns declared at either the element or parent node level. It seems obvious
now but when you do not know, it seems completely backwards when you think
about it. It's similar to doing a modify table script to add a column in
sql but selecting from the column before you ran the script, if you know
what I mean.
I have taken on a herculean product development from home and decided to do
it in .NET after spending 7 years doing ASP and SQL. You have to learn the
new technology at some point given the job market. Guess my old brain just
doesn't learn as quick as it did when I was a young sprig :-)
Thanks for you help Dan, really appreciated.
Cheers
Keith
> Hi Keith,
>
[quoted text clipped - 217 lines]
>>>>
>>>>I am missing something but just can't figure it the hell out!!!
Dan Rogers - 01 Dec 2004 00:36 GMT
Hi Kieth,
Great. Yes, there is a learning curve. There are some short-cuts though -
and giving up half of the hand coding was a blessing for me. If you
already have a schema for your on the wire body-payloads, try running them
through XsdObjectGen.exe (download it from Microsoft.Com/Downloads -
keyword is XsdObjectGen.exe) - it'll build most of the data management
classes for you automatically, so you don't have to have as-long a learning
curve. We built it to help me code this same kind of app faster and more
reliably.
Glad to help where I can
Dan
--------------------
>From: "Keith Chadwick" <webmaster-nospam@allianceevents.com>
>References: <#qG4gTl1EHA.3500@TK2MSFTNGP09.phx.gbl>
<bfe1rkl1EHA.3388@cpmsftngxa10.phx.gbl>
<e$LqSul1EHA.1740@TK2MSFTNGP15.phx.gbl>
<FlpNxbn1EHA.3980@cpmsftngxa10.phx.gbl>
<ORjJiCo1EHA.1300@TK2MSFTNGP14.phx.gbl>
<y7kqPPy1EHA.3956@cpmsftngxa10.phx.gbl>
>Subject: Re: PLEASE HELP - object reference not set to instance of an
object
>Date: Tue, 30 Nov 2004 17:27:45 -0500
>Lines: 273
[quoted text clipped - 7 lines]
>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26907
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 80 lines]
>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
>> phx.gbl
>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 87 lines]
>>>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXS01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
>>>> phx.gbl!TK2MSFTNGP15.phx.gbl
>>>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 75 lines]
>>>>>
>>>>>I am missing something but just can't figure it the hell out!!!
Keith Chadwick - 30 Nov 2004 22:50 GMT
The brains been working on namespace so I have a question .
On of the key things I would like to make available through this system is
for third party developers to use the webservices to retrieve and send
information back and forth over the wire. Basically we would act as a place
to store there data.
To do this there should be a schema available that they can point to in
order to understand the information they are receiving. For instance
<?xml?>
<root xmlns:eve="http://www.mydomain.com/schema">
<eve:something>
....
</eve:something>
</root>
When the above xml is parsed the actual schema is downloaded and used by the
parser to understand the xml. Am I right so far?
Now with regards to web services should the web service point to the same
schema as in
<system.web.services.webserver(Namespace:="http://www.mydomain.com/schema">
or is this something entirely different. I am not sure how the two would
link together?
You will have to forgive my naivet? but I have been avoiding schemas like
the plague for two years now :-)
Cheers
Keith
> Hi Keith,
>
[quoted text clipped - 217 lines]
>>>>
>>>>I am missing something but just can't figure it the hell out!!!
Dan Rogers - 01 Dec 2004 00:41 GMT
Hi Kieth,
Actually, there is a very formal schema definition language at this point,
and it is an integral part of the web service programming stack. Once you
have built an ASP.net web service that is returning full fledged types (and
not XmlNodes), you will be able to see the schema and WSDL (web service
description language) standard format (kind of like IDL for web services)
by typing http://myservicehost/myserviceproject/myservice.aspx?WSDL in your
browser command line.
This is what is used by the add-web-reference proxy generation tool in
VS.net (which in turn calls into WSDL.exe to generate the code for the
proxy).
That WSDL will contain the schemas required, or references to the schemas
if you get into the more complex, well versioned cases at a later date. If
you start out with classes that are just plain classes you design and code,
you will get your schemas for free. An easy learning curve!
Hope this helps
Dan Rogers
Microsoft Corporation
--------------------
>From: "Keith Chadwick" <webmaster-nospam@allianceevents.com>
>References: <#qG4gTl1EHA.3500@TK2MSFTNGP09.phx.gbl>
<bfe1rkl1EHA.3388@cpmsftngxa10.phx.gbl>
<e$LqSul1EHA.1740@TK2MSFTNGP15.phx.gbl>
<FlpNxbn1EHA.3980@cpmsftngxa10.phx.gbl>
<ORjJiCo1EHA.1300@TK2MSFTNGP14.phx.gbl>
<y7kqPPy1EHA.3956@cpmsftngxa10.phx.gbl>
>Subject: Re: PLEASE HELP - object reference not set to instance of an
object
>Date: Tue, 30 Nov 2004 17:50:50 -0500
>Lines: 274
[quoted text clipped - 7 lines]
>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26909
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 80 lines]
>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
>> phx.gbl
>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 87 lines]
>>>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXS01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
>>>> phx.gbl!TK2MSFTNGP15.phx.gbl
>>>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 75 lines]
>>>>>
>>>>>I am missing something but just can't figure it the hell out!!!
Keith Chadwick - 01 Dec 2004 01:03 GMT
Thanks Dan, the light buld just go a lot brighter. Of course if I type my
services instead of sending a xml 'blob' down to one service then the WDSL
of the service already acts as a schema to fully describe it. Now things
are becomming a lot clearer.
I try to leverage xml and schemas client side in order to prevent
submissions of data that is invalid. In many cases I do the same validation
again server side. So I guess I can simply use the WDSL of the service.
Thanks very much starting to see the bigger picture now and how things
integrate. Think I was still thinking to much along the lines of old asp
where we would leveral xml to do this stuff for us. Always got nervous when
the manufacturer said they did it for me, always ended up painting myself
into a corner :-)
Cheers
Keith
> Hi Kieth,
>
[quoted text clipped - 328 lines]
>>>>>>
>>>>>>I am missing something but just can't figure it the hell out!!!