I need detailed information about how to solve the following problem. In our solution we try do the following:
1. There is an XSD schema with defined type nodes. Shown in first code.
2. There is a .net type made for this schema. Shown in second code.
3. There is a Web Service that receives this schema as parameter and returns data in this schema. Shown in third code.
4. There is a K2 Process that has two Xml Fields defined in this schema, one for input, one for output.
5. There is a Web Service Call in this K2 Process that wants to use this schema like this:
OutputXmlField = WebServiceCall.GetXmlResult(InputXmlField)
I tried to add schema (with Browse), generated Metadata, tried to add this as a parameter for web service but it sais that these are incompatible types, and it cannot be compiled. It sais "Compile Error: Web Service and Assembly(Event) Line 11: Cannot implicitly convert type 'string' to 'XsdType'".
I'd like to ask you to please write me step-by-step how it can be solved. I mean how to declarate Xml Fields from schema, how to use them, etc. How can I use typed Xmls for web services or if it's impossible, what is the best way to handle situations like this (e.g XmlDocument, xml string or whatever).
Thanks in advance,
Reggy
PS. Codes are here:
XSD schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://K2POCTest/WSComm" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" targetNamespace="http://K2POCTest/WSComm" id="WSComm" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="WSComm">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" type="NInt32" />
<xs:element name="Message" type="NString" />
<xs:element name="Result" type="NString" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="NInt32">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="Value" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="NString">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Value" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
.NET class
;
return obj;
}
public static implicit operator ArrayList(WSCommType obj)
{
ArrayList arrayList = new ArrayList();
arrayList.Add(obj.Id);
arrayList.Add(obj.Message);
arrayList.Add(obj.Result);
return arrayList;
}
}
}
Web method
public WSCommType GetXmlResult(WSCommType commInfo)
{
WSCommType commResult = new WSCommType();
commResult.Id = commInfo.Id;
commResult.Message = commInfo.Message;
commResult.Result = commInfo.Id + "/" + commInfo.Message + " OK";
return commResult;
}