Verifying Signed Xml Generated From Java In NET - certificate

I have the below XML,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Response xmlns="http://www.site.ae/g">
<Message xml:id="message">
<Header>
<Service>Read</Service>
<Action>SomeAction</Action>
</Header>
<Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SomeDataType">
<Status>Success</Status>
<Data>
<Id>123</Id>
</Data>
</Body>
</Message>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/>
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<Reference URI="#message">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue>SomeValue</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
SomeValue
</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>
SomeValue
</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</Response>
The above XML genereted from a java application. The java application team provided us 3 certificate to verify the above xml. I have created 3 objects in C#,
var clientCert = new X509Certificate2("clientCert.cer");
var intermediateCert = new X509Certificate2("intermediateCert.cer");
var rootCert = new X509Certificate2("rootCert.cer");
One is root, second one is intermediate and third one is certificate. I have created the below code,
var xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = true;
xmlDoc.Load("above.xml");
bool result = VerifyXml(xmlDoc, clientCert);
private static Boolean VerifyXml(XmlDocument Doc, X509Certificate2 Key)
{
// Create a new SignedXml object and pass it
// the XML document class.
var signedXml = new System.Security.Cryptography.Xml.SignedXml(Doc);
// Find the "Signature" node and create a new XmlNodeList object.
XmlNodeList nodeList = Doc.GetElementsByTagName("Signature");
// Throw an exception if no signature was found.
if (nodeList.Count <= 0)
{
throw new CryptographicException("Verification failed: No Signature was found in the document.");
}
// Though it is possible to have multiple signatures on
// an XML document, this app only supports one signature for
// the entire XML document. Throw an exception
// if more than one signature was found.
if (nodeList.Count >= 2)
{
throw new CryptographicException("Verification failed: More that one signature was found for the document.");
}
// Load the first <signature> node.
signedXml.LoadXml((XmlElement)nodeList[0]);
// Check the signature and return the result.
return signedXml.CheckSignature(Key, true);
}
But the above code result is always return false. Is there is something I am missing? Is .NET support verifying the xml generated from java?
Got Answer from
Verify SignatureValue And DigestValue Using Sha256 RSA

Related

Service Fabric specify fabric url

Is it possible to define which url a service uses instead of the standard fabric:/AppName/ServiceName?
I can't find if this is configurable or not on an application level.
Yes, you can change the name of the service in the ApplicationManifest.xml to something other than the name taken from the service's class name.
Short: just change the name attribute in ApplicationManifest.xml for that service to something else.
In code: If I have this service:
public interface IJustAnotherStatelessService : IService
{
Task<string> SayHelloAsync(string someValue);
}
internal sealed class JustAnotherStatelessService : StatelessService, IJustAnotherStatelessService
{
// Service implementation
}
Registered in Program.cs like this:
ServiceRuntime.RegisterServiceAsync("JustAnotherStatelessServiceType",
context => new JustAnotherStatelessService(context)).GetAwaiter().GetResult();
And in the ServiceManifest.xml for that service
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest ...>
<ServiceTypes>
<!-- This is the name of your ServiceType.
This name must match the string used in RegisterServiceType call in Program.cs. -->
<StatelessServiceType ServiceTypeName="JustAnotherStatelessServiceType" />
</ServiceTypes>
...
In the ApplicationManifest.xml you will get the suggested name:
<ApplicationManifest ...>
<DefaultServices>
<Service Name="JustAnotherStatelessService">
<StatelessService ServiceTypeName="JustAnotherStatelessServiceType" InstanceCount="[JustAnotherStatelessService_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
</DefaultServices>
</ApplicationManifest>
This will give you an Uri to you service like
fabric:/app_name/JustAnotherStatelessService
Now, go ahead and change the name in the application manifest:
<ApplicationManifest ...>
<DefaultServices>
<Service Name="AwesomeService">
<StatelessService ServiceTypeName="JustAnotherStatelessServiceType" InstanceCount="[JustAnotherStatelessService_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
</DefaultServices>
</ApplicationManifest>
And your service now answers to
fabric:/app_name/AwesomeService
You can use this uri builder (ServiceUriBuilder.cs) class from here: https://github.com/Azure-Samples/service-fabric-dotnet-web-reference-app/blob/master/ReferenceApp/Common/ServiceUriBuilder.cs
For stateless service you can easily get the proxy:
var serviceUri = new ServiceUriBuilder(ServiceName);
var proxyFactory = new ServiceProxyFactory();
var svc = proxyFactory.CreateServiceProxy<IServiceName>(serviceUri.ToUri());
For stateful service you have to specify the partition.
var serviceUri = new ServiceUriBuilder(StatefulServiceName);
var proxyFactory = new ServiceProxyFactory();
//this is just a sample of partition 1 if you are using number partitioning.
var partition = new ServicePartitionKey(1);
var svc = proxyFactory.CreateServiceProxy<IStatefulServiceName>(serviceUri.ToUri(), partition);

