Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Having a problem with an Xlang Null Exception
- This topic has 0 replies, 1 voice, and was last updated 9 years, 3 months ago by
community-content.
-
AuthorPosts
-
-
August 7, 2009 at 9:51 AM #22982
I’ve
created a BizTalk Server 2009 application set with a two way Receive
port. The orchestration goes like this:1:
The incoming Message is Received via an HTTP Pipeline2:
When the message comes in, I have a “Decide” shape, where the two
promoted fields “Username/Password” in the message are checked
against a SQL Server data store. If the user’s credentials succeed or
fail, a Message is created (using an Message Assignment I explain in step 3)
saying “Success” or “Failed” and sent back to the sender.3:
For both the SQL Query for the user’s credentials and the means to instantiate
a Message Assignment, I use a custom C# class library. (I’ll eventually
learn the BizTalk data adapter for SQL Queries, but for now it seems to
work great.). As my current tests are using invalid user credentials, I
just want a “Failed” message created, and sent back. And while
I know I’m getting the SQL Check just fine, I know it’s the Message Assignment
for the “Failed” message where I’m falling into this error:Shape
name: CreateFailureMessage (The message that I send if a User doesn’t
authenticate inShapeId:
6c9071f5-bcde-489a-90e7-f142310e5c0aException
thrown from: segment 1, progress 17Inner
exception: Object reference not set to an instance of an object.The
method that I’m using in particular as to how I’m doing Message Assignment came
from this blog:http://geekswithblogs.net/michaelstephenson/archive/2006/09/26/92363.aspx
I used his tutorial practically “as is”. I turned my .xsd into a C#
class via xsd.exe and then created the Adapter class as in his blog. Here’s the
code for that.namespace
Blaxo.Objects{
[Serializable]
[XmlRoot(“Response”, Namespace = “http://BTPing.PingReply“)]
public class PingReplyAdapter : Response
{
public XmlDocument ToXmlDocument()
{
XmlSerializer serializer = new XmlSerializer(typeof(PingReplyAdapter));
StringBuilder sb = new StringBuilder();
serializer.Serialize(new StringWriter(sb, CultureInfo.InvariantCulture),this);
XmlDocument doc = new XmlDocument();
doc.LoadXml(sb.ToString());
return doc;
}
}}
The
only thing that I’m wondering after done even more looking into this:A:
The name space is the name of the .xsd message file. (PingReply.xsd)B:
The name of the actual class is the Root node (Reply.cs, as the Root node of
PingReply.xsd is Reply)So,
perhaps XmlRoot(“Repose”… May need something different?
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.