I am using latest EventSource Nuget-Package for creating eventlogs where every application gets its own folder for different types of logs.
As playing around I figured out that I can't simply change the logs name.
I tried to change it in the manifest file and registered the new channel where it displayed its new name. Unfortunately every event fired to these logs won't show up anymore till I register a new channel with predefined channel name.
Any chance to change that? Since I have to create manifest files on each machine i have to change it programatically because channel names were created by predefined values (Admin, Operational, etc...)
To be clear: I want to change following names AND have all logs written into these channels.
Sample-manifest which was generated automatically:
<instrumentationManifest xmlns="http://schemas.microsoft.com/win/2004/08/events">
<instrumentation xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events">
<events xmlns="http://schemas.microsoft.com/win/2004/08/events">
<provider name="Samples-EventSourceDemos-EventLog" guid="{d89ec17d-ee69-5275-eb6f-0c826bb76bd8}" resourceFileName="E:\EventlogTest\bin\Debug\EventlogTest.Samples-EventSourceDemos-EventLog.etwManifest.dll" messageFileName="E:\EventlogTest\bin\Debug\EventlogTest.Samples-EventSourceDemos-EventLog.etwManifest.dll" symbol="SamplesEventSourceDemosEventLog">
<channels>
<channel chid="Admin" name="Samples-EventSourceDemos-EventLog/Admin" value="16" type="Admin" enabled="true"/>
<channel chid="Analytic" name="Samples-EventSourceDemos-EventLog/Analytic" value="18" type="Analytic" enabled="false"/>
<channel chid="Debug" name="Samples-EventSourceDemos-EventLog/Debug" value="19" type="Debug" enabled="false"/>
</channels>
<tasks>
<task name="Request" message="$(string.task_Request)" value="1"/>
<task name="DebugTrace" message="$(string.task_DebugTrace)" value="65530"/>
</tasks>
<opcodes>
</opcodes>
<keywords>
<keyword name="Requests" message="$(string.keyword_Requests)" mask="0x1"/>
<keyword name="Debug" message="$(string.keyword_Debug)" mask="0x2"/>
<keyword name="Session3" message="$(string.keyword_Session3)" mask="0x100000000000"/>
<keyword name="Session2" message="$(string.keyword_Session2)" mask="0x200000000000"/>
<keyword name="Session1" message="$(string.keyword_Session1)" mask="0x400000000000"/>
<keyword name="Session0" message="$(string.keyword_Session0)" mask="0x800000000000"/>
</keywords>
<events>
<event value="1" version="0" level="win:Error" symbol="RequestStart" message="$(string.event_RequestStart)" keywords="Requests" opcode="win:Start" task="Request" channel="Admin" template="RequestStartArgs"/>
<event value="2" version="0" level="win:Error" symbol="RequestPhase" message="$(string.event_RequestPhase)" keywords="Requests" task="Request" channel="Analytic" template="RequestPhaseArgs"/>
<event value="3" version="0" level="win:Error" symbol="RequestStop" message="$(string.event_RequestStop)" keywords="Requests" opcode="win:Stop" task="Request" channel="Admin" template="RequestStopArgs"/>
<event value="4" version="0" level="win:Error" symbol="DebugTrace" message="$(string.event_DebugTrace)" keywords="Debug" task="DebugTrace" channel="Debug" template="DebugTraceArgs"/>
</events>
<templates>
<template tid="RequestStartArgs">
<data name="RequestID" inType="win:Int32"/>
<data name="Url" inType="win:UnicodeString"/>
</template>
<template tid="RequestPhaseArgs">
<data name="RequestID" inType="win:Int32"/>
<data name="PhaseName" inType="win:UnicodeString"/>
</template>
<template tid="RequestStopArgs">
<data name="RequestID" inType="win:Int32"/>
</template>
<template tid="DebugTraceArgs">
<data name="Message" inType="win:UnicodeString"/>
</template>
</templates>
</provider>
</events>
</instrumentation>
<localization>
<resources culture="de-DE">
<stringTable>
<string id="event_DebugTrace" value="DebugMessage: %1"/>
<string id="event_RequestPhase" value="Entering Phase %2 for request %1"/>
<string id="event_RequestStart" value="Start processing request%n%t*** %1 ***%nfor URL%n%t=== %2 ==="/>
<string id="event_RequestStop" value="Stop processing request%n%t*** %1 ***"/>
<string id="keyword_Debug" value="Debug"/>
<string id="keyword_Requests" value="Requests"/>
<string id="keyword_Session0" value="Session0"/>
<string id="keyword_Session1" value="Session1"/>
<string id="keyword_Session2" value="Session2"/>
<string id="keyword_Session3" value="Session3"/>
<string id="task_DebugTrace" value="DebugTrace"/>
<string id="task_Request" value="Request"/>
</stringTable>
</resources>
</localization>
</instrumentationManifest>
Thanks for your help.
Related
On my developer machine, amongst my 10 websites and their respective application pools, three of them are very frequently getting setted to startMode = Always running.
I have to reset them to OnDemand regularly and I cannot find the root cause of this.
Apps are coded in C# using .Net5 and hosted on IIS 10
Below is an exemple log from the Event Logs showing the change
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-IIS-Configuration" Guid="{dc0b8e51-4863-407a-bc3c-1b479b2978ac}" />
<EventID>29</EventID>
<Version>0</Version>
<Level>5</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x4000000000000000</Keywords>
<TimeCreated SystemTime="2022-06-20T15:25:46.2192842Z" />
<EventRecordID>5</EventRecordID>
<Correlation />
<Execution ProcessID="10120" ThreadID="10800" />
<Channel>Microsoft-IIS-Configuration/Operational</Channel>
<Computer>LAP-PLS</Computer>
<Security UserID="S-1-5-21-2179824267-3666241482-379869353-1001" />
</System>
<EventData>
<Data Name="PhysicalPath">\\?\C:\WINDOWS\system32\inetsrv\config\applicationHost.config</Data>
<Data Name="ConfigPath">MACHINE/WEBROOT/APPHOST</Data>
<Data Name="EffectiveLocationPath" />
<Data Name="Configuration">/system.applicationHost/applicationPools/add[#name="XXXX"]/#startMode</Data>
<Data Name="EditOperationType">3</Data>
<Data Name="OldValue">OnDemand</Data>
<Data Name="NewValue">AlwaysRunning</Data>
</EventData>
</Event>
This is driving me crazy and help would me much appreciated
Thanks,
I am developing APIs with Service Fabric into a big solution. After I created the services I needed (an Actor, a stateful and a stateless with .NET Framework) and I made a walking skeleton of the APIs.
I started to test and service fabric always threw the error "Service does not exist" (I'm 100% sure that the uri was right) when was the time to call the Actor (same error with both ActorProxyFactory and ActorProxy). I wathced on Cluster Explorer and under my SF App there was only the other two service. But the ActorServiceType was registered.
So I decide to create two simple SF app with an actor and I got the same error and also I don't see them on Cluster explorer.
In no projects I touched the ServiceManifest, ApplicationManifest or whatelse.
Here the versions of the tools I use:
Windows 11 Enterprise
Visual Studio Enterprise v16.11.9 with .Net Framework 4.7.1
Service Fabric Runtime 8.1.321.9590
Serive Fabric SDK 5.1.321.9590
Nuget Microsoft.SerivceFabric 8.1.321
Nuget Microsoft.ServiceFabric.Actors 5.1.321 (For the nuget packages I tried everything)
Microsoft.VisualStudio.Azure.Fabric.MSBuild 1.7.6 (also this I tried
every version)
My auto-generated setting.xml:
<?xml version="1.0" encoding="utf-8"?>
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Section Name="MyActorServiceReplicatorConfig">
<Parameter Name="ReplicatorEndpoint" Value="MyActorServiceReplicatorEndpoint" />
<Parameter Name="BatchAcknowledgementInterval" Value="0.005" />
</Section>
<Section Name="MyActorServiceReplicatorSecurityConfig">
<Parameter Name="CredentialType" Value="None" />
</Section>
<!-- The content will be generated during build -->
</Settings>
My auto-generated service-manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="MyActorPkg" Version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<ServiceTypes>
<StatefulServiceType ServiceTypeName="MyActorServiceType" HasPersistedState="true">
<Extensions>
<Extension Name="__GeneratedServiceType__" GeneratedId="5f4d2e71-68d5-43f4-b8a3-60990017b54d|Persisted">
<GeneratedNames xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
<DefaultService Name="MyActorService" />
<ReplicatorEndpoint Name="MyActorServiceReplicatorEndpoint" />
<ReplicatorConfigSection Name="MyActorServiceReplicatorConfig" />
<ReplicatorSecurityConfigSection Name="MyActorServiceReplicatorSecurityConfig" />
<StoreConfigSection Name="MyActorServiceLocalStoreConfig" />
<ServiceEndpointV2_1 Name="MyActorServiceEndpointV2_1" />
</GeneratedNames>
</Extension>
</Extensions>
</StatefulServiceType>
</ServiceTypes>
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ExeHost>
<Program>MyActor.exe</Program>
</ExeHost>
</EntryPoint>
</CodePackage>
<ConfigPackage Name="Config" Version="1.0.0" />
<Resources>
<Endpoints>
<Endpoint Name="MyActorServiceEndpointV2_1" />
<Endpoint Name="MyActorServiceReplicatorEndpoint" />
</Endpoints>
</Resources>
<!-- The content will be generated during build -->
</ServiceManifest>
my auto-generated application-manifest:
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="MyActorPkg" Version="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<ServiceTypes>
<StatefulServiceType ServiceTypeName="MyActorServiceType" HasPersistedState="true">
<Extensions>
<Extension Name="__GeneratedServiceType__" GeneratedId="5f4d2e71-68d5-43f4-b8a3-60990017b54d|Persisted">
<GeneratedNames xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
<DefaultService Name="MyActorService" />
<ReplicatorEndpoint Name="MyActorServiceReplicatorEndpoint" />
<ReplicatorConfigSection Name="MyActorServiceReplicatorConfig" />
<ReplicatorSecurityConfigSection Name="MyActorServiceReplicatorSecurityConfig" />
<StoreConfigSection Name="MyActorServiceLocalStoreConfig" />
<ServiceEndpointV2_1 Name="MyActorServiceEndpointV2_1" />
</GeneratedNames>
</Extension>
</Extensions>
</StatefulServiceType>
</ServiceTypes>
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ExeHost>
<Program>MyActor.exe</Program>
</ExeHost>
</EntryPoint>
</CodePackage>
<ConfigPackage Name="Config" Version="1.0.0" />
<Resources>
<Endpoints>
<Endpoint Name="MyActorServiceEndpointV2_1" />
<Endpoint Name="MyActorServiceReplicatorEndpoint" />
</Endpoints>
</Resources>
<!-- The content will be generated during build -->
</ServiceManifest>
my local1node.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/TEST2.MYACTOR.SF" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters />
</Application>
screens cluster explorer:
screen cluster explorer
screen cluster explorer service type
The solution of this problem found on this github issue with a step-by-step guide.
In few words if you have more than installation of Visual Studio (2019 and 2022) a service fabric package cache go in conflict.
Good Afternoon,
We have been trying to consume a Carrier API, but have hit some issue with the WSDL Generation. The Example XML message the company has provided has ns1-3 and appears that it is important for the address fields. the XML generated from their WSDL seems to generate the same fields but has no name spaces like the original and fails with "Address details are invalid", Is there some setting we are missing so that it generates the correct XML?
This is their Example XML
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns3:CreateLabel xmlns:ns3="http://courier.ck.dx.metafour.com/" xmlns:ns2="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<order>
<ns2:customerID>14337622</ns2:customerID>
<ns2:dates>
<date format="yyyy-MM-dd HH:mm:ss" type="requestedCollectionDate">2018-12-12 17:59:21</date>
</ns2:dates>
<sourceSystemReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">AMS207554</sourceSystemReference>
<customerReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">286956</customerReference>
<orderAttributes xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" xsi:nil="true" />
<ns2:orderLines>
<ns2:consignment>
<pieces>
<dimensions>
<value>1.0</value>
<type>cdlWeight</type>
<UOM>KG</UOM>
</dimensions>
<barcode xsi:nil="true" />
<trackingNumber xsi:nil="true" />
</pieces>
<qty>1</qty>
<legacyService>
<name>serviceLevel</name>
<partyId>0</partyId>
<partyType>HITS</partyType>
</legacyService>
<legacyService>
<name>serviceType</name>
<partyId>2</partyId>
<partyType>HITS</partyType>
</legacyService>
<deliverTo>
<ns2:address primary="true">
<organisationName>Argos</organisationName>
<addressLine1>Argos</addressLine1>
<addressLine2>Argos Ltd</addressLine2>
<addressLine3>11 Canning Street</addressLine3>
<city>BURNLEY</city>
<postalCode>BB12 0AD</postalCode>
<country>
<countryCode>GB</countryCode>
<description>GB</description>
</country>
</ns2:address>
<contact />
</deliverTo>
</ns2:consignment>
</ns2:orderLines>
<labelType>ZPL</labelType>
</order>
<serviceHeader>
<password>test</password>
<userId>test</userId>
</serviceHeader>
</ns3:CreateLabel>
</s:Body>
</s:Envelope>
This is our Generated XML
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CreateLabel xmlns="http://courier.ck.dx.metafour.com/">
<order xmlns="">
<customerID xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">14337622</customerID>
<dates xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<date xmlns="" format="yyyy-MM-dd HH:mm:ss" type="requestedCollectionDate">2019-01-25 10:17:33</date>
</dates>
<sourceSystemReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">AMS207554</sourceSystemReference>
<customerReference xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">286956</customerReference>
<orderAttributes xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" xsi:nil="true" />
<orderLines xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<consignment>
<pieces xmlns="">
<dimensions>
<value>1.0</value>
<type>cdlWeight</type>
<UOM>KG</UOM>
</dimensions>
<barcode xsi:nil="true" />
<trackingNumber xsi:nil="true" />
</pieces>
<qty>1</qty>
<legacyService xmlns="">
<name>serviceLevel</name>
<partyId>0</partyId>
<partyType>HITS</partyType>
</legacyService>
<legacyService xmlns="">
<name>serviceType</name>
<partyId>2</partyId>
<partyType>HITS</partyType>
</legacyService>
<deliverTo xmlns="">
<address xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0">
<organisationName xmlns="">Argos</organisationName>
<addressLine1 xmlns="">Argos</addressLine1>
<addressLine2 xmlns="">Argos Ltd</addressLine2>
<addressLine3 xmlns="">11 Canning Street</addressLine3>
<city xmlns="">BURNLEY</city>
<postalCode xmlns="">BB12 0AD</postalCode>
<country xmlns="">
<countryCode>GB</countryCode>
<description>GB</description>
</country>
</address>
<contact xmlns="http://www.thedx.co.uk/eai/canonical/types/v2.0" />
</deliverTo>
</consignment>
</orderLines>
<labelType>ZPL</labelType>
</order>
<serviceHeader xmlns="">
<password>test</password>
<userId>test</userId>
</serviceHeader>
</CreateLabel>
</s:Body>
</s:Envelope>
Any help would be greatly appreciated!
This is resolved,
I could not figure out a way to change or add additional namespace to the generated references.cs file, and ended up sending the SOAP to their server manually with an XML string serialized using a httpWebRequest and XmlSerializer
I am using Sabre SOAP Api in C#. I got the response from session creation successfully, I added wsdl Service Reference
http://files.developer.sabre.com/wsdl/sabreXML1.0.00/ServicesPlatform/PassengerDetails3.3.0RQ.wsdl to my test project and pass required values to parameters in the request as given in the documentation https://developer.sabre.com/docs/read/soap_apis/management/itinerary/Passenger_Details.
this is my xml to that is send to sabre and Getting Exception
<?xml version="1.0" encoding="utf-16"?>
<PassengerDetailsRQ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.2.1"
IgnoreOnError="false">
<MiscSegmentSellRQ xmlns="http://services.sabre.com/sp/pd/v3_2">
<MiscSegment DepartureDateTime="2018-01-10T16:45" InsertAfter="0" NumberInParty="1" Status="HK" Type="OTH">
<OriginLocation LocationCode="SAN" />
<Text>America Tours</Text>
<VendorPrefs>
<Airline Code="DL" />
</VendorPrefs>
</MiscSegment>
</MiscSegmentSellRQ>
<PostProcessing xmlns="http://services.sabre.com/sp/pd/v3_2">
<EndTransactionRQ>
<EndTransaction Ind="true">
<Email Ind="true" />
</EndTransaction>
<Source ReceivedFrom="SWS TESTING" />
</EndTransactionRQ>
</PostProcessing>
<PreProcessing xmlns="http://services.sabre.com/sp/pd/v3_2" />
<PriceQuoteInfo xmlns="http://services.sabre.com/sp/pd/v3_2">
<Link NameNumber="1.1" Record="1" />
</PriceQuoteInfo>
<SpecialReqDetails xmlns="http://services.sabre.com/sp/pd/v3_2">
<SpecialServiceRQ>
<SpecialServiceInfo>
<SecureFlight>
<PersonName DateOfBirth="02/02/1998" NameNumber="1.1">
<GivenName>Usama QW</GivenName>
<Surname>Alam</Surname>
</PersonName>
<VendorPrefs>
<Airline />
</VendorPrefs>
</SecureFlight>
</SpecialServiceInfo>
</SpecialServiceRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ xmlns="http://services.sabre.com/sp/pd/v3_2">
<AgencyInfo>
<Address>
<AddressLine>America Tours</AddressLine>
<CityName>Los Angeles</CityName>
<CountryCode>US</CountryCode>
<PostalCode>90020</PostalCode>
<StateCountyProv StateCode="CA" />
<StreetNmbr>3434 West 6th Street Suite 400-6</StreetNmbr>
</Address>
<Ticketing TicketType="7T-A" />
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber NameNumber="1.1" Phone="213-738-8185" PhoneUseType="A" />
<ContactNumber NameNumber="1.1" Phone="3162881034" PhoneUseType="A" />
</ContactNumbers>
<Email Address="www.usamaalam60#gmail.com" ShortText="AmericaTours" />
<Email Address="admin#koreaonly.com" ShortText="AmericaTours" />
<PersonName NameNumber="1.1" NameReference="MR" PassengerType="ADT">
<GivenName>Usama sd</GivenName>
<Surname>Alam</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
For this one you seem to be using invalid service version for the 3.2 namespace. Try with something like this:
*xmlns="http://services.sabre.com/sp/pd/v3_2"* and *version="3.2.0"*.
You were using version 2.2.1 here which will require a different URL.
Are you intending to use 3.2.0 version? I can see that the dates are not valid as per the schema as well. You have:
*DateOfBirth="02/02/1998"*
but should have:
*DateOfBirth="1998-02-02"*
I have XML format data which I will pass from a .net application.
In the SQL Server stored procedure, this data is passed in as a XML parameter. I want to read and save the data in the required tables, say TblOrder and TblItem.
In XML, there will be multiple orders. Each order contains one or several items accordingly.
Structure on which operation need to be implemented:
<?xml version="1.0" encoding="UTF-8"?>
<Orders>
<Order>
<B2>B2**ABIJ**0000884443**PP</B2>
<CreateBy null="true" />
<CreateDate>/Date(1485150414358)/</CreateDate>
<CurrencyId>1</CurrencyId>
<CustomerId>13</CustomerId>
<DeliveryAddress>LIBERTY PRESS LLC</DeliveryAddress>
<DeliveryCity>SPRINGVILLE UT 84663</DeliveryCity>
<DeliveryCityId>0</DeliveryCityId>
<DeliveryDate>/Date(1478750400000)/</DeliveryDate>
<DeliveryId>14</DeliveryId>
<DeliveryState>UT</DeliveryState>
<DeliveryStateId>16</DeliveryStateId>
<DeliveryType>Delivery</DeliveryType>
<EquipmentId>4</EquipmentId>
<Items>
<Item>
<CSA>false</CSA>
<CTPAT>false</CTPAT>
<CommodityItem>General Freight</CommodityItem>
<CommodityItemId>0</CommodityItemId>
<CustCommodityItem null="true" />
<FAST>false</FAST>
<Hazmat>false</Hazmat>
<Height null="true" />
<IsActive>false</IsActive>
<ItemId>0</ItemId>
<ItemName>Item A</ItemName>
<Length null="true" />
<Make null="true" />
<Mass null="true" />
<MassUnit null="true" />
<Model null="true" />
<OrderId>0</OrderId>
<PIP>false</PIP>
<PilotCar>false</PilotCar>
<ReeferTemp null="true" />
<Tarp>false</Tarp>
<TrailerType null="true" />
<TruckType null="true" />
<VIN null="true" />
<Width null="true" />
<Year null="true" />
</Item>
</Items>
<L11>L11*SYL884443*BM</L11>
<LastUpdate>/Date(1485150414358)/</LastUpdate>
</Order>
<Order>
...
<Items>
<Item>
...
</Item>
</Order>
</Orders>
Steps I want to achieve are:
Read XML parameter from the stored procedure, which is passed from the .net application.
Loop through the XML and save data in the TblOrder and TblItem tables
Going through the article follows :
Pass-XML-parameter-to-Stored-Procedure
How to loop and parse xml parameter in sql server stored procedure
I got the Idea to access very first level (in my case Order of Orders).
Moving forward having issue accessing the second level which will be again a collection (in my case Item of Items of Order).
Thanks in advance for your support
You have two approaches:
You can pass the XML as-is into a Stored Procedure and do all the hard work in T-SQL
You can shredd the XML within C#, fill appropriate data objects and use classical data storage.
From your question I take, that you'd prefer to pass this into a stored procedure as XML parameter. There are some things to know:
C# uses 16-bit-unicode internally and so does SQL Server's XML. But you will not be able to cast this unicode string to XML as long as there is encoding="UTF-8" included... You might pass this as VARCHAR(MAX) (not NVARCHAR(MAX)!), but this could lead you in troubles if there are sepcial characters involved. Best was, to cut the first line (the <?xml ...?> declaration) away completely.
Your XML is not created correctly. Is this under you control? If you include null="true" (there's no need for normally!), you should do this with the xsi-namespace. And date/time values within XML should be ISO8601. Your values (like /Date(1485150414358)/) are no format SQL Server will be able to cast directly...
Nevertheless I see multi <Order>-elements and multi <Item>-elements. You could read them as follows:
DECLARE #xml XML=
N'<Orders>
<Order>
<B2>B2**ABIJ**0000884443**PP</B2>
<CreateBy null="true" />
<CreateDate>/Date(1485150414358)/</CreateDate>
<CurrencyId>1</CurrencyId>
<CustomerId>13</CustomerId>
<DeliveryAddress>LIBERTY PRESS LLC</DeliveryAddress>
<DeliveryCity>SPRINGVILLE UT 84663</DeliveryCity>
<DeliveryCityId>0</DeliveryCityId>
<DeliveryDate>/Date(1478750400000)/</DeliveryDate>
<DeliveryId>14</DeliveryId>
<DeliveryState>UT</DeliveryState>
<DeliveryStateId>16</DeliveryStateId>
<DeliveryType>Delivery</DeliveryType>
<EquipmentId>4</EquipmentId>
<Items>
<Item>
<CSA>false</CSA>
<CTPAT>false</CTPAT>
<CommodityItem>General Freight</CommodityItem>
<CommodityItemId>0</CommodityItemId>
<CustCommodityItem null="true" />
<FAST>false</FAST>
<Hazmat>false</Hazmat>
<Height null="true" />
<IsActive>false</IsActive>
<ItemId>0</ItemId>
<ItemName>Item A</ItemName>
<Length null="true" />
<Make null="true" />
<Mass null="true" />
<MassUnit null="true" />
<Model null="true" />
<OrderId>0</OrderId>
<PIP>false</PIP>
<PilotCar>false</PilotCar>
<ReeferTemp null="true" />
<Tarp>false</Tarp>
<TrailerType null="true" />
<TruckType null="true" />
<VIN null="true" />
<Width null="true" />
<Year null="true" />
</Item>
</Items>
<L11>L11*SYL884443*BM</L11>
<LastUpdate>/Date(1485150414358)/</LastUpdate>
</Order>
</Orders>';
--the query
SELECT --elements of Order
o.value(N'(B2)[1]',N'nvarchar(max)') AS B2
--very strange date-format...
,o.value(N'(CreateDate)[1]',N'nvarchar(max)') AS CreateDate
--typed INT
,o.value(N'(CurrencyId)[1]',N'int') AS CurrencyId
--more like this
--elements of Item
,i.value(N'(CSA)[1]',N'nvarchar(max)') AS CSA
--There's no need for *null="true"*
--Query the "/text()" and the empty element will be NULL
,CASE WHEN i.value(N'(CustCommodityItem/#null)[1]',N'nvarchar(max)')=N'true' THEN NULL ELSE i.value(N'(CustCommodityItem)[1]',N'nvarchar(max)') END AS CustCommodityItem_complicated
,i.value(N'(CustCommodityItem)[1]',N'nvarchar(max)') AS CustCommodityItem_empty
,i.value(N'(CustCommodityItem/text())[1]',N'nvarchar(max)') AS CustCommodityItem_null
FROM #xml.nodes(N'/Orders/Order') AS A(o)
OUTER APPLY o.nodes(N'Items/Item') AS B(i)