2

I'm in the process of importing and recompiling a BTS 2009 project in BTS 2013 to stay within the Microsoft support life cycle.

This was developed by former developers using BTS 2009, Visual Studio 2008 on Windows XP first and later moved to Windows 7. The compiled solution is deployed in a Windows 2008 R2 server. For this exercise, I'm using Visual Studio 2013, BizTalk Server 2013 on Windows 7 all with latest Service Packs.

The solution has four projects - one each for schemas, maps, pipelines and orchestrations.

The schema project references a .ASMX web service, as a 'Web Reference' (not Service Reference). The ASMX's Response XML looks like this:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <GenerateSalesIDResponse xmlns="http://Company.Integration.SalesIDGenerator/">
      <GenerateSalesIDResult>
        <SalesID>string</SalesRefID>
        <SalesIDInASCII>string</SalesRefIDInASCII>
        <IsError>boolean</IsError>
        <ErrorMessage>string</ErrorMessage>
        <StackTrace>string</StackTrace>
      </GenerateSalesIDResult>
    </GenerateSalesIDResponse>
  </soap12:Body>
</soap12:Envelope>

In one of the orchestrations, there is a Message Assignment Shape where the expression is like this:

Msg_OrderOutputForHTML.Exception = Msg_SalesRefIDResponse.GenerateSalesIDResult.ErrorMessage;
Msg_OrderOutputForHTML.StackTrace = Msg_SalesRefIDResponse.GenerateSalesIDResult.StackTrace;

The problem before me is that, the elements ErrorMessage, StackTrace and all of their sibling elements in the above XML are not available for the BizTalk Expression editor. Intellisense works upto GenerateSalesIDResult but not after that, for any of the XML elements after that.

The error message is - identifier 'StackTrace' does not exist in 'Msg_SalesIDReponse.GenerateSalesIDResult'; are you missing an assembly reference?

What should I do in order to resolve this? Please help.

Note - I know ASMX is not recommended any more, but changing that to an equivalent WCF Service will require a lot of non-technical effort on my part :-)

Update 1:

The Reference.xsd looks like the following:

<?xml version="1.0"?>
<xs:schema xmlns:tns="http://Company.Integration.SalesIDGenerator/" elementFormDefault="qualified" targetNamespace="http://Company.Integration.SalesIDGenerator/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="SalesIDGen" nillable="true" type="tns:SalesIDGen" />
  <xs:complexType name="SalesIDGen">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" name="SalesID" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="SalesIDInASCII" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1" name="IsError" type="xs:boolean" />
      <xs:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="StackTrace" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>

Update 2: The same project if I open in VS2008, doesn't have this problem.

FMFF
  • 1,505
  • 4
  • 28
  • 55

1 Answers1

1

The message is strongly typed and it seems the class of the schema has not been properly generated, hence the child nodes not being recognized. What does the schema look like that gets generated for the web reference?

Reference.xsd

You could try updating the web reference and rebuilding the project. Also closing and reopening Visual Studio.

Update:

For other ways of accessing the content of a message inside an orchestration, have a look at https://code.msdn.microsoft.com/windowsdesktop/BizTalk-Accessing-and-0cd434f7

You could try using XPath expressions to get the message content.

So

Msg_OrderOutputForHTML.Exception = Msg_SalesRefIDResponse.GenerateSalesIDResult.ErrorMessage;

would be something like this

Msg_OrderOutputForHTML.Exception = xpath(msgOutput3,"string(/*[local-name()='GenerateSalesIDResponse' and namespace-uri()='http://Company.Integration.SalesIDGenerator/']/*[local-name()='GenerateSalesIDResult']/*[local-name()='ErrorMessage'])")
Gruff
  • 555
  • 1
  • 9
  • 14
  • Thank you @Gruff I've added the contents of Reference.xsd in the update to the original question. I've removed and re-added the Web Reference, closed and reopened VS2013, cleaned the solution and project. The error remains after all that. – FMFF Dec 30 '14 at 15:08
  • Unfortunately I have not yet used VS2013 for BizTalk development. Can you confirm the web reference generator generates a Reference.map.cs file and the elements you are trying to access are marked with `DistinguishedFieldAttribute`? I updated the answer with other ways to access the message content, for your perusal. – Gruff Dec 31 '14 at 07:53
  • Yes, I can see in the `Reference.map.cs` file, there is a `public partial class` with all the elements marked with `Microsoft.XLANGs.BaseTypes.DistinguishedFieldAttribute()` – FMFF Jan 02 '15 at 15:10