|
Home > Archive > BizTalk Server Orchestration > October 2004 > Object reference not set to an instance of an object.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Object reference not set to an instance of an object.
|
|
|
| I have an incoming message from a web service of type xml.xmldocument.
I receive the message alright, then I have an assignment shape with the
following.
msgOrderDocument = msgIbisOrderResponse.GetOrderByTrackingNumberResult;
msgOrderDocument type is a schema.
I do this because I have to use the incoming message in a map, and there is
no way of using xml.xmldocument in a map.
How can I get the xmldocument and use it in a map?
The error I get is...
Object reference not set to an instance of an object.
Exception type: NullReferenceException
Source: ClientInterface
Target Site: Microsoft.XLANGs.Core.StopConditions
segment1(Microsoft.XLANGs.Core.StopConditions)
Thanks
Mangi.
| |
| Stephen W. Thomas 2004-10-15, 9:09 pm |
| Are you creating a new instance of your schema before this step?
If not, you need to do something like this first:
// Create a new Xml Document
xDoc = new System.Xml.XmlDocument();
// Load a blank schema into your Document
// This line might not be needed, I think I have got it to work without it
xDoc.LoadXml(“<root>…blank schema here”);
// Set that Xml document to your message
msgOrderDocument = xDoc;
// Your line of code here
The help guide talks about a few different ways to create an new instance of
a schema.
On a side note, I think it is possible to map a message that is an
XmlDocument to another message that is XmlDocument. Both the inbound and
outbound have to be defined as messages so I do not think it would solve this
problem. To do this mapping, just look in the help guide for “Assigning to
Transforms Dynamically”. The code looks something like this:
Inside an Expressions Shape (not Message Assignment even though you use a
Construct)
construct outXmlMessage
{
transform (outMmlMessage) = Project.Mapname(inXmlMessage);
}
This can be risky though, I have seen my messages just pass right through
without being mapped and gives no error. I think it was because the message
types didn’t match what the maps were expecting… i.e. user error.
Stephen W. Thomas
http://www.geekswithblogs.net/sthomas
"Mangi" wrote:
> I have an incoming message from a web service of type xml.xmldocument.
> I receive the message alright, then I have an assignment shape with the
> following.
>
> msgOrderDocument = msgIbisOrderResponse.GetOrderByTrackingNumberResult;
>
>
> msgOrderDocument type is a schema.
> I do this because I have to use the incoming message in a map, and there is
> no way of using xml.xmldocument in a map.
>
> How can I get the xmldocument and use it in a map?
>
> The error I get is...
>
> Object reference not set to an instance of an object.
>
> Exception type: NullReferenceException
> Source: ClientInterface
> Target Site: Microsoft.XLANGs.Core.StopConditions
> segment1(Microsoft.XLANGs.Core.StopConditions)
>
>
> Thanks
>
> Mangi.
>
>
| |
|
| Thanks for that,
Actually the error occurs when i try to use the message in a map.
after creating the message in the assign shape, i wrote it to file and it
writes out ok as a valid xml document.
This is even more puzzling, if i can write out the message to file using a
send shape, why can't i use the message in a map? The map is the very next
step after the send shape.
"Stephen W. Thomas" wrote:
[vbcol=seagreen]
> Are you creating a new instance of your schema before this step?
> If not, you need to do something like this first:
>
> // Create a new Xml Document
> xDoc = new System.Xml.XmlDocument();
>
> // Load a blank schema into your Document
> // This line might not be needed, I think I have got it to work without it
> xDoc.LoadXml(“<root>…blank schema here”);
>
> // Set that Xml document to your message
> msgOrderDocument = xDoc;
>
> // Your line of code here
>
> The help guide talks about a few different ways to create an new instance of
> a schema.
>
> On a side note, I think it is possible to map a message that is an
> XmlDocument to another message that is XmlDocument. Both the inbound and
> outbound have to be defined as messages so I do not think it would solve this
> problem. To do this mapping, just look in the help guide for “Assigning to
> Transforms Dynamically”. The code looks something like this:
>
> Inside an Expressions Shape (not Message Assignment even though you use a
> Construct)
>
> construct outXmlMessage
> {
> transform (outMmlMessage) = Project.Mapname(inXmlMessage);
> }
>
> This can be risky though, I have seen my messages just pass right through
> without being mapped and gives no error. I think it was because the message
> types didn’t match what the maps were expecting… i.e. user error.
>
> Stephen W. Thomas
> http://www.geekswithblogs.net/sthomas
>
>
> "Mangi" wrote:
>
| |
|
| Thanks for that,
Actually the error occurs when i try to use the message in a map.
after creating the message in the assign shape, i wrote it to file and it
writes out ok as a valid xml document.
This is even more puzzling, if i can write out the message to file using a
send shape, why can't i use the message in a map? The map is the very next
step after the send shape.
"Stephen W. Thomas" wrote:
[vbcol=seagreen]
> Are you creating a new instance of your schema before this step?
> If not, you need to do something like this first:
>
> // Create a new Xml Document
> xDoc = new System.Xml.XmlDocument();
>
> // Load a blank schema into your Document
> // This line might not be needed, I think I have got it to work without it
> xDoc.LoadXml(“<root>…blank schema here”);
>
> // Set that Xml document to your message
> msgOrderDocument = xDoc;
>
> // Your line of code here
>
> The help guide talks about a few different ways to create an new instance of
> a schema.
>
> On a side note, I think it is possible to map a message that is an
> XmlDocument to another message that is XmlDocument. Both the inbound and
> outbound have to be defined as messages so I do not think it would solve this
> problem. To do this mapping, just look in the help guide for “Assigning to
> Transforms Dynamically”. The code looks something like this:
>
> Inside an Expressions Shape (not Message Assignment even though you use a
> Construct)
>
> construct outXmlMessage
> {
> transform (outMmlMessage) = Project.Mapname(inXmlMessage);
> }
>
> This can be risky though, I have seen my messages just pass right through
> without being mapped and gives no error. I think it was because the message
> types didn’t match what the maps were expecting… i.e. user error.
>
> Stephen W. Thomas
> http://www.geekswithblogs.net/sthomas
>
>
> "Mangi" wrote:
>
| |
| Stephen W. Thomas 2004-10-15, 9:09 pm |
| Interesting. I got an error kind of like that that other day when I was
trying to pass back two XML Documents for a VB method. The data wrote out
find but wouldn’t send. I found it was failing on the Send Shape as well.
I solved it by making the whole call including the send in an Atomic Scope
shape, even though it did not need to be.
A quick test would be to set the Orchestration as Atomic and see what happens.
Stephen W. Thomas
http://www.geekswithblogs.net/sthomas
"Mangi" wrote:
[vbcol=seagreen]
> Thanks for that,
> Actually the error occurs when i try to use the message in a map.
> after creating the message in the assign shape, i wrote it to file and it
> writes out ok as a valid xml document.
>
> This is even more puzzling, if i can write out the message to file using a
> send shape, why can't i use the message in a map? The map is the very next
> step after the send shape.
>
>
> "Stephen W. Thomas" wrote:
>
| |
|
| 100% correct.
I put it into an atomic scope and it works like a charm.
Thank you.
Mangi.
"Stephen W. Thomas" wrote:
[vbcol=seagreen]
> Interesting. I got an error kind of like that that other day when I was
> trying to pass back two XML Documents for a VB method. The data wrote out
> find but wouldn’t send. I found it was failing on the Send Shape as well.
>
> I solved it by making the whole call including the send in an Atomic Scope
> shape, even though it did not need to be.
>
> A quick test would be to set the Orchestration as Atomic and see what happens.
>
> Stephen W. Thomas
> http://www.geekswithblogs.net/sthomas
>
>
> "Mangi" wrote:
>
|
|
|
|
|