How to upload raw XML data via POST to URL in Talend?

I am trying to upload an xml file to a url so that I can retrieve response in XML.
I tried using thttprequest
But it says, "Can't write output after reading input."
What am I doing wrong?
The request.xml is this
<?xml version="1.0" encoding="UTF-8" ?>
<request xmlns="http://www.isinet.com/xrpc42"
src="app.id=PartnerApp,env.id=PartnerAppEnv,partner.email=EmailAddress" >
<fn name="LinksAMR.retrieve">
<list>
<!-- WHO'S REQUESTING -->
<map>
<val name="username">username</val>
<val name="password">test</val>
</map>
<!-- WHAT'S REQUESTED -->
<map>
<list name="WOS">
<val>timesCited</val>
<val>ut</val>
<val>doi</val>
<val>sourceURL</val>
<val>citingArticlesURL</val>
<val>relatedRecordsURL</val>
</list>
</map> <!--end "return_data" -->
<!-- LOOKUP DATA -->
<map>
<!-- QUERY "cite_1" -->
<map name="cite_1">
<val name="atitle">article title string</val>
<val name="stitle">full journal title</val>
<val name="issn">1234-5678</val>
<val name="vol">12</val>
<val name="issue">12</val>
<val name="year">2008</val>
<val name="doi">doi_string</val>
<val name="ut">isi_ut_num</val>
<val name="spage">1234</val>
<!-- authors list can be used to specify multiple authors -->
<list name="authors">
<val>First, AU</val>
<val>Second, AU</val>
<val>Third, AU</val>
</list>
</map> <!-- end of cite_id-->
<-- QUERY "cite_2"
<map name="cite_2">
...
</map>
-->
</map> <!-- end of citations -->
</list>
</fn>
</request>
I am posting to the web of science url
https://ws.isiknowledge.com/cps/xrpc
Normally, if there was a mistake, I should be getting a response that something went wrong in XML. I am not even getting that.
I tried using tRestClient but I am unsure of how to upload a file to the url through it. Also this post might hold some clues. https://jira.talendforge.org/browse/TDI-31574
You can also upload a string instead of the file. But for this you need to use tJava_Row, since tJava can't work with one row at a time.
URL url = new URL("https://ws.isiknowledge.com/cps/xrpc");
StringBuilder response_content = new StringBuilder();
String data=row1.content;
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
// System.out.println(line);
response_content.append(line);
}
String output=response_content.toString();
wr.close();
rd.close();
row2.content=(output);
I used tJava component
URL url = new URL("https://ws.isiknowledge.com/cps/xrpc");
StringBuilder content = new StringBuilder();
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("POST");
c.setDoOutput(true);
c.setDoInput(true);
c.setUseCaches(false);
c.setRequestProperty("Content-Type", "application/xml");
c.connect();
byte[] buffer = new byte[1024];
int cbuffer = 0;
InputStream is = new BufferedInputStream(new FileInputStream("C:\\Users\\dhiraj\\workspace\\request.xml"));
OutputStream os = new BufferedOutputStream(c.getOutputStream());
while ((cbuffer = is.read(buffer)) != -1) {
os.write(buffer, 0, cbuffer);
}
os.flush();
os.close();
is.close();
if (HttpURLConnection.HTTP_OK == c.getResponseCode()) {
is = new BufferedInputStream(
c.getInputStream());
while ((cbuffer = is.read(buffer)) != -1) {
content.append(new String(
buffer, 0, cbuffer));
}
is.close();
} else {
System.err.println(c.getResponseCode() + ":" + c.getResponseMessage());
}
row1.ResponseContent = content.toString();
c.disconnect();

