How do I access a distinguished field in a BizTalk multipart message - biztalk

I have a multipart message with this schema (edited for brevity):
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://MyCompany/Schemas/Canonical/Property/1.0" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://MyCompany/Schemas/Canonical/Property/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Property">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property distinguished="true" xpath="/*[local-name()='Property' and namespace-uri()='http://MyCompany/Schemas/Canonical/Property/1.0']/*[local-name()='UPRN' and namespace-uri()='']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Addresses">
<xs:complexType />
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="UPRN" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Given that the message name in an Orchestration is MyMessage, how would I access the value of the distinguished field 'UPRN' in a BizTalk Expression Editor.
When I try dot notation all I get from IntilliSense is MyMessage.Property

It's supposed to be:
MessageName.PartName.RootNode.ElememtName[...].FieldName

Related

BizTalk Xml disassembler not promoting properties

I have defined a schema with several promoted properties.
I have a two way send port that calls a rest service.
The rest service returns a response matching the message schema. The receive pipeline for the two way send port has an xml disassembler component in it.
I also have a two way receive port.
The receive pipeline of the receive port has a component that publishes multiple messages into the queue so they are available using the GetNext() function. One of the messages matches the schema I published. The next component in the pipeline is an xml disassembler component.
I would have thought that in both ports, because my receive port has an xml disassembler, it would publish the promoted properties of the message so that I can subscribe to them in send ports, The values are not being promoted and I don't know why that is.
Here is my message schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://MyMessage" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="https://MyMessageProperties.PropertySchema" targetNamespace="http://MyMessage" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:imports xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
<b:namespace prefix="ns0" uri="https://MyMessageProperties.PropertySchema" location=".\PropertySchema.xsd" />
</b:imports>
</xs:appinfo>
</xs:annotation>
<xs:element name="MessageProcessingResult">
<xs:annotation>
<xs:appinfo>
<b:properties>
<b:property name="ns0:Category" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='Category' and namespace-uri()='']" />
<b:property name="ns0:Code" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='Code' and namespace-uri()='']" />
<b:property name="ns0:ComponentOfOrigin" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='ComponentOfOrigin' and namespace-uri()='']" />
<b:property name="ns0:OriginalMessageTypeValue" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='OriginalMessageType' and namespace-uri()='']/*[local-name()='Value' and namespace-uri()='']" />
<b:property name="ns0:OriginalMessageID" xpath="/*[local-name()='MessageProcessingResult' and namespace-uri()='http://MyMessage']/*[local-name()='OriginalMessageID' and namespace-uri()='']" />
</b:properties>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name="Category">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Success" />
<xs:enumeration value="Problem" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Code" type="xs:string" />
<xs:element name="ComponentOfOrigin" type="xs:string" />
<xs:element name="OriginalMessageID" type="xs:string" />
<xs:element name="OriginalMessageType" type="Type" />
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="Type">
<xs:all>
<xs:element minOccurs="1" maxOccurs="1" name="Value" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="Name" type="xs:string" />
</xs:all>
</xs:complexType>
</xs:schema>
Here is my property schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://MyMessageProperties.PropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="https://MyMessageProperties.PropertySchema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element default="Problem" name="Category" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="676ad92f-16de-42df-8758-6b92dc4816a6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="Unkown" name="Code" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="74bf0ac9-fe44-4ef1-a27c-64afe0e334bb" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="Unknown" name="ComponentOfOrigin" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="860e8876-8a0e-4fbd-aebe-84ee12bfb041" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="00000000-0000-0000-0000-000000000000" name="OriginalMessageTypeValue" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="4d329f1d-4944-46e0-9ec9-4b87eb8d7a71" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element default="00000000-0000-0000-0000-000000000000" name="OriginalMessageID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="5bc4a75a-8fb3-4b54-becc-89e5415d216d" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>
The issue is that only ONE dissembler will execute.
Notice the graphics in the Disassemble stage vs the Decode stage.
The Decode components will fire in sequence, but the Disassemble stage will probe which component matches the message, and the first one that matches will fire, and only that one.
Pipelines (Microsoft)
As an example of execution modes, the Disassemble stage of a receive pipeline is a First Match stage, thus each component in the stage is called to see if it recognizes the message and can process it. If the component responds in the affirmative, then no other components in that stage are queried to see if they can also handle the message. However, the Decode stage of a receive pipeline has an execution mode of All, meaning that each component in this stage is called to process the message in the order in which they were configured. The first decoder might be to decrypt the message, while the second might be to decompress the message from a zipped format.
So if you want to promote properties and also de-batch, you need to do in both your custom Disassembler.
e.g.
outMsg.Context.Promote(Name, Namespace, PropertyValue);

Resolve collision in class names when converting from WSDL to Java

I am converting WSDL to Java with CXF. When -autoNameResolution key is enabled CXF generates many files with the same content. Is there any way to avoid it?
To avoid nested static classes I've enabled <jaxb:globalBindings localScoping="toplevel">. As you can see in the WSDL element "Apple" is referenced three times. Unfortunately I cannot change WSDL. CXF creates
Apple.java, Apple2.java, Apple3.java accordingly or crashes when -autoNameResolution flag is not set.
<xs:element name="Forest">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="99" minOccurs="0" name="Apple">
<xs:complexType>
<xs:sequence>
<xs:element name="Size" type="xsd:string" />
<xs:element name="Color" type="xsd:string" />
<xs:element name="Taste" type="xsd:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="TreeOne">
<xs:complexType>
<xs:sequence>
<xs:element name="Branch1" type="xsd:string">
</xs:element>
<xs:element maxOccurs="99" minOccurs="0" name="Apple">
<xs:complexType>
<xs:sequence>
<xs:element name="Size" type="xsd:string" />
<xs:element name="Color" type="xsd:string" />
<xs:element name="Taste" type="xsd:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="0" name="TreeTwo">
<xs:complexType>
<xs:sequence>
<xs:element name="BranchTwo" type="xsd:string">
</xs:element>
<xs:element maxOccurs="99" minOccurs="0" name="Apple">
<xs:complexType>
<xs:sequence>
<xs:element name="Size" type="xsd:string" />
<xs:element name="Color" type="xsd:string" />
<xs:element name="Taste" type="xsd:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Is there any way to teach wsdl2java not to create Apple2.java and Apple3.java and refer to Apple.java in all three cases? With bindings I could change the name to something else like Apple2->Peach, Apple3->Watermelon but this is not that What I am looking for. It might be obvious to see that all three apples have same set of fields, and are actually the same?
Is there any way to solve that? May be some refactoring plugin that refactors code generated by cxf?
You can force JAXB/XJC to reuse existing classes using the jaxb:class/#ref customization. Something along the lines:
<jaxb:class ref="com.acme.foo.Apple"/>
Where com.acme.foo.Apple is the FQCN of one of the generated Apple classes.
Bind this to the other two xs:complexTypes and JAXB will reuse the existing class instead of generating the same thing again.
I don't have much experience with customizing WSDLs so unfortunatelly I can't point you to the exact syntax of the binding in this case.

Mass Changing Image in Crystal Reports

I want to change an image in about 110 CR 2008 Reports.
I've seen answer about mass changing fields, but I need to change image.
Is their any script or method I could use ?
if you are saving the image in the database you can create schema xml file to reade from the image from DB and call this schema as subreport in the report itself.
the schema will be like this:
You have to make some modification on the id, target, element(table Name) and source as your requirements.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="rptAppSettings" targetNamespace="http://tempuri.org/AppSettings.xsd" xmlns:mstns="http://tempuri.org/AppSettings.xsd" xmlns="http://tempuri.org /AppSettings.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas- microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft- com:xml-msdatasource">
<Connections>
<Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="ConnectionString" IsAppSettingsProperty="true" Modifier="Assembly" Name="ConnectionString (Web.config)" ParameterPrefix="#" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.ConnectionString.ConnectionString" Provider="System.Data.SqlClient" />
</Connections>
<Tables />
<Sources />
</DataSource>
</xs:appinfo>
</xs:annotation>
<xs:element name="rptAppSettings" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_DataSetName="rptAppSettings" msprop:Generator_UserDSName="rptAppSettings">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="App_Settings" msprop:Generator_UserTableName="App_Settings" msprop:Generator_RowEvArgName="App_SettingsRowChangeEvent" msprop:Generator_TableVarName="tableApp_Settings" msprop:Generator_TablePropName="App_Settings" msprop:Generator_RowDeletingName="App_SettingsRowDeleting" msprop:Generator_RowChangingName="App_SettingsRowChanging" msprop:Generator_RowDeletedName="App_SettingsRowDeleted" msprop:Generator_TableClassName="App_SettingsDataTable" msprop:Generator_RowChangedName="App_SettingsRowChanged" msprop:Generator_RowEvHandlerName="App_SettingsRowChangeEventHandler" msprop:Generator_RowClassName="App_SettingsRow">
<xs:complexType>
<xs:sequence>
<xs:element name="LogoImage" msprop:Generator_ColumnVarNameInTable="columnLogoImage" msprop:Generator_ColumnPropNameInRow="LogoImage" msprop:Generator_ColumnPropNameInTable="LogoImageColumn" msprop:Generator_UserColumnName="LogoImage" type="xs:base64Binary" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

Biztalk schema variable number of columns in delimited file permitted?

Hiyas. I have a customer sending orders to us in a flat file. There isn't really any complexity to the file but there are some inconsistencies from file to file.
The format of the file is like this:
1,2,3[CRLF]
1,2,3[CRLF]
No problems creating a schema around that structure, however from time to time they will add a new column.
1,2,3,4[CRLF]
1,2,3,4[CRLF]
Unfortunatly, they don't make their changes cascade backwards so we hare expected to support both the 3 and 4 column formats. Both formats can potentially come through the same pipeline, so i don't really have the option of creating seperate schemas/pipelines. They do always add the new fields to the end of the row, so that much at least is consistent.
The only thiing i can think of to do is to create an elaborate "figure out which schema applies and route accordingly pipeline component", but before I go down that road I wanted to see if maybe anyone had some thoughts on way to make it work with a single flat file schema (I tried to set the minOccurs property of the optional columns to 0, but that was no good).
Thanks in advance for any advice.
One way would be to define a "outer" schema and import schemas for the different versions you need to support. The "outer" schema will offer a choice block containing references to your imported version schemas.
If you need to add the next version you just have to import a new schema and add it to the choice.
The hard part of course is how you can determine how to process different versions. Maybe the simplest way would be to create a map for every dedicated type you need to handle. On the other hand you could extend a "latest-and-greatest" internal message type and decide based on message content.
"outer" schema
<!-- language: xml-schema -->
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:ns0="http://ACME.Version_001" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Outer" xmlns:ns1="http://ACME.Version_002" targetNamespace="http://ACME.Outer" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation=".\version_002.xsd" namespace="http://ACME.Version_002" />
<xs:import schemaLocation=".\version_001.xsd" namespace="http://ACME.Version_001" />
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Root" />
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
<b:references>
<b:reference targetNamespace="http://ACME.Version_001" />
<b:reference targetNamespace="http://ACME.Version_002" />
</b:references>
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" sequence_number="1" child_delimiter_type="hex" child_order="postfix" child_delimiter="0x0D 0x0A" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="1">
<xs:element ref="ns0:Version_001">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="1" structure="delimited" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element ref="ns1:Version_002">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="2" structure="delimited" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Imported schema "Version_001"
<!-- language: xml-schema -->
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Version_001" targetNamespace="http://ACME.Version_001" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Version_001" />
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Version_001">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_order="infix" rootTypeName="Version_001" child_delimiter="," />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Col1" type="xs:string" />
<xs:element name="Col2" type="xs:string" />
<xs:element name="Col3" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Imported schema "Version_002"
<!-- language: xml-schema -->
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Version_002" targetNamespace="http://ACME.Version_002" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Version_002" />
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Version_002">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_order="infix" rootTypeName="Version_001" child_delimiter="," />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Col1" type="xs:string" />
<xs:element name="Col2" type="xs:string" />
<xs:element name="Col3" type="xs:string" />
<xs:element name="Col4" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
(some default attributes omitted for readability)

ASP.net parsing Diffgrams in XML to use in DataList

I have a method:
public static DataSet getTable()
{
DataSet DS = new DataSet("My Set");
DS.ReadXml(getCategories());
return DS;
}
My getCategories() returns a stream containing my XML.
But when I run this, I get this error:
The supplied xml instance is a schema or contains an inline schema. This class cannot infer a schema for a schema.
So I'm not sure what to do.
My goal is to use the call to getTable() to populate a DataList.
I've tried using the DataTable and I get a different, but similar error.
Any help would be great.
Thanks.
Here is my XML file. Might help. Thanks.
<?xml version="1.0" encoding="utf-8"?>
<WSPackage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<ResponseInteger>0</ResponseInteger>
<ResponseBoolean>false</ResponseBoolean>
<ResponseDataset>
<xs:schema id="CategoryDS" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="CategoryDS" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Category">
<xs:complexType>
<xs:sequence>
<xs:element name="PartCategories" type="xs:string" minOccurs="0" />
<xs:element name="CategoryDescriptions" type="xs:string" minOccurs="0" />
<xs:element name="CategoryImageURLs" type="xs:string" minOccurs="0" />
<xs:element name="CategoryModelFlags" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<CategoryDS xmlns="">
<Category diffgr:id="Category1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
<PartCategories>TESTCAT</PartCategories>
<CategoryDescriptions>TESTING API</CategoryDescriptions>
<CategoryImageURLs />
<CategoryModelFlags />
</Category>
</CategoryDS>
</diffgr:diffgram>
</ResponseDataset>
<ErrorMessage />
<UserMessage />
</WSPackage>
It is related to the fact that you have the following xml in there.. If you take that out it should work. it is not going to create a schema for something that already exists.
<xs:element name="Category">
<xs:complexType>
<xs:sequence>
<xs:element name="PartCategories" type="xs:string" minOccurs="0" />
<xs:element name="CategoryDescriptions" type="xs:string" minOccurs="0" />
<xs:element name="CategoryImageURLs" type="xs:string" minOccurs="0" />
<xs:element name="CategoryModelFlags" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
t

Resources