how to delete a scenario in atg through API methods

I have created a scenario by creating a myScenario.sdl in my local config folder /atg/registry/data/scenarios/myScenario.sdl
myScenario.sdl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE process SYSTEM "dynamosystemresource:/atg/dtds/pdl/pdl_1.0.dtd">
<process author="admin" creation-time="1413804041263" enabled="false" last-modified-by="admin" modification-time="1413804191188">
<segment migrate-subjects="true">
<segment-name>ItemAddedToOrder</segment-name>
<!--================================-->
<!--== Item added to order Quantity with fraction is defined -->
<!--================================-->
<event id="1">
<event-name>atg.commerce.order.ItemAddedToOrder</event-name>
<filter construct="event-property-filter" operator="isNotNull">
<event-property construct="event-property">
<property-name>quantityWithFraction</property-name>
</event-property>
</filter>
</event>
<!--================================-->
<!--== Log a message message: Quantity With Fraction is Defines logTriggeringEvent: true -->
<!--================================-->
<action id="2">
<action-name>Log a message</action-name>
<action-param name="message">
<constant>Quantity With Fraction is Defines</constant>
</action-param>
<action-param name="logTriggeringEvent">
<constant type="java.lang.Boolean">true</constant>
</action-param>
</action>
</segment>
</process>
And enabled the scenario:
Registry scenarioRegistry = scenarioManager.getScenarioRegistry();
byte[] data = (byte[]) scenarioRegistry.getItem(pScenarioPath);
String xml = null;
if (data != null) {
xml = new String(data, "UTF-8");
} else {
Assert.fail("No scenario is existed to enable/disable");
}
String updatedXml;
if (scenarioState && xml != null) {
updatedXml = xml.replaceAll("enabled=\"false\"", "enabled=\"true\"");
} else {
updatedXml = xml.replaceAll("enabled=\"true\"", "enabled=\"false\"");
}
scenarioRegistry.putItem(pScenarioPath, updatedXml.getBytes("UTF-8"));
Now with this above written code, I can both disable or enable the scenario by changing the state as false and true respectively. But I want to delete the scenario(please remember, my requirement is DELETE not DISABLE SCENARIO). I know using scenarioManager.updateScenario() deleted the scenario. Is my understanding right?
One more thing, I know I can delete the scenario directly from ACC. But I need to code via code not manually from ACC.
Please share your thoughts!
Did you try scenarioRegistry.removeItem(path);

Integrate enunciate and ant for REST APIs document

I am encountering an error during integrating enunciate and ant for CXF REST service APIs project. Error exists in method getFeeItemsByCapID(). I try to find answer in source code, but without result. Who has any idea about the error? Thanks for your help. If you have any tips.
Ant Script
<path id="enunciate.classpath">
<fileset dir="${enunciate.home}/lib">
<include name="*.jar"/>
</fileset>
<!--include (optional) spring module-->
<fileset dir="${enunciate.home}/lib/modules/cxf">
<include name="*.jar"/>
</fileset>
<fileset dir="${java.home}">
<include name="lib/tools.jar"/>
</fileset>
</path>
<taskdef name="enunciate" classname="org.codehaus.enunciate.main.EnunciateTask">
<classpath refid="enunciate.classpath"/>
</taskdef>
<enunciate basedir="java/" configFile="enunciate.xml">
<include name="**/*.java"/>
<classpath refid="enunciate.classpath"/>
<export artifactId="war.file" destination="d:/myapp.war"/>
<javacArgument argument="-g"/>
</enunciate>
Enunciate.xml
<?xml version="1.0"?>
<enunciate label="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd">
<namespaces>
<namespace id="api" uri="http://api.example.com/" />
<namespace id="link" uri="http://api.example.com/link" />
<namespace id="persona" uri="http://api.example.com/persona" />
</namespaces>
<modules>
<!-- Docs -->
<docs splashPackage="org.codehaus.enunciate.api" title="test" copyright="test.com"/>
<java-client disabled="false"/>
<amf disabled="true"/>
<c disabled="true"/>
<obj-c disabled="true"/>
<csharp disabled="true"/>
<spring-app disabled="false"/>
<cxf disabled="false"/>
<gwt disabled="true"/>
<jaxws-ri disabled="true"/>
<jersey disabled="true"/>
</modules>
Java Code
#GET
#RecordDetailSecurity(RecordDetailSectionType.FEE)
#Path("/{recordIds}/fees/")
#Produces(MediaType.APPLICATION_JSON)
#JsonView(Views.PublicView.class)
public ResponseModel getFeeItemsByCapID(#PathParam("recordIds") String recordIds,
#QueryParam("fields") #DefaultValue("") String fields) throws Exception
{
Exception:
java.lang.IllegalStateException: D:\AA7.2.0\main-dev\biz\modules\rest-apis\java\com\accela\restapis\jaxrs\agency\service\FeeWebService.java:76: the element 'value' must have a value specified.
at net.sf.jelly.apt.decorations.declaration.DecoratedAnnotationMirror.<init>(DecoratedAnnotationMirror.java:66)
at net.sf.jelly.apt.decorations.DeclarationDecorator.decorate(DeclarationDecorator.java:362)
at net.sf.jelly.apt.decorations.DeclarationDecorator.decorateAnnotationMirrors(DeclarationDecorator.java:113)
at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotationMirrors(DecoratedDeclaration.java:213)
at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotations(DecoratedDeclaration.java:195)
at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotation(DecoratedDeclaration.java:225)
at org.codehaus.enunciate.contract.jaxrs.ResourceMethod.<init>(ResourceMethod.java:130)
at org.codehaus.enunciate.contract.jaxrs.Resource.getResourceMethods(Resource.java:143)
at org.codehaus.enunciate.contract.jaxrs.Resource.<init>(Resource.java:69)
at org.codehaus.enunciate.contract.jaxrs.RootResource.<init>(RootResource.java:34)
at org.codehaus.enunciate.apt.EnunciateAnnotationProcessor.getRootModel(EnunciateAnnotationProcessor.java:214)
at org.codehaus.enunciate.apt.EnunciateAnnotationProcessor.process(EnunciateAnnotationProcessor.java:103)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)
at com.sun.tools.apt.main.Main.compile(Main.java:1102)
at com.sun.tools.apt.main.Main.compile(Main.java:964)
at com.sun.tools.apt.Main.processing(Main.java:95)
at com.sun.tools.apt.Main.process(Main.java:85)
at com.sun.tools.apt.Main.process(Main.java:67)
at org.codehaus.enunciate.main.Enunciate.invokeApt(Enunciate.java:777)
at org.codehaus.enunciate.main.Enunciate.doGenerate(Enunciate.java:366)
at org.codehaus.enunciate.main.Enunciate$Stepper.step(Enunciate.java:1735)
at org.codehaus.enunciate.main.Enunciate$Stepper.stepTo(Enunciate.java:1767)
at org.codehaus.enunciate.main.Enunciate.execute(Enunciate.java:174)
at org.codehaus.enunciate.main.EnunciateTask.execute(EnunciateTask.java:156)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Source Code:
public DecoratedAnnotationMirror(AnnotationMirror delegate) {
if (delegate == null) {
throw new IllegalArgumentException("A delegate must be provided.");
}
this.delegate = delegate;
AnnotationType annotationType = delegate.getAnnotationType();
Collection<AnnotationTypeElementDeclaration> allElements = annotationType.getDeclaration() != null? annotationType.getDeclaration().getMethods() : Collections.<AnnotationTypeElementDeclaration>emptyList();
Map<AnnotationTypeElementDeclaration, AnnotationValue> elementValues = getElementValues();
put("annotationType", annotationType);
put("position", delegate.getPosition());
put("elementValues", elementValues);
allElementValues = new HashMap<String, Object>();
for (AnnotationTypeElementDeclaration element : allElements) {
if (elementValues.containsKey(element)) {
Object value = elementValues.get(element).getValue();
allElementValues.put(element.getSimpleName(), value);
put(element.getSimpleName(), value);
}
else {
AnnotationValue defaultValue = element.getDefaultValue();
if (defaultValue == null) {
throw new IllegalStateException(delegate.getPosition() + ": the element '" + element.getSimpleName() + "' must have a value specified.");
}
I have found root cause in my Customized Annotation. It seems because the annotation without default value. When I removed the customized annotation of method or append default value in annotation definition. the exception will be gone. But the annotation accept an enumeration, in business logic the annotation without default value. We always need to set enum value for using. But, why annotation always need default value? Anybody know the reason?
#Target( {ElementType.TYPE, ElementType.METHOD})
#Retention(RetentionPolicy.RUNTIME)
public #interface RecordDetailSecurity
{
RecordDetailSectionType value(); //append default value such as "default RecordDetailSectionType.ADDITIONAL_INFORMATION;"
}
#RecordDetailSecurity(RecordDetailSectionType.FEE)
public ResponseModel getFeeItemsByCapID(#PathParam("recordIds") String recordIds,
#QueryParam("fields") #DefaultValue("") String fields) throws Exception
About annotation default value error, I have created a sample project to try again. It works well. Now, I need to change my original opinion. It's my fault. :)
Firstly, my project compiling is successful without enunciate ant target before. However the enumeration "RecordDetailSectionType " belongs to another jar actually.
I didn't include the jar in to enunciate class path, so enunciate cannot to recognize the customized annotation type value. Sorry for the misunderstanding.

Full Serialization in Worfklow 4.0

I'm trying to serialize a workflow (using C#'s workflow 4.0) to retrieve the full workflow XAML and have hit a wall.
I've got an activity (myActivity) that I've created. The contents of the xaml file that describes this activity is:
<Activity mc:Ignorable="sap" x:Class="atest.MySuite" >
<Sequence sap:VirtualizedContainerService.HintSize="222,501">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Sequence DisplayName="First Sequence" sap:VirtualizedContainerService.HintSize="200,99">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</Sequence>
<Sequence DisplayName="Second Sequence" sap:VirtualizedContainerService.HintSize="200,99">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</Sequence>
<Sequence DisplayName="Third Sequence" sap:VirtualizedContainerService.HintSize="200,99">
<sap:WorkflowViewStateService.ViewState>
<scg3:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg3:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</Sequence>
</Sequence>
</Activity>
Note that the sub sequences show up in the XAML.
When I go to serialize this activity, I use the code I found on MSDN:
using (var sw = new StreamWriter(somePath))
{
sw.Write(a.Log.ToString());
StringBuilder sb = new StringBuilder();
StringWriter tw = new StringWriter(sb);
XamlWriter xw = ActivityXamlServices.CreateBuilderWriter(new XamlXmlWriter(tw, new XamlSchemaContext()));
XamlServices.Save(xw, myActivity);
string serializedActivity = sb.ToString();
}
But the string that comes out the other end is simply:
<?xml version="1.0" encoding="utf-16"?><MySuite xmlns="clr-namespace:atest;assembly=Wtf.Automation.atest" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" />
I've poked around on MSDN and on stackoverflow, but haven't found a way to retrive the full XAML of a custom activity (given an instance of that activity) like what I've described in my xaml file, not just this truncated version.
Does anyone know if there's a way? Code samples and/or pointers would be greatly appreciated.
Thanks!
I believe your issue is that ActivityXamlServices.CreateBuilderWriter works with ActivityBuilder instances. Try
XamlServices.Save(xw, new ActivityBuilder { Implementation = myActivity });
Serialize:
public static string ActivityToXaml(Activity activity)
{
StringBuilder xaml = new StringBuilder();
using (XmlWriter xmlWriter = XmlWriter.Create(xaml, new XmlWriterSettings { Indent = true, OmitXmlDeclaration = false, }))
using (XamlWriter xamlWriter = new XamlXmlWriter(xmlWriter, new XamlSchemaContext()))
using (XamlWriter xamlServicesWriter = ActivityXamlServices.CreateBuilderWriter(xamlWriter))
{
XamlServices.Save(xamlServicesWriter, new ActivityBuilder { Implementation = activity });
}
return xaml.ToString();
}
Deserialize:
public static Activity ActivityFromXaml(string activityXaml)
{
using (var reader = new StringReader(activityXaml))
{
return ActivityXamlServices.Load(reader);
}